/* ===================================================================
   MESHAAL EL CHABAB - RESPONSIVE STYLESHEET
   Professional Mobile-First Design
   Breakpoints: 320px, 375px, 430px, 768px, 1024px, 1280px, 1440px+
   =================================================================== */

/* Bottom nav is mobile-only: hidden on desktop by default */
.mobile-bottom-nav { display: none; }

/* Page transition (leave animation before navigation) */
body.page-leave {
    opacity: 0 !important;
    transform: translateY(8px);
    transition: opacity .12s ease, transform .12s ease;
}

@keyframes bottomNavIn {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@keyframes menuItemIn {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Large Desktops (1280px+) */
@media (min-width: 1280px) {
    .container {
        padding-inline: 2rem;
    }
}

/* Laptops & Standard Desktops (1024px to 1279px) */
@media (max-width: 1279px) {
    .hero-text h1 {
        font-size: 2.3rem;
    }
    
    .quick-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
        gap: 1.5rem;
    }
}

/* Tablets (768px to 1023px) */
@media (max-width: 1023px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: #ffffff;
        flex-direction: column;
        padding: 1.5rem 1.25rem;
        gap: 1rem;
        border-bottom: 2px solid var(--green-600);
        box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        text-align: center;
    }
    .nav-links.open { display: flex; }
    .mobile-menu-btn { display: flex; }
    
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-text .desc { margin-inline: auto; }
    .hero-btns { justify-content: center; }
    .hero-emblem img { width: 180px; height: 180px; }
    
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .dual-grid { grid-template-columns: 1fr; }
    .acts-grid { grid-template-columns: repeat(2, 1fr); }
    
    .nl-bar { flex-direction: column; align-items: stretch; text-align: center; }
    .nl-form { max-width: 100%; }
    .nl-social { align-items: center; }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .dash-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Mobile Devices (max-width: 767px) */
@media (max-width: 767px) {
    /* Add safe area padding for notch phones */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: 80px; /* Space for bottom nav */
    }

    /* ===== PRO MOBILE APP BAR ===== */
    .navbar {
        padding: 0.5rem 0;
        background: rgba(255,255,255,0.88);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
    }
    .navbar.scrolled {
        box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    }
    .nav-title {
        font-size: 1rem;
        font-weight: 700;
    }
    .nav-logo {
        width: 38px;
        height: 38px;
    }
    
    /* ===== MOBILE TOP BAR: brand + profile/login ONLY (no hamburger) ===== */
    .mobile-menu-btn {
        display: none !important;
    }
    #navUserSection .btn-outline {
        padding: 0.45rem 0.9rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
    }
    #navUserSection .btn-outline svg {
        width: 14px;
        height: 14px;
    }
    .nav-pdp-btn {
        width: 40px;
        height: 40px;
    }

    /* Fullscreen menu slides UNDER the navbar (navbar stays visible) */
    .nav-links {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        height: 100vh;
        height: 100dvh;
        background: rgba(255,255,255,0.97);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 5.5rem 2rem calc(2rem + 70px);
        gap: 0;
        z-index: 90;
        overflow-y: auto;
    }
    .nav-links.open {
        display: flex;
        animation: fadeIn 0.2s ease;
    }
    .nav-links.open li {
        animation: menuItemIn .35s cubic-bezier(0.16, 1, 0.3, 1) both;
    }
    .nav-links.open li:nth-child(1) { animation-delay: .04s; }
    .nav-links.open li:nth-child(2) { animation-delay: .08s; }
    .nav-links.open li:nth-child(3) { animation-delay: .12s; }
    .nav-links.open li:nth-child(4) { animation-delay: .16s; }
    .nav-links.open li:nth-child(5) { animation-delay: .20s; }
    .nav-links.open li:nth-child(6) { animation-delay: .24s; }
    .nav-links.open li:nth-child(7) { animation-delay: .28s; }
    .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border-light);
    }
    .nav-links li a {
        display: block;
        padding: 1rem 0;
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-dark);
        text-align: right;
        transition: var(--transition);
    }
    .nav-links li a:hover,
    .nav-links li a.active {
        color: var(--green-600);
        padding-right: 0.5rem;
    }
    .nav-links li a.active::after {
        display: none;
    }
    
    /* (hamburger styled above) */

    /* Hero Mobile */
    .hero {
        padding: 2rem 0 1.5rem;
    }
    .hero-inner {
        gap: 1.5rem;
    }
    .hero-text h1 {
        font-size: 1.8rem;
        font-weight: 900;
        line-height: 1.2;
    }
    .hero-text .subtitle {
        font-size: 1.05rem;
    }
    .hero-text .desc {
        font-size: 0.9rem;
        margin-bottom: 1.2rem;
    }
    .hero-emblem img {
        width: 140px;
        height: 140px;
    }
    .hero-btns {
        flex-direction: column;
        align-items: stretch;
    }
    .hero-btns .btn-primary,
    .hero-btns .btn-outline {
        justify-content: center;
        padding: 0.85rem 1.2rem;
    }

    /* Quick Cards Mobile */
    .quick-section {
        padding: 1.5rem 0 1rem;
    }
    .quick-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .q-card {
        padding: 1.2rem 0.8rem;
        border-radius: var(--radius-md);
    }
    .q-icon {
        width: 42px;
        height: 42px;
    }
    .q-card h3 {
        font-size: 0.88rem;
    }
    .q-card p {
        font-size: 0.75rem;
        line-height: 1.35;
    }

    /* Stats Mobile */
    .stats-strip {
        padding: 1.5rem 1rem;
        border-radius: var(--radius-lg);
        margin: 1.5rem 0;
    }
    .stats-strip-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .stat-item .count {
        font-size: 1.8rem;
    }
    .stat-item .label {
        font-size: 0.78rem;
    }

    /* Dual Section Mobile */
    .dual-section {
        padding-bottom: 1.5rem;
    }
    .dual-grid {
        gap: 1rem;
    }
    .panel {
        padding: 1rem 1.25rem;
        border-radius: var(--radius-lg);
    }
    .panel-title span {
        font-size: 1rem;
    }

    /* Activity Cards Mobile */
    .acts-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .act-card {
        flex-direction: row;
        border-radius: var(--radius-md);
    }
    .act-img {
        width: 110px;
        min-width: 110px;
        height: auto;
        min-height: 100px;
    }
    .act-body {
        padding: 0.75rem;
    }
    .act-body h4 {
        font-size: 0.85rem;
    }

    /* Gallery Mobile */
    .gal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .gal-grid .gal-thumb {
        height: 100px;
    }

    /* Newsletter Mobile */
    .nl-bar {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
        margin-bottom: 1rem;
    }
    .nl-info h3 {
        font-size: 0.95rem;
    }
    .nl-info p {
        font-size: 0.78rem;
    }
    .nl-form {
        padding: 0.2rem;
        border-radius: var(--radius-sm);
    }
    .nl-form input {
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }
    .nl-form button {
        padding: 0.55rem 1rem;
        font-size: 0.82rem;
    }

    /* Bottom Info Bar Mobile */
    .bottom-info-bar {
        padding: 1rem;
        border-radius: var(--radius-lg);
        margin-bottom: 1rem;
    }
    .bottom-info-inner {
        flex-direction: column;
        gap: 0.75rem;
    }
    .top-contact {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
    .top-contact-item {
        font-size: 0.8rem;
    }
    .top-social {
        justify-content: center;
    }

    /* FAQ Mobile */
    .faq-question {
        padding: 0.9rem 1rem;
        font-size: 0.9rem;
    }
    .faq-answer {
        padding: 0 1rem 0.9rem;
        font-size: 0.85rem;
    }

    /* Partners Mobile */
    .partners-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .partner-logo {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    /* Footer Mobile */
    .footer {
        padding: 1rem 0;
        font-size: 0.8rem;
        margin-bottom: 0;
    }

    /* Forms Mobile */
    .page-panel {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
        margin-bottom: 1rem;
    }
    .page-title {
        font-size: 1.5rem;
    }
    .form-group {
        margin-bottom: 0.85rem;
    }
    .form-control {
        padding: 0.75rem 0.85rem;
        font-size: 0.9rem;
    }

    /* ===== FIXED MOBILE BOTTOM NAV (always pinned, app-like) ===== */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255,255,255,0.94);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border-light);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        padding: 0.35rem 0.25rem;
        padding-bottom: calc(0.35rem + env(safe-area-inset-bottom));
        z-index: 150;
        min-height: 64px;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        animation: bottomNavIn .35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mobile-bottom-nav a {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.15rem;
        font-size: 0.65rem;
        font-weight: 700;
        color: var(--text-muted);
        text-decoration: none;
        padding: 0.35rem 0.6rem;
        border-radius: 12px;
        transition: color .22s ease, background .22s ease, transform .12s ease;
        min-width: 56px;
        flex: 1;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-bottom-nav a:active {
        transform: scale(0.9);
    }
    .mobile-bottom-nav a.active {
        color: var(--green-700);
        background: transparent;
    }
    .mobile-bottom-nav a.active::after {
        content: '';
        position: absolute;
        bottom: 2px;
        width: 16px;
        height: 3px;
        border-radius: 3px;
        background: var(--green-600);
        animation: fadeIn .25s ease;
    }
    .mobile-bottom-nav a svg {
        width: 22px;
        height: 22px;
        transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1), background .22s ease, color .22s ease, box-shadow .22s ease;
    }
    /* Selected tab icon: solid green gradient tile, white glyph */
    .mobile-bottom-nav a.active svg {
        width: 32px;
        height: 32px;
        padding: 6px;
        border-radius: 12px;
        background: linear-gradient(135deg, #10b981 0%, #047857 100%);
        color: #ffffff;
        box-shadow: 0 4px 12px rgba(5,150,105,0.45);
        transform: translateY(-1px);
    }

    /* Lightbox Mobile */
    .pro-lightbox-box {
        grid-template-columns: 1fr;
        max-height: 94vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .pro-lightbox-img-wrap {
        min-height: 220px;
        max-height: 40vh;
    }
    .pro-lightbox-details {
        padding: 1.25rem;
    }

    /* Modal Mobile */
    .modal-box {
        padding: 1.5rem;
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin-top: auto;
    }

    /* Profile Modal Mobile */
    .profile-modal-card {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin-top: auto;
        max-height: 85vh;
    }

    /* Dashboard Mobile */
    .dash-grid {
        grid-template-columns: 1fr;
    }
    
    /* Admin Mobile */
    .admin-nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }
    .admin-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Toast Mobile */
    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(0.75rem + 64px); /* Above bottom nav */
    }
    .toast {
        min-width: unset;
        width: 100%;
        padding: 0.85rem 1rem;
    }
}

