/* ==========================================
   ENGINUVITY NEXUS TECHNOLOGIES
   Responsive Styles - Mobile First Flexbox
   ========================================== */

/* ==========================================
   Tablet Devices (768px - 1024px)
   ========================================== */
@media screen and (max-width: 1024px) {
    :root {
        --fs-7xl: 3.5rem;
        --fs-6xl: 3rem;
        --fs-5xl: 2.5rem;
        --fs-4xl: 2rem;
        --space-3xl: 4rem;
    }

    .container,
    .container-wide {
        padding: 0 var(--space-lg);
    }

    .hero-title {
        font-size: var(--fs-6xl);
    }

    /* Flexbox card grid for tablets */
    .card-grid {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-md);
    }

    .card-grid>* {
        flex: 1 1 calc(50% - var(--space-md));
        min-width: 250px;
    }

    /* Flexbox footer for tablets */
    .footer-content {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xl);
    }

    .footer-content>* {
        flex: 1 1 calc(50% - var(--space-xl));
        min-width: 200px;
    }

    /* Mobile dropdown handling - JS controls height */
    .dropdown-menu {
        position: static;
        display: flex;
        flex-direction: column;
        height: 0;
        overflow: hidden;
        transition: height 0.4s ease, opacity 0.3s ease;
        opacity: 0;
    }

    .dropdown.active .dropdown-menu {
        opacity: 1;
        /* Height is set by JavaScript */
    }

    /* Rotate dropdown arrow when active */
    .dropdown.active .dropdown-toggle svg {
        transform: rotate(180deg);
        transition: transform 0.3s ease;
    }

    .dropdown-toggle svg {
        transition: transform 0.3s ease;
    }

    /* Hide split layout on tablets */
    .dropdown-menu.split-menu {
        flex-direction: column;
        min-width: 100%;
    }

    .dropdown-preview {
        display: none;
    }

    .dropdown-list {
        border-right: none;
        min-width: 100%;
        padding: 0.5rem 0;
        background: rgba(0, 0, 0, 0.2);
    }

    .dropdown-list a {
        padding: 0.75rem 1.5rem;
        padding-left: 2rem;
        border-left: 3px solid transparent;
        transition: all 0.2s ease;
    }

    .dropdown-list a:hover,
    .dropdown-list a:active {
        background: rgba(0, 217, 255, 0.1);
        border-left-color: var(--color-primary);
        color: var(--color-primary);
        padding-left: 2.25rem;
    }
}

/* ==========================================
   Mobile Devices (< 768px) - FLEXBOX LAYOUT
   ========================================== */
