/* ================= MOBILE STYLES ================= */
/* Applied only on screens 1170px and below */

@media screen and (max-width: 1170px) {
    /* ================= BASE LAYOUT ================= */
    html, body {
        overflow-x: hidden;
        height: 100%;
        margin: 0;
    }
    
    body {
        font-size: 14px;
        display: flex;
        flex-direction: column;
    }
    
    .outer-container {
        width: 95%;
        padding-top: 100px;
        flex: 1;
    }
    
    /* ================= HEADER ================= */
    .site-header {
        height: 90px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .logo {
        height: 250px;
        flex-shrink: 0;
        padding-left: 0.5rem;
    }
    
    .logo img {
        height: 100%;
        width: auto;
        object-fit: contain;
    }
    
    /* ================= MOBILE NAVBAR ================= */
    .navbar {
        justify-content: flex-end;
    }
    
    .menu-icon-container {
        display: flex !important;
        align-items: center;
        gap: 0.15rem;
        padding-right: 0.125rem;
    }
    
    .menu-toggle {
        display: block !important;
        font-size: 1.75rem;
        cursor: pointer;
        color: #0D1B2A;
        padding: 0.25rem 0.35rem;
        border-radius: 4px;
        transition: all 0.3s ease;
        background: none;
        border: none;
    }
    
    .menu-toggle:hover {
        background-color: #415A77;
        color: white;
    }
    
    .menu-toggle.active {
        background-color: #415A77;
        color: white;
    }

    .header-back-button {
        display: block !important;
        font-size: 1.75rem;
        padding: 0.2rem 0.4rem;
        background-color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        color: #0D1B2A;
        transition: all 0.3s ease;
    }
    
    .header-back-button:hover {
        background-color: #415A77;
        color: white;
    }
    
    /* Mobile Navigation Menu */
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        /* height: 10vh; */
        background-color: #415A77;
        flex-direction: column;
        padding: 2.8rem 1rem 2rem;
        gap: 0;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        overflow-y: auto;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
    
    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }
    
    /* Mobile Nav Links */
    .nav-button {
        color: white;
        font-size: 1.1rem;
        padding: 1rem 1.5rem;
        width: 100%;
        text-align: left;
        border-radius: 0;
        background: transparent;
    }
    
    .nav-button:hover,
    .nav-button:active {
        background-color: #0D1B2A;
        color: white;
    }
    
    /* Donate button on mobile */
    .nav-button-donate {
        color: white;
        font-size: 1.1rem;
        padding: 1rem 1.5rem;
        width: 100%;
        text-align: left;
        border-radius: 0;
        background: transparent;
        border: none;
        margin: 0;
    }
    
    .nav-button-donate:hover {
        background-color: #0D1B2A;
        color: white;
    }
    
    /* BYSO button on mobile */
    .nav-button-byso {
        background: transparent;
        border: none;
        cursor: grab;
    }
    
    /* Overlay when menu is open */

    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* ================= WELCOME SECTION ================= */
    .welcome-section {
        flex-direction: column;
        padding: 0;
        gap: 1rem;
    }
    
    .refresh-image,
    .week-schedule {
        max-height: none;
        flex: none;
    }
    
    .carousel {
        padding-top: 15px;
        height: 280px; /* Fixed mobile carousel height */
    }
    
    .carousel img {
        height: 100%;
        object-fit: cover;
    }
    
    /* ================= SCHEDULE SECTION ================= */
    .week-schedule {
        padding: 1.5rem 1rem;
        display: flex;
        flex-direction: column;
    }
    
    .week-schedule h2 {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .schedule-details {
        flex: none;
    }
    
    .schedule-details p {
        font-size: 1.1rem;
        margin: 0.25rem 0;
    }
    
    .schedule-buttons {
        margin-top: 1.5rem;
        order: 99;
    }
    
    /* ================= FOOTER ================= */
    .footer {
        padding: 1.5rem 1rem;
    }
    
    .footer p {
        font-size: 0.85rem;
    }
    
    /* ================= PAGE SECTIONS ================= */
    .about-box,
    .visitors,
    .community,
    .info,
    .events,
    .halachos,
    .shabbos,
    .subscribe-form {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }
    
    .about-box h2,
    .visitors h2,
    .community h2,
    .info h2,
    .events h2,
    .halachos h2,
    .shabbos h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    /* ================= BUTTON LISTS ================= */
    .visitors-buttons ul,
    .community-buttons ul,
    .info-buttons ul,
    .info-Divrei-buttons ul,
    .halachos ul,
    .shabbos-Divrei-buttons ul {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .link-style,
    .nav-button-events,
    .nav-button-comm {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    /* ================= GOOGLE MAP ================= */
    iframe[src*="google.com/maps"] {
        width: 100%;
        height: 300px;
    }
    
    /* ================= FORM STYLES ================= */
    .subscribe-form {
        padding: 1.5rem;
    }
    
    .subscribe-form h2 {
        font-size: 1.3rem;
    }
    
    .ctct-form-field {
        margin-bottom: 0.75rem;
    }
    
    .ctct-form-element {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .ctct-form-button {
        padding: 14px;
    }
    
    /* ================= SPINNER ================= */
    #spinner {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    /* ================= SEPARATOR SECTIONS ================= */
    .separate,
    .separate-index,
    .separate-community,
    .separate-info,
    .separate-events,
    .separate-Divrei,
    .separate-halachos,
    .separate-subscribe {
        padding: 1rem;
    }
    
    .separate-subscribe {
        margin-bottom: 0;
    }
    
    /* ================= COLLAPSIBLE ================= */
    .collapsible {
        padding: 14px 18px;
        font-size: 1rem;
    }
    
    .content {
        padding: 1rem;
    }
}

/* ================= EXTRA SMALL SCREENS ================= */
@media screen and (max-width: 1170px) {
    .logo {
        height: 200px;
        padding-left: 0.4rem;
    }
    
    .logo img {
        height: 100%;
    }
    
    .menu-icon-container {
        gap: 0.1rem;
        padding-right: 0.1rem;
    }
    
    .menu-icon {
        font-size: 1.3rem;
        padding: 0.2rem 0.3rem;
    }
    
    .nav-menu {
        width: 100%;
        padding-top: 2.5rem;
    }
    
    .carousel {
        height: 200px;
    }
    
    .carousel-btn {
        font-size: 1.2rem;
        padding: 0.3rem 0.6rem;
    }
    
    .week-schedule h2 {
        font-size: 1.2rem;
    }

    .staff-photo-rav {
        width: 140px;   /* match others */
        height: 180px;
        padding: 6px;   /* smaller padding for mobile */
        border-radius: 12px;
    }

    .staff-photo-rav img {
        border-radius: 8px;
    }

    .staff-card-rav {
        order: -1; /* 👈 this is the magic */
    }
}

/* ================= EDUCATION DROPDOWN MOBILE ================= */
@media screen and (max-width: 1170px) {
    ul.dropdown-education {
        position: static;
        max-height: none;
        opacity: 1;
        background-color: transparent !important;
        box-shadow: none;
        padding: 0;
        margin: 0;
        display: none;
    }
    
    ul.dropdown-education.show {
        display: block;
        max-height: none;
    }
    
    li.nav-item.dropdown.open > ul.dropdown-education {
        display: block;
    }
    
    ul.dropdown-education li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    ul.dropdown-education li a.nav-button {
        padding-left: 2rem;
        font-size: 1rem;
        color: #ffffff !important;
    }
    
    /* ================= Divrei TORAH PAGE MOBILE ================= */
    .Divrei-list {
        grid-template-columns: 1fr;
    }
    
    .Divrei-list .link-style {
        padding: 1.25rem 1rem;
    }
    
    .audio-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .audio-card .collapsible {
        font-size: 0.95rem;
        padding: 0.4rem 0;
    }
    
    .audio-card .spotify-embed iframe,
    .audio-card .share-embed iframe {
        height: 140px;
    }
    
    /* ================= STAFF PAGE MOBILE ================= */
    .staff-container {
        gap: 1.5rem;
        margin-top: 1.5rem;
    }
    
    .staff-card {
        flex-direction: column;
        align-items: center;
        padding: 1.25rem;
        gap: 1rem;
        width: 240px;
    }

    .staff-card-rav {
        flex-direction: column;
        align-items: center;
        padding: 1.25rem;
        gap: 1rem;
        width: 240px;
    }
    
    .staff-left {
        width: 100%;
    }
    
    .staff-photo {
        width: 140px;
        height: 180px;
        object-fit: contain;
        background-color: #f8f9fa;
    }
    
    .staff-name {
        margin-top: 0.75rem;
    }
    
    .staff-name h3 {
        font-size: 1.15rem;
    }
    
    .staff-title {
        font-size: 0.85rem;
    }
    
    .staff-bio {
        text-align: center;
        width: 100%;
    }
    
    .staff-bio p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}
