/* ============================================= */
/* PAGES RESPONSIVE FIXES                        */
/* index.php, projects.php, settings.php          */
/* Add AFTER style.css in all 3 pages:            */
/* <link rel="stylesheet" href="assets/css/pages-responsive.css"> */
/* ============================================= */

/* --- Mobile Hamburger Button --- */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-color);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    position: relative;
    z-index: 1001;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

/* --- Mobile Nav Overlay --- */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-overlay.active {
    opacity: 1;
}

/* ====================== */
/* TABLET (≤900px)         */
/* ====================== */
@media (max-width: 900px) {
    .container {
        padding: 16px;
    }

    /* Header */
    .header {
        padding: 16px 0;
        margin-bottom: 24px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo i {
        font-size: 24px;
    }

    /* Hero */
    .hero {
        padding: 40px 10px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-subtitle {
        font-size: 17px;
    }

    /* Suggestions - 2 columns */
    .suggestions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .suggestion-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* Projects grid - 2 columns */
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    /* Settings */
    .settings-page {
        max-width: 100%;
    }

    .settings-form {
        padding: 20px;
    }
}

/* ====================== */
/* MOBILE (≤768px)         */
/* ====================== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    /* Show hamburger */
    .menu-toggle {
        display: flex;
    }

    .nav-overlay {
        display: block;
        pointer-events: none;
    }

    .nav-overlay.active {
        pointer-events: auto;
    }

    /* Header - keep horizontal, compact */
    .header {
        padding: 12px 0;
        margin-bottom: 20px;
        position: relative;
    }

    .logo h1 {
        font-size: 18px;
    }

    .logo i {
        font-size: 22px;
    }

    /* Nav becomes slide-down drawer */
    .nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 260px;
        height: 100vh;
        height: 100dvh;
        background: var(--bg-secondary);
        border-left: 1px solid var(--border-color);
        box-shadow: -4px 0 25px rgba(0, 0, 0, 0.3);
        z-index: 1000;
        flex-direction: column;
        padding: 80px 20px 20px;
        gap: 4px;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav.open {
        transform: translateX(0);
    }

    .nav-link {
        display: flex;
        align-items: center;
        padding: 14px 16px;
        border-radius: 10px;
        font-size: 15px;
        font-weight: 500;
        width: 100%;
    }

    .nav-link:hover {
        background: var(--bg-tertiary);
    }

    .nav-link.active {
        background: var(--primary-color);
        color: white;
    }

    /* Theme toggle inside nav */
    .nav .theme-toggle {
        margin-top: 12px;
        width: 100%;
        height: 44px;
        border-radius: 10px;
        justify-content: center;
    }

    /* Hero Section */
    .hero {
        padding: 24px 0;
    }

    .hero-title {
        font-size: 28px;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 15px;
        margin-bottom: 24px;
    }

    /* Input Box */
    .input-box {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .input-box textarea {
        font-size: 15px;
        min-height: 70px;
    }

    /* Suggestions - single column */
    .suggestions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .suggestion-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 13px;
        justify-content: center;
    }

    /* Projects Grid */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .project-card {
        padding: 16px;
    }

    .project-preview {
        height: 140px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-header .btn-primary {
        width: 100%;
        justify-content: center;
    }

    /* Search Bar */
    .search-bar {
        max-width: 100%;
    }

    /* Settings */
    .settings-page {
        max-width: 100%;
    }

    .settings-page h2 {
        font-size: 20px;
    }

    .settings-form {
        padding: 16px;
        border-radius: 10px;
    }

    .provider-settings {
        padding: 16px;
    }

    .info-box {
        flex-direction: column;
        gap: 10px;
        padding: 16px;
    }

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

    /* Modal */
    .modal-content {
        width: 94%;
        margin: 0 auto;
    }

    /* Empty State */
    .empty-state {
        padding: 50px 16px;
    }

    .empty-state i {
        font-size: 48px;
    }

    .empty-state h3 {
        font-size: 20px;
    }
}

/* ====================== */
/* SMALL MOBILE (≤480px)   */
/* ====================== */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 10px 0;
        margin-bottom: 16px;
    }

    .logo {
        gap: 8px;
    }

    .logo h1 {
        font-size: 16px;
    }

    .logo i {
        font-size: 20px;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .input-box {
        padding: 12px;
    }

    .input-box textarea {
        font-size: 14px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 10px 18px;
        font-size: 14px;
    }

    .project-preview {
        height: 120px;
    }

    .settings-form {
        padding: 12px;
    }

    .provider-settings {
        padding: 12px;
    }

    .form-group label {
        font-size: 14px;
    }
}

/* ====================== */
/* SAFE AREA SUPPORT       */
/* ====================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .nav {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .container {
        padding-left: calc(12px + env(safe-area-inset-left));
        padding-right: calc(12px + env(safe-area-inset-right));
    }
}