@media screen and (max-width: 768px) {
    :root {
        --fs-7xl: 2.5rem;
        --fs-6xl: 2.25rem;
        --fs-5xl: 2rem;
        --fs-4xl: 1.75rem;
        --fs-3xl: 1.5rem;
        --space-3xl: 3rem;
        --space-2xl: 2.5rem;
    }

    /* ==========================================
       FLEXBOX NAVIGATION
       ========================================== */
    .navbar .container {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
    }

    .navbar-brand {
        flex: 0 0 auto;
        margin-right: 0 !important;
        order: 1;
    }

    .navbar-brand img {
        height: 32px;
    }

    /* Hide desktop navigation actions */
    .navbar-actions {
        display: none !important;
    }

    /* Show hamburger toggle */
    .navbar-toggle {
        display: flex !important;
        flex: 0 0 auto;
        order: 3;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        margin-left: auto;
        cursor: pointer;
        z-index: 1001;
    }

    /* Mobile menu - BOTTOM SHEET STYLE (slides up from bottom) */
    .navbar-menu {
        position: fixed;
        bottom: -100%;
        left: 0;
        width: 100%;
        max-height: 80vh;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: var(--space-md) 0;
        gap: 0;
        transition: bottom 0.3s ease, visibility 0s 0.3s;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px 20px 0 0;
        overflow-y: auto;
        z-index: 1000;
        order: 2;
        visibility: hidden;
        opacity: 0;
    }

    .navbar-menu.active {
        bottom: 0;
        visibility: visible;
        opacity: 1;
        transition: bottom 0.3s ease, opacity 0.3s ease, visibility 0s;
    }

    /* Mobile menu items - TIGHT SPACING when collapsed */
    .navbar-menu>li {
        display: flex;
        flex-direction: column;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        margin: 0;
    }

    .navbar-menu>li>a {
        padding: 0.75rem var(--space-lg);
        font-size: 1rem;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Make dropdown arrows larger and more visible on mobile */
    .navbar-menu .dropdown-toggle svg {
        width: 16px;
        height: 16px;
        min-width: 16px;
        opacity: 0.8;
    }

    /* MORE SPACING when dropdown is active/open */
    .navbar-menu>li.dropdown.active {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .navbar-menu>li.dropdown.active>a {
        padding: 1rem var(--space-lg);
        font-weight: 500;
    }

    /* Dropdown on mobile - HIDDEN BY DEFAULT */
    .dropdown {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* Hide ALL dropdown menus by default on mobile */
    .navbar-menu .dropdown-menu,
    .navbar-menu .dropdown-menu.split-menu,
    .navbar-menu .dropdown .dropdown-menu {
        position: static !important;
        width: 100%;
        background: rgba(0, 0, 0, 0.5);
        border: none;
        border-radius: 0;
        box-shadow: none;
        display: flex !important;
        flex-direction: column;
        height: 0;
        overflow: hidden;
        opacity: 0;
        transition: height 0.4s ease, opacity 0.3s ease;
    }

    /* Show dropdown ONLY when parent has .active class */
    .navbar-menu .dropdown.active .dropdown-menu,
    .navbar-menu .dropdown.active .dropdown-menu.split-menu {
        opacity: 1;
        /* Height is set by JavaScript */
    }

    /* Rotate dropdown arrow on mobile */
    .navbar-menu .dropdown.active .dropdown-toggle svg {
        transform: rotate(180deg);
    }

    .navbar-menu .dropdown-toggle svg {
        display: inline-block;
        transition: transform 0.3s ease;
    }

    .dropdown-menu.split-menu {
        min-width: 100%;
        padding: 0;
    }

    .dropdown-list {
        border-right: none;
        border-bottom: none;
        padding: 0.5rem 0;
        width: 100%;
        min-width: 100%;
        background: rgba(0, 0, 0, 0.3);
        margin-top: 0.5rem;
    }

    .dropdown-list a {
        padding: 0.75rem var(--space-xl);
        padding-left: calc(var(--space-xl) + 1rem);
        font-size: 0.9rem;
        color: var(--color-text-secondary);
        display: block;
        border-left: 3px solid transparent;
        transition: all 0.2s ease;
    }

    .dropdown-list a:hover,
    .dropdown-list a:active {
        background: rgba(0, 217, 255, 0.1);
        border-left-color: var(--color-primary);
        color: var(--color-primary);
        padding-left: calc(var(--space-xl) + 1.25rem);
    }

    .dropdown-preview {
        display: none !important;
    }

    /* ==========================================
       FLEXBOX HERO SECTION
       ========================================== */
    .hero {
        min-height: 100vh;
        padding-top: 80px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .hero .container {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: var(--space-lg);
    }

    .hero-title {
        font-size: var(--fs-5xl);
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: var(--fs-lg);
    }

    .hero-cta {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
        width: 100%;
        align-items: center;
    }

    .hero-cta .btn {
        width: 100%;
        max-width: 300px;
    }

    /* ==========================================
       FLEXBOX SECTIONS
       ========================================== */
    section {
        padding: var(--space-2xl) 0;
        display: flex;
        flex-direction: column;
    }

    .section-title {
        font-size: var(--fs-4xl);
    }

    .section-subtitle {
        font-size: var(--fs-base);
    }

    /* ==========================================
       FLEXBOX CARDS
       ========================================== */
    .card-grid {
        display: flex;
        flex-direction: column;
        gap: var(--space-md);
    }

    .card {
        padding: var(--space-lg);
        flex: 1 1 100%;
    }

    .card-icon {
        width: 56px;
        height: 56px;
        font-size: var(--fs-2xl);
    }

    /* ==========================================
       FLEXBOX FOOTER
       ========================================== */
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: var(--space-lg);
    }

    .footer-section {
        flex: 1 1 100%;
    }

    /* Forms */
    .btn-large {
        padding: var(--space-sm) var(--space-lg);
        font-size: var(--fs-base);
    }
}

/* ==========================================
   Small Mobile Devices (< 480px)
   ========================================== */
@media screen and (max-width: 480px) {
    :root {
        --fs-7xl: 2rem;
        --fs-6xl: 1.875rem;
        --fs-5xl: 1.75rem;
        --fs-4xl: 1.5rem;
        --space-xl: 2rem;
    }

    .container,
    .container-wide {
        padding: 0 var(--space-sm);
    }

    .hero-title {
        font-size: var(--fs-4xl);
    }

    .hero-subtitle {
        font-size: var(--fs-base);
    }

    .navbar-brand img {
        height: 28px;
    }

    .card {
        padding: var(--space-md);
    }

    .section-header {
        margin-bottom: var(--space-xl);
    }

    .navbar-menu>li>a {
        padding: 0.875rem var(--space-md);
        font-size: 1rem;
    }

    .dropdown-list a {
        padding: 0.625rem var(--space-lg);
        font-size: 0.9rem;
    }
}

/* ==========================================
   Landscape Orientation
   ========================================== */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--space-2xl) 0;
    }

    .hero-title {
        font-size: var(--fs-4xl);
    }

    .navbar-menu {
        height: calc(100vh - 80px);
    }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {

    .navbar,
    .navbar-toggle,
    .hero-cta,
    .btn {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .hero-background {
        display: none;
    }
}