/* OmmiQ Mobile & Responsive Styles */

/* ========================================
   Desktop Adjustments
   ======================================== */

/* Desktop: Add right padding to prevent overlap with FAB buttons */
@media (min-width: 768px) {
    .omq-planner-area {
        padding-right: 120px;
    }
}

/* ========================================
   Mobile Navigation & Drawer
   ======================================== */

/* Mobile drawer overlay - only affects mobile screens */
@media (max-width: 1023px) {
    /* Ensure drawer has highest z-index and is fully visible */
    .omq-drawer,
    .mud-drawer,
    .mud-drawer-temporary {
        z-index: 1400 !important;
        position: fixed !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .omq-main-content {
        left: 0 !important;
    }
}

/* Ensure MudBlazor's overlay covers viewport and catches clicks to close drawers */
@media (max-width: 1023px) {
    .mud-drawer-temporary .mud-overlay {
        z-index: 1399 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
}

/* Side menu overlay — click outside to close on mobile */
@media (max-width: 767px) {
    .omq-side-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1299;
    }
}

/* Hide overlay on desktop — drawer is persistent */
@media (min-width: 768px) {
    .omq-side-menu-overlay {
        display: none;
    }
}

/* ========================================
   Mobile Task Cards
   ======================================== */

@media (max-width: 1023px) {
    /* Make task cards more compact on mobile */
    .omq-task-card .mud-card-content {
        padding: 16px !important;
    }

    .omq-task-card .d-flex.align-items-center.gap-3 {
        gap: 8px !important;
    }

    /* Position chevron absolutely so chips/details use full width */
    .omq-task-card .mud-card-content > .d-flex.align-items-start {
        position: relative;
        min-height: 48px;
    }

    .omq-task-card .omq-task-expand-btn {
        position: absolute !important;
        top: 10px;
        right: 0;
        width: 35px;
        height: 35px;
        min-width: 35px;
        margin-top: 0;
    }

    /* Prevent title text from overlapping with chevron */
    .omq-task-card .flex-grow-1.min-w-0 > .d-flex:first-child {
        padding-right: 40px;
    }

    /* Align detail row icons to top when text wraps */
    .omq-task-detail-row {
        align-items: flex-start !important;
    }

    .omq-task-detail-row > .mud-icon-root {
        margin-top: 2px;
    }

    /* Keep subtask progress bar vertically centered */
    .omq-task-detail-row > .omq-subtask-progress {
        align-self: center;
    }

    /* Classic view: smaller checkbox cell and adjusted details indent */
    .omq-classic-checkbox-cell {
        width: 40px;
    }

    .omq-classic-details {
        margin-left: 68px;
    }

    /* Smaller checkbox on mobile */
    .omq-checkbox-completed,
    .omq-checkbox-uncompleted {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
    }

    /* Smaller task title on mobile */
    .omq-task-card .mud-typography {
        font-size: 0.9rem !important;
    }

    /* Smaller chips on mobile */
    .omq-task-card .omq-category-chip,
    .omq-task-card .omq-subtasks-chip {
        padding: 0 6px !important;
    }

    .omq-task-card .omq-category-chip .mud-chip-content,
    .omq-task-card .omq-subtasks-chip .mud-chip-content {
        padding: 0 !important;
    }

    .omq-task-card .mud-chip-icon {
        font-size: 14px !important;
        margin-right: 2px !important;
    }

    /* Smaller more button on mobile */
    .omq-task-card .omq-more-menu-button {
        width: 28px !important;
        height: 28px !important;
        padding: 4px !important;
    }

    .omq-task-card .omq-more-menu-button .mud-icon-root {
        font-size: 18px !important;
    }

    /* Align status icons with chips on mobile */
    .omq-task-card .d-flex.align-items-center.gap-2.mt-1 > .mud-tooltip {
        display: inline-flex;
        align-items: center;
    }

    .omq-task-card .d-flex.align-items-center.gap-2.mt-1 > .mud-tooltip .mud-icon-root {
        font-size: 16px !important;
        width: 16px !important;
        height: 16px !important;
    }
}

/* Mobile bottom navigation - compact squares with icons and text */
@media (max-width: 767px) {
    .omq-main-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        padding: 12px 8px;
        border-bottom: none;
        border-top: 1px solid #4A7A6A;
        z-index: 100;
        background-color: var(--mud-palette-background);
    }

    .omq-main-nav-container {
        gap: 4px;
        justify-content: space-between;
        padding: 0 15px 0 10px;
    }

    .omq-main-nav-item,
    .omq-main-nav-item-active {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 4px;
        min-width: 60px;
        text-align: center;
    }

    .omq-main-nav-item > div,
    .omq-main-nav-item-active > div {
        flex-direction: column !important;
        gap: 4px !important;
    }

    .omq-main-nav-item .mud-icon-root,
    .omq-main-nav-item-active .mud-icon-root {
        font-size: 28px !important;
        width: 28px !important;
        height: 28px !important;
    }

    .omq-main-nav-item span,
    .omq-main-nav-item-active span {
        font-size: 11px !important;
        line-height: 1.2;
    }

    /* Position FAB buttons above bottom navigation */
    .omq-add-task-button, .omq-add-task-button:hover {
        bottom: 100px !important;
    }

    .omq-toggle-menu-button, .omq-toggle-menu-button:hover {
        bottom: 172px !important;
    }

    /* Add bottom padding to main content to allow scrolling past FABs and bottom nav */
    .omq-planner-area {
        padding-bottom: 220px !important;
    }
    
    /* Landing page */

    .omq-hero {
        padding: 48px 0 40px;
    }

    .omq-brand {
        font-size: 3.5rem;
    }

    .omq-cards-grid {
        grid-template-columns: 1fr;
    }

    .omq-proof-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px;
    }

    .omq-page .omq-section {
        padding: 56px 0;
    }

    .omq-img-placeholder {
        min-height: 200px;
    }

    .omq-pwa-stack {
        gap: 14px;
    }

    .omq-hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .omq-btn-primary,
    .omq-btn-outline {
        text-align: center;
    }

    .omq-split {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .omq-split--reverse .omq-split-media {
        order: 1;
    }

    .omq-split--reverse .omq-split-content {
        order: 2;
    }

    /* Demo Task */
    .omq-demo-task-wrapper {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .omq-demo-task-wrapper .omq-task-card {
        border-left: none !important;
        border-right: none !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .omq-task-card .mud-typography {
        word-break: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    .omq-task-card .d-flex.gap-2 {
        flex-wrap: wrap !important;
    }

    /* Ensure task card content doesn't overflow */
    .omq-task-card .mud-card-content {
        overflow: hidden;
    }

    .omq-task-card .flex-grow-1.min-w-0 {
        min-width: 0 !important;
        overflow: hidden;
    }

    /* Brand cloud: shift left on mobile */
    .omq-brand-cloud {
        margin-left: -30px;
    }

    /* Import: stack vertically on mobile */
    .omq-import-row {
        flex-direction: column;
    }

    .omq-import-row > * {
        align-self: flex-start;
    }

    .omq-import-select {
        width: 100%;
        max-width: 100%;
    }

    .omq-import-actions {
        margin-left: 0;
    }
}

/* ========================================
   Mobile Header
   ======================================== */

@media (max-width: 767px) {
    .omq-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .omq-header-divider {
        display: none;
    }

    .omq-header-title {
        font-size: 1.75rem;
    }

    .omq-header-subtitle {
        font-size: 1rem;
    }

    .omq-header {
        margin-bottom: 24px;
    }
}

/* ========================================
   Mobile Settings Page
   ======================================== */

@media (max-width: 767px) {
    .omq-settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .omq-settings-row-control {
        display: flex;
        justify-content: flex-start;
    }
}

/* ========================================
   Mobile About Page
   ======================================== */

@media (max-width: 480px) {
    .omq-about-profile {
        flex-direction: column;
    }
}

/* ========================================
   Mobile Pills
   ======================================== */

@media (max-width: 480px) {
    .omq-pills {
        gap: 8px;
    }

    .omq-pill {
        padding: 6px 14px;
        font-size: 0.8rem;
        gap: 6px;
    }

    .omq-pill-badge {
        font-size: 0.55rem;
    }
}

/* ========================================
   Mobile Footer
   ======================================== */

@media (max-width: 599px) {
    .omq-footer-row .omq-layout-footer-link + .omq-layout-footer-link::before {
        content: none;
    }

    .omq-footer-row {
        gap: 4px 12px;
    }
}