/* Small Mobiles (320px to 374px) */
@media (max-width: 374px) {
    .hero-text h1 {
        font-size: 1.5rem;
    }
    .hero-emblem img {
        width: 120px;
        height: 120px;
    }
    .quick-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .q-card {
        padding: 1rem 0.6rem;
    }
    .stats-strip-grid {
        gap: 0.75rem;
    }
    .stat-item .count {
        font-size: 1.5rem;
    }
    .nl-bar {
        padding: 1rem;
    }
    .mobile-bottom-nav a {
        font-size: 0.6rem;
        min-width: 44px;
    }
    .mobile-bottom-nav a svg {
        width: 20px;
        height: 20px;
    }
}

/* Extra small (320px and below) */
@media (max-width: 320px) {
    .container {
        padding-inline: 0.75rem;
    }
    .hero-text h1 {
        font-size: 1.35rem;
    }
    .quick-grid {
        grid-template-columns: 1fr;
    }
    .stats-strip-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 1rem 0;
    }
    .hero-inner {
        flex-direction: row;
        gap: 1.5rem;
    }
    .hero-emblem img {
        width: 100px;
        height: 100px;
    }
    .mobile-bottom-nav {
        height: 48px;
    }
}

/* Dark mode support (optional, for future) */
@media (prefers-color-scheme: dark) {
    /* Keep light mode - this is a light-themed site */
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .hero-emblem img {
        animation: none;
    }
}

/* Print styles */
@media print {
    .navbar, .mobile-bottom-nav, .mobile-menu-btn, .nl-bar, .bottom-info-bar, .footer {
        display: none !important;
    }
    body {
        padding-bottom: 0;
    }
}
