/* ============================================
   CMA OMBESSA - Header & Navigation Responsive
   Enhanced mobile styles for header and sidebar
   ============================================ */

/* ============================================
   MOBILE BASE STYLES (< 480px)
   ============================================ */

/* Header adjustments for small mobile */
.main-header {
    height: 56px;
    padding: 0 var(--space-3);
    padding-left: calc(var(--space-3) + 52px); /* Space for toggle button */
    gap: var(--space-2);
}

/* Sidebar toggle button polish */
.sidebar-toggle {
    width: 40px;
    height: 40px;
    top: 8px;
    left: var(--space-3);
    border-radius: var(--radius-md);
}

.sidebar-toggle svg {
    width: 22px;
    height: 22px;
}

/* Search bar - make it more compact on mobile */
.header-search {
    flex: 1;
    min-width: 0;
}

.header-search-input {
    height: 38px;
    font-size: 14px; /* Prevent iOS zoom */
    padding-left: var(--space-10);
    padding-right: var(--space-3);
    border-radius: var(--radius-md);
}

.header-search-icon {
    left: var(--space-3);
    width: 18px;
    height: 18px;
}

/* Header actions - tighter spacing */
.header-actions {
    gap: var(--space-2);
    flex-shrink: 0;
}

/* Icon buttons - touch friendly but compact */
.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
}

.header-icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Notification badge adjustment */
.header-icon-badge {
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    border-width: 1.5px;
}

/* User profile button - compact on mobile */
.header-user {
    padding: var(--space-1);
    border-radius: var(--radius-md);
}

.header-user-avatar {
    width: 34px;
    height: 34px;
}

/* Hide user info on small screens */
.header-user-info,
.header-user-chevron {
    display: none;
}

/* Dropdown positioning for mobile */
.header-dropdown {
    right: var(--space-3);
    min-width: 200px;
}

/* ============================================
   LARGER MOBILE (480px+)
   ============================================ */
@media (min-width: 480px) {
    .main-header {
        height: 60px;
        padding-left: calc(var(--space-4) + 52px);
        padding-right: var(--space-4);
        gap: var(--space-3);
    }

    .sidebar-toggle {
        width: 44px;
        height: 44px;
        left: var(--space-4);
        top: 8px;
    }

    .header-search-input {
        height: 42px;
    }

    .header-icon-btn {
        width: 40px;
        height: 40px;
    }

    .header-user-avatar {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   TABLET (768px+)
   ============================================ */
@media (min-width: 768px) {
    .main-header {
        height: 64px;
        padding: 0 var(--space-5);
        padding-left: calc(var(--space-5) + 52px);
        gap: var(--space-4);
    }

    .header-search-input {
        height: 44px;
        padding-left: var(--space-12);
    }

    .header-search-icon {
        left: var(--space-4);
        width: 20px;
        height: 20px;
    }

    .header-icon-btn {
        width: 42px;
        height: 42px;
        border-radius: var(--radius-lg);
    }

    .header-user {
        padding: var(--space-2);
    }

    .header-user-avatar {
        width: 38px;
        height: 38px;
    }
}

/* ============================================
   DESKTOP (1024px+) - Sidebar visible
   ============================================ */
@media (min-width: 1024px) {
    .main-header {
        height: var(--header-height);
        padding: 0 var(--space-6);
        gap: var(--space-6);
    }

    /* Show user info on desktop */
    .header-user-info {
        display: flex;
    }

    .header-user-chevron {
        display: block;
    }

    .header-user {
        padding: var(--space-2);
        padding-right: var(--space-3);
    }
}

/* ============================================
   SIDEBAR MOBILE ENHANCEMENTS
   ============================================ */

/* Smoother slide animation */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When sidebar is open on mobile */
@media (max-width: 1023px) {
    .sidebar.open {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
    }

    /* Better overlay appearance */
    .sidebar-overlay.visible {
        backdrop-filter: blur(2px);
    }
}

/* Small mobile sidebar width */
@media (max-width: 360px) {
    .sidebar {
        width: 260px;
    }

    .sidebar-header {
        padding: var(--space-3);
        gap: var(--space-3);
    }

    .sidebar-logo {
        width: 40px;
        height: 40px;
    }

    .sidebar-brand-name {
        font-size: var(--text-lg);
    }

    .sidebar-link {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
    }

    .sidebar-link-icon {
        width: 20px;
        height: 20px;
    }

    .sidebar-link-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================================
   LANDSCAPE MOBILE ADJUSTMENTS
   ============================================ */
@media (max-width: 767px) and (orientation: landscape) {
    .main-header {
        height: 48px;
    }

    .sidebar-toggle {
        width: 36px;
        height: 36px;
        top: 6px;
    }

    .header-search-input {
        height: 36px;
    }

    .header-icon-btn {
        width: 36px;
        height: 36px;
    }

    .header-user-avatar {
        width: 32px;
        height: 32px;
    }

    /* Sidebar adjustments in landscape */
    .sidebar {
        width: 260px;
    }

    .sidebar-header {
        padding: var(--space-3);
    }

    .sidebar-app-card {
        display: none; /* Hide download card in landscape to save space */
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects */
    .sidebar-toggle:hover {
        background: white;
        border-color: var(--gray-200);
    }

    .header-icon-btn:hover {
        background: var(--gray-100);
    }

    /* Ensure minimum touch targets */
    .sidebar-link {
        min-height: 44px;
    }
}

/* ============================================
   ACCESSIBILITY - REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }

    .sidebar-overlay {
        transition: none;
    }

    .sidebar-toggle,
    .header-icon-btn,
    .header-user {
        transition: none;
    }
}
