/**
 * Global Responsive Stylesheet
 * Tüm sayfalar için responsive kurallar (public + user + admin)
 */

/* ============================================
   BREAKPOINTS
   ============================================ */
/* Mobile: <= 480px */
/* Small tablets: 481–768px */
/* Tablets / small laptops: 769–1024px */
/* Desktop: >= 1025px */

/* ============================================
   GLOBAL RESPONSIVE RESETS
   ============================================ */

/* Prevent horizontal scroll globally */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Images and media responsive */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* Tables - wrap in scroll container */
table {
    width: 100%;
    border-collapse: collapse;
}

/* Code blocks */
pre,
code {
    overflow-x: auto;
    word-wrap: break-word;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Container utilities */
.container-responsive {
    width: 100%;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 769px) {
    .container-responsive {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (min-width: 1025px) {
    .container-responsive {
        padding-left: 32px;
        padding-right: 32px;
    }
}

/* Grid utilities */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .grid-auto {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Stack on mobile */
.stack-mobile {
    display: flex;
    flex-direction: column;
}

@media (min-width: 769px) {
    .stack-mobile {
        flex-direction: row;
    }
}

/* Hide/show utilities */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

.desktop-only-hidden {
    display: none;
}

.mobile-only-show {
    display: block;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .desktop-only-hidden {
        display: block !important;
    }
    
    .mobile-only-show {
        display: block !important;
    }
}

@media (min-width: 769px) {
    .desktop-only-hidden {
        display: none !important;
    }
    
    .mobile-only-show {
        display: none !important;
    }
    
    .desktop-sidebar {
        display: block !important;
    }
}

/* Table scroll wrapper */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.table-scroll::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, var(--bg-primary));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.table-scroll.scrollable::after {
    opacity: 1;
}

/* Full width on mobile */
.full-width-mobile {
    width: 100%;
}

@media (min-width: 769px) {
    .full-width-mobile {
        width: auto;
    }
}

/* ============================================
   NAVIGATION - HAMBURGER MENU
   ============================================ */

/* Hamburger button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10000;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 20px;
    transition: all 0.2s;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

/* Ensure hamburger button doesn't overlap with sidebar brand on mobile */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        top: 12px;
        left: 12px;
        z-index: 10001 !important;
    }
    
    /* Add padding to sidebar content to prevent overlap */
    .sidebar.active .sidebar-content {
        padding-top: 60px !important;
    }
}

.mobile-menu-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.mobile-menu-toggle[aria-expanded="true"] {
    background: var(--accent-primary);
    color: white;
}

/* Hamburger icon */
.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    transition: all 0.3s;
    position: relative;
}

.mobile-menu-toggle span::before,
.mobile-menu-toggle span::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: all 0.3s;
}

.mobile-menu-toggle span::before {
    top: -8px;
}

.mobile-menu-toggle span::after {
    bottom: -8px;
}

.mobile-menu-toggle[aria-expanded="true"] span {
    background: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] span::before {
    top: 0;
    transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] span::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile menu drawer */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-menu-drawer.active {
    transform: translateX(0);
}

/* ============================================
   SIDEBAR RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    /* Show hamburger button on mobile */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    /* Hide sidebar by default on mobile, show as drawer when active */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        background: var(--bg-secondary) !important;
        border-right: 1px solid var(--border-color) !important;
        z-index: 9999 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease-out !important;
        overflow-y: auto !important;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
        border-bottom: none !important;
        padding: 0 !important;
        margin: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    /* Add padding-top to container-main to account for hamburger button */
    .container-main {
        padding-top: 68px;
    }
    
    /* Sidebar content adjustments */
    .sidebar-content {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        height: auto;
    }
    
    .sidebar-brand {
        margin-bottom: 24px;
        width: 100%;
    }
    
    .sidebar-nav {
        width: 100%;
        margin-bottom: 24px;
    }
    
    .sidebar-menu {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .sidebar-menu-item {
        width: 100%;
    }
    
    .sidebar-menu-link {
        width: 100%;
        padding: 12px 16px;
        justify-content: flex-start;
    }
    
    /* Show menu text on mobile */
    .sidebar-menu-text {
        display: inline !important;
        flex: 1 !important;
    }
    
    .sidebar-menu-icon {
        display: inline !important;
        margin-right: 12px !important;
    }
    
    .sidebar-action-text {
        display: inline !important;
    }
    
    .sidebar-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        margin-left: 0;
        padding-right: 0;
    }
    
    .sidebar-action-btn {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Dropdown adjustments */
    .sidebar-dropdown-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: none !important;
        margin-top: 8px !important;
        margin-left: 16px !important;
        box-shadow: none !important;
        border: none !important;
        background: var(--bg-tertiary) !important;
        border-radius: var(--radius-sm) !important;
        padding: 8px 0 !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
    }
    
    .sidebar-dropdown.open .sidebar-dropdown-menu {
        display: block !important;
    }
    
    .sidebar-dropdown-item {
        padding: 8px 16px !important;
    }
    
    .sidebar-dropdown-item .sidebar-menu-icon {
        display: inline !important;
        margin-right: 8px !important;
    }
    
    .sidebar-dropdown-item span:not(.sidebar-menu-icon) {
        display: inline !important;
    }
}

/* ============================================
   MAIN CONTENT RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .main-content {
        padding: 16px !important;
    }
    
    .container-main {
        padding: 0 !important;
        padding-top: 68px !important; /* Space for hamburger button */
    }
}

/* ============================================
   CARDS & GRIDS RESPONSIVE
   ============================================ */

/* Auto-fit grid */
.grid-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

@media (max-width: 768px) {
    .grid-responsive {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* 2-column grid */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-2-col {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* 3-column grid */
.grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-3-col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-3-col {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TABLES RESPONSIVE
   ============================================ */

/* Table wrapper with scroll */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
    position: relative;
}

.table-wrapper table {
    min-width: 600px;
}

/* Stacked table cards on mobile */
@media (max-width: 768px) {
    .table-stacked {
        display: block;
    }
    
    .table-stacked thead {
        display: none;
    }
    
    .table-stacked tbody {
        display: block;
    }
    
    .table-stacked tr {
        display: block;
        margin-bottom: 16px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 16px;
    }
    
    .table-stacked td {
        display: block;
        padding: 8px 0;
        text-align: left;
        border: none;
    }
    
    .table-stacked td::before {
        content: attr(data-label) ': ';
        font-weight: 600;
        color: var(--text-secondary);
        display: inline-block;
        min-width: 120px;
    }
}

/* ============================================
   FORMS RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .form-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-group label {
        width: 100%;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        width: 100%;
        max-width: 100%;
    }
    
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ============================================
   MODALS RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        max-width: 95vw;
        margin: 10px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ============================================
   TYPOGRAPHY RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 28px !important;
    }
    
    h2 {
        font-size: 24px !important;
    }
    
    h3 {
        font-size: 20px !important;
    }
    
    h4 {
        font-size: 18px !important;
    }
    
    .page-title {
        font-size: 24px !important;
    }
}

/* ============================================
   SPACING RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .section-spacing {
        padding: 16px;
    }
    
    .card-padding {
        padding: 16px;
    }
}

/* ============================================
   SPECIFIC COMPONENT FIXES
   ============================================ */

/* Profile page responsive */
@media (max-width: 1024px) {
    .profile-top-section {
        grid-template-columns: 1fr !important;
    }
    
    .profile-right-sidebar {
        margin-top: 24px;
    }
}

@media (max-width: 768px) {
    .profile-info-section {
        flex-direction: column;
        align-items: center;
    }
    
    .profile-info-section > div:first-child {
        margin-bottom: 24px;
    }
    
    .jobs-events-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Dashboard stat cards */
@media (max-width: 1024px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Admin tables */
@media (max-width: 768px) {
    .admin-table-wrapper {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .admin-table {
        min-width: 800px;
    }
}

/* Public hero sections */
@media (max-width: 768px) {
    .public-hero-title {
        font-size: 32px !important;
    }
    
    .public-hero {
        height: 300px;
    }
}

/* Badges and pills */
@media (max-width: 768px) {
    .badge,
    .pill {
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* ============================================
   DASHBOARD & STATISTICS PAGES
   ============================================ */

/* Stats summary grid */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

@media (max-width: 1024px) {
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-summary {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .stat-card-icon {
        width: 60px;
        height: 60px;
        font-size: 36px;
    }
    
    .stat-card-value {
        font-size: 24px;
    }
}

/* Monthly stats section (charts) */
.monthly-stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

@media (max-width: 1024px) {
    .monthly-stats-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .monthly-stats-section {
        gap: 16px;
    }
    
    .stats-chart-card {
        padding: 16px;
    }
    
    .chart-container {
        height: 250px;
    }
}

/* Tasks summary (challenges) */
.tasks-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .tasks-summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .summary-card {
        padding: 16px;
    }
}

/* ============================================
   LISTING PAGES (DRIVERS, JOBS)
   ============================================ */

/* Driver cards grid */
.drivers-grid,
.jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

@media (max-width: 1024px) {
    .drivers-grid,
    .jobs-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .drivers-grid,
    .jobs-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Driver/job card */
.driver-card,
.job-card {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 768px) {
    .driver-card,
    .job-card {
        padding: 16px;
    }
}

/* Public drivers/jobs table */
.public-drivers-table,
.public-jobs-table {
    width: 100%;
    overflow-x: auto;
}

@media (max-width: 768px) {
    .public-drivers-table,
    .public-jobs-table {
        font-size: 14px;
    }
    
    .public-drivers-table th,
    .public-drivers-table td,
    .public-jobs-table th,
    .public-jobs-table td {
        padding: 8px 4px;
    }
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .pagination {
        gap: 4px;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* ============================================
   ADMIN PAGES RESPONSIVE
   ============================================ */

/* Admin table wrapper */
.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px -16px;
    padding: 0 16px;
}

@media (max-width: 768px) {
    .admin-table-wrapper {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .admin-table {
        min-width: 800px;
        font-size: 13px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px 6px;
    }
}

/* Admin filters toolbar */
.admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .admin-filters {
        flex-direction: column;
        gap: 8px;
    }
    
    .admin-filters input,
    .admin-filters select,
    .admin-filters button {
        width: 100%;
    }
}

/* Admin action buttons */
.admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .admin-actions {
        flex-direction: column;
    }
    
    .admin-actions .btn {
        width: 100%;
    }
}

/* Admin form groups */
.admin-form-group {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .admin-form-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .admin-form-group > * {
        width: 100%;
    }
}

/* Admin stat cards */
.admin-stat-card {
    min-width: 200px;
}

@media (max-width: 1024px) {
    .admin-stat-card {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .admin-stat-card {
        width: 100%;
        min-width: 100%;
    }
}

/* ============================================
   PROFILE PAGE (already in responsive.css but enhanced)
   ============================================ */

@media (max-width: 1024px) {
    .profile-top-section {
        grid-template-columns: 1fr !important;
    }
    
    .profile-right-sidebar {
        margin-top: 24px;
    }
}

@media (max-width: 768px) {
    .profile-info-section {
        flex-direction: column;
        align-items: center;
        padding: 16px;
    }
    
    .profile-info-section > div:first-child {
        margin-bottom: 24px;
        width: 100%;
    }
    
    .profile-info-section img {
        width: 120px !important;
        height: 120px !important;
    }
    
    .profile-info-section h1 {
        font-size: 24px !important;
    }
    
    .jobs-events-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .profile-section {
        padding: 16px;
    }
}

/* ============================================
   CHALLENGES PAGES
   ============================================ */

/* Challenge task cards */
.task-card {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 768px) {
    .task-card {
        padding: 16px;
    }
    
    .task-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* System info bar (daily/weekly/monthly) */
.system-info-bar,
.weekly-statusbar,
.monthly-statusbar {
    flex-wrap: wrap;
}

/* ============================================
   MOBILE NAVIGATION - STICKY TOP BAR & DRAWER
   ============================================ */

/* Mobile Top Bar (Sticky) */
.mobile-top-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000 !important;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    pointer-events: auto !important;
}

.mobile-top-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    max-width: 100%;
}

.mobile-top-bar-logo {
    flex: 1;
    min-width: 0;
}

.mobile-top-bar-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Nav Toggle Button */
.mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 12px;
    position: relative;
    z-index: 10001 !important;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.mobile-nav-toggle:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.mobile-nav-toggle[aria-expanded="true"] {
    background: var(--accent-primary);
    color: white;
}

/* Hamburger icon */
.mobile-nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    transition: all 0.3s;
    position: relative;
}

.mobile-nav-toggle span::before,
.mobile-nav-toggle span::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: all 0.3s;
}

.mobile-nav-toggle span::before {
    top: -8px;
}

.mobile-nav-toggle span::after {
    bottom: -8px;
}

.mobile-nav-toggle[aria-expanded="true"] span {
    background: transparent;
}

.mobile-nav-toggle[aria-expanded="true"] span::before {
    top: 0;
    transform: rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"] span::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    pointer-events: none; /* Drawer kapalıyken tıklamaları engelleme */
    visibility: hidden;
}

.mobile-nav-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto; /* Drawer açıkken overlay'e tıklanabilir (kapatmak için) */
    visibility: visible;
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 90vw);
    max-width: 90vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    visibility: visible;
    opacity: 1;
}

.mobile-nav-drawer.active {
    transform: translateX(0);
}

/* Drawer Header */
.mobile-nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.mobile-nav-drawer-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 12px;
}

.mobile-nav-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mobile-nav-close:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Drawer Content */
.mobile-nav-drawer-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
}

/* Mobile Nav Menu */
.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {
    margin: 0;
    padding: 0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px; /* Touch target size */
}

.mobile-nav-link:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.mobile-nav-item.active > .mobile-nav-link {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

.mobile-nav-icon {
    font-size: 20px;
    width: 24px;
    flex-shrink: 0;
    text-align: center;
}

.mobile-nav-text {
    flex: 1;
    min-width: 0;
}

/* Mobile Accordion */
.mobile-accordion {
    display: flex;
    flex-direction: column;
}

.mobile-accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    pointer-events: auto !important;
    cursor: pointer !important;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-accordion-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 12px;
}

.mobile-accordion.open .mobile-accordion-arrow {
    transform: rotate(180deg);
}

.mobile-accordion-content {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: var(--bg-tertiary);
}

.mobile-accordion.open .mobile-accordion-content {
    max-height: 1000px !important; /* Large enough for most menus */
    overflow: visible !important;
    display: block !important;
    visibility: visible !important;
}

/* Ensure accordion content is visible when open - more specific selector */
.mobile-nav-item.mobile-accordion.open .mobile-accordion-content {
    max-height: 1000px !important;
    overflow: visible !important;
    display: block !important;
    visibility: visible !important;
}

/* Initial state for open accordions - even more specific */
li.mobile-nav-item.mobile-accordion.open ul.mobile-accordion-content {
    max-height: 1000px !important;
    overflow: visible !important;
    display: block !important;
    visibility: visible !important;
}

.mobile-nav-subitem {
    margin: 0;
    padding: 0;
}

.mobile-nav-sublink {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 56px; /* Indent sub-items */
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
    min-height: 44px;
}

.mobile-nav-sublink:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mobile-nav-subitem.active > .mobile-nav-sublink {
    background: var(--bg-hover);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
    padding-left: 53px; /* Adjust for border */
}

.mobile-nav-sublink .mobile-nav-icon {
    font-size: 18px;
    width: 20px;
}

/* Mobile Nav Actions */
.mobile-nav-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.mobile-nav-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    min-height: 44px;
}

.mobile-nav-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.mobile-nav-action-logout {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.mobile-nav-action-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.mobile-nav-action-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.mobile-nav-action-text {
    flex: 1;
}

/* Body scroll lock when drawer is open */
body.drawer-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Desktop: Hide mobile navigation, show desktop sidebar */
@media (min-width: 769px) {
    .mobile-top-bar,
    .mobile-nav-overlay,
    .mobile-nav-drawer {
        display: none !important;
        visibility: hidden !important;
    }
    
    .desktop-sidebar {
        display: block !important;
    }
}

/* Mobile: Show mobile navigation, hide desktop sidebar */
@media (max-width: 768px) {
    .desktop-sidebar {
        display: none !important;
    }
    
    .mobile-top-bar {
        display: block !important;
        visibility: visible !important;
    }
    
    .mobile-nav-drawer {
        display: flex !important;
        visibility: visible !important;
    }
    
    .mobile-nav-overlay {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .system-info-bar,
    .weekly-statusbar,
    .monthly-statusbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .system-status-item,
    .weekly-status-item,
    .monthly-status-item {
        width: 100%;
        justify-content: space-between;
    }
    
    .monthly-status-divider,
    .weekly-status-divider {
        display: none;
    }
}

/* Week/Month header */
.week-header,
.month-header {
    padding: 16px;
}

@media (max-width: 768px) {
    .week-header,
    .month-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .week-meta,
    .month-meta {
        width: 100%;
    }
}
