/* Mobile-First Responsive Styles - Web App Feel */

body.menu-open {
    overflow: hidden;
}


.menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Sidebar overlay should be below sidebar but above other content */
#sidebarOverlay {
    z-index: 9999;
}

/* Mobile Dashboard Sidebar Toggle */
.mobile-sidebar-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-sidebar-toggle {
        display: block;
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 56px;
        height: 56px;
        background: var(--primary-color);
        color: white;
        border-radius: 50%;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 999;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        transition: transform 0.3s;
    }

    .mobile-sidebar-toggle:active {
        transform: scale(0.95);
    }

    /* Dashboard Sidebar Mobile */
    .dashboard-sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 10000;
        border-radius: 0;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding: 60px 20px 24px;
    }

    .dashboard-sidebar.active {
        right: 0;
    }

    /* Dashboard Content Mobile */
    .dashboard-content {
        padding: 16px 12px;
        border-radius: 0;
        box-shadow: none;
        min-height: calc(100vh - 60px);
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Mobile Forms */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px;
    }

    textarea.form-control {
        min-height: 100px;
    }

    select.form-control {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: left 12px center;
        padding-left: 40px;
    }
}

/* Mobile Tables and Lists */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile Modals */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-large {
        width: 95%;
        max-width: 95%;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }
}

/* Mobile Cards */
@media (max-width: 768px) {
    .card {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: var(--radius-sm);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 12px;
        margin-bottom: 12px;
    }

    .card-title {
        font-size: 16px;
    }
}

/* Mobile Grid Improvements */
@media (max-width: 768px) {
    /* All grids become single column */
    [class*="grid"],
    [class*="Grid"] {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    /* Two column grids for small items */
    .stats-grid,
    .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
}

/* Mobile Typography */
@media (max-width: 768px) {
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }

    h4 {
        font-size: 16px;
    }

    p {
        font-size: 14px;
        line-height: 1.6;
    }
}

/* Mobile Touch Targets */
@media (max-width: 768px) {
    .btn,
    button,
    a.btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }

    .nav-link {
        min-height: 44px;
        padding: 12px 16px;
    }

    .dashboard-menu a {
        min-height: 44px;
        padding: 12px 16px;
    }
}

/* Mobile Safe Areas (for notched devices) */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .header {
            padding-top: max(12px, env(safe-area-inset-top));
        }

        .dashboard-content {
            padding-bottom: max(16px, env(safe-area-inset-bottom));
        }
    }
}

/* Smooth Scrolling */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Mobile Image Optimization */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }

    .cover-image,
    .hero-image {
        object-fit: cover;
        width: 100%;
    }
}

/* Mobile Input Focus */
@media (max-width: 768px) {
    input:focus,
    textarea:focus,
    select:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
}

