/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    background: transparent;
    border: none;
    width: 30px;
    height: 24px;
    position: relative;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1100;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-main);
    z-index: 9999;
    transition: left 0.3s ease, background-color 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    border-right: 1px solid var(--border-base);
}

.mobile-nav.active {
    left: 0;
}

.mobile-nav-content {
    padding: 80px 20px 20px;
}

.mobile-search {
    position: relative;
}

.mobile-search .search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-base);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 14px;
}

.mobile-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.mobile-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu li {
    border-bottom: 1px solid var(--border-base);
}

.mobile-menu li a {
    display: block;
    padding: 14px 0;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.2s ease;
}

.mobile-menu li a:hover {
    color: var(--primary-green);
}

.mobile-menu li a i {
    width: 20px;
}

.mobile-divider {
    height: 1px;
    background: var(--border-base);
    margin: 10px 0;
}

/* Mobile Submenu */
.mobile-menu .has-submenu .submenu {
    display: none;
    list-style: none;
    padding-left: 20px;
    margin: 0;
}

.mobile-menu .has-submenu .submenu li {
    border-bottom: none;
}

.mobile-menu .has-submenu .submenu li a {
    padding: 10px 0;
    font-size: 14px;
    font-weight: 400;
}

.mobile-menu .has-submenu.active .submenu {
    display: block;
}

.mobile-menu .submenu-toggle .fa-angle-down {
    transition: transform 0.3s ease;
}

.mobile-menu .has-submenu.active .submenu-toggle .fa-angle-down {
    transform: rotate(180deg);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: none;
}

.mobile-overlay.active {
    display: block;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Large Tablets and Small Desktops (992px - 1199px) */
@media (max-width: 1199px) {
    .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    #main-nav .menu {
        gap: 15px;
    }
    
    #main-nav .menu > li > a {
        font-size: 14px;
        padding: 6px 10px;
    }
}

/* Tablets (768px - 991px) */
@media (max-width: 991px) {
    /* Header */
    #header {
        padding: 12px 0;
    }
    
    .logo img {
        height: 60px !important;
    }
    
    /* Hide desktop navigation */
    #main-nav {
        display: none;
    }
    
    /* Stats Cards */
    .stat-card {
        margin-bottom: 1rem;
    }
    
    /* Dashboard */
    .dashboard-header h1 {
        font-size: 24px;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
    }
    
    /* Footer */
    #footer .row > div {
        margin-bottom: 2rem;
    }
}

/* Mobile Landscape (576px - 767px) */
@media (max-width: 767px) {
    /* Typography */
    h1 {
        font-size: 28px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    h3 {
        font-size: 20px;
    }
    
    /* Logo */
    .logo img {
        height: 50px !important;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
    }
    
    /* Stats Cards - Stack Vertically */
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        margin-bottom: 1rem;
    }
    
    /* Dashboard Filters */
    .dashboard-filters {
        flex-direction: column;
    }
    
    .dashboard-filters > * {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination li {
        margin: 2px;
    }
}

/* Mobile Portrait (320px - 575px) */
@media (max-width: 575px) {
    /* Container Padding */
    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Typography */
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    h3 {
        font-size: 18px;
    }
    
    /* Logo */
    .logo img {
        height: 40px !important;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Forms */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Tables */
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 8px 4px;
    }
    
    /* Dashboard Stats */
    .stat-card h3 {
        font-size: 28px;
    }
    
    .stat-card p {
        font-size: 13px;
    }
    
    /* Report Cards */
    .report-card {
        padding: 15px;
    }
    
    .report-card h5 {
        font-size: 16px;
    }
    
    /* Footer */
    #footer {
        text-align: center;
    }
    
    #footer .col-lg-3 {
        margin-bottom: 2rem;
    }
    
    #footer ul {
        padding-left: 0;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-content {
        padding: 15px;
    }
}

/* Touch-Friendly Enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    a,
    button,
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .dropdown:hover > .dropdown-menu {
        display: none;
    }
    
    /* Click-based dropdowns on mobile */
    .dropdown.active > .dropdown-menu {
        display: block;
    }
}

/* Landscape Orientation */
@media (max-width: 991px) and (orientation: landscape) {
    .mobile-nav {
        width: 320px;
    }
    
    .mobile-nav-content {
        padding-top: 60px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize images and icons for retina displays */
    .logo img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Print Styles */
@media print {
    .mobile-menu-toggle,
    .mobile-nav,
    #header,
    #footer,
    .btn {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    a {
        text-decoration: underline;
    }
}
