/* ==========================================================================
   AQUEOUS ENTERPRISE - app.css (DROP-IN REPLACEMENT)
   - Header: fixed with centered logo
   - Drawer: toggle from top-left
   - Nav: no hover/active highlighting (per request)
   ========================================================================== */

/* ===================================================================
   1) GLOBAL RESETS & TYPOGRAPHY
   =================================================================== */

@font-face {
    font-family: 'PitagonLight';
    src: url('/_content/AqueousEnterprise.Shared/Fonts/PitagonSansText-Light.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TravelNovember';
    src: url('/_content/AqueousEnterprise.Shared/Fonts/Travel November.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --ae-page-pad: clamp(20px, 2.5vw, 20px);
    --ae-top-offset: 72px;
}

html, body {
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

    body.ae-has-modal {
        overflow: hidden;
    }

/* Global font settings */
html, body, input, button, select, textarea,
h1, h2, h3, h4, h5, h6,
.navbar-brand, .nav-item, .nav-link,
.table, .form-control, .form-select, .btn,
.modal-title, .modal-body, .modal-footer {
    font-family: 'PitagonLight', Arial, sans-serif !important;
    font-size: 0.85rem !important;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: normal;
    margin-top: 0;
}

/* ===================================================================
   2) MAIN LAYOUT SHELL
   =================================================================== */

.ae-shell {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ae-content {
    position: relative;
    z-index: 100;
    flex: 1 1 auto;
    min-width: 0;
    padding-top: var(--ae-top-offset) !important; /* content flows below fixed header */
}

/* ===================================================================
   3) PUBLIC/DYNAMIC BACKGROUND SYSTEMS
   =================================================================== */

.ae-dyn-bg {
    width: 100%;
    min-height: calc(100vh - var(--ae-top-offset));
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    display: flex;
    box-sizing: border-box;
    padding: var(--ae-page-pad);
}

.ae-dyn-wrapper {
    margin: 0 auto;
    padding: 10px;
}

.ae-dyn-box {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - var(--ae-top-offset) - (var(--ae-page-pad) * 2));
    border-radius: 16px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 6px 22px rgba(0,0,0,0.06);
    border: 0 solid rgba(0,0,0,0.07);
    backdrop-filter: blur(2px);
    margin: 1px;
    overflow: auto;
}

    .ae-dyn-box h1,
    .ae-dyn-box h2,
    .ae-dyn-box h3 {
        margin-top: 0;
    }

/* Public (home/landing) background */
.ae-pub-bg {
    width: 100%;
    min-height: calc(100vh - var(--ae-top-offset));
    background-repeat: repeat;
    display: flex;
}

.ae-pub-wrapper {
    max-width: 100%;
    padding: 0;
}

.ae-pub-box {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - var(--ae-top-offset) - (var(--ae-page-pad) * 2));
    border-radius: 0;
    padding: 0;
    background-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 6px 22px rgba(0,0,0,0.06);
    border: 0 solid rgba(0,0,0,0.07);
    backdrop-filter: blur(2px);
    overflow: auto;
}

    .ae-pub-box h1,
    .ae-pub-box h2,
    .ae-pub-box h3 {
        margin: 0;
    }

/* ===================================================================
   4) FIXED HEADER + DRAWER NAV (NEW SYSTEM)
   =================================================================== */

.ae-app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ae-top-offset);
    z-index: 1050;
    display: grid;
    grid-template-columns: 66px 1fr auto;
    align-items: center;
    padding: 0 12px;
    /* Frosted header */
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(0,0,0,.10);
}

/* Toggle button: icon + MENU label under it */
.ae-nav-toggle {
    width: 56px;
    height: 56px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid rgba(0,0,0,.18);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
}

    .ae-nav-toggle::after {
        content: "MENU";
        font-size: 10px;
        letter-spacing: .16em;
        font-weight: 700;
        line-height: 1;
        color: #000a28;
        margin-top: 2px;
    }

/* Center logo that never explodes */
.ae-header-logo {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--ae-top-offset);
    text-decoration: none;
}

.ae-header-logo-img {
    height: 48px !important;
    max-height: 48px !important;
    width: auto !important;
    max-width: min(520px, 70vw) !important;
    object-fit: contain;
    display: block;
}

/* Right side actions */
.ae-header-right {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Drawer overlay */
.ae-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0,0,0,.35);
}

/* Drawer panel */
.ae-drawer {
    position: fixed;
    top: var(--ae-top-offset);
    left: 0;
    height: calc(100vh - var(--ae-top-offset));
    width: 320px;
    max-width: 86vw;
    z-index: 1045;
    background: #fff;
    border-right: 1px solid rgba(0,0,0,.10);
    transform: translateX(-105%);
    transition: transform .18s ease;
    overflow: auto;
}

    .ae-drawer.is-open {
        transform: translateX(0);
    }

.ae-drawer-inner {
    padding: 10px;
}

/* ===================================================================
   5) NAV MENU STYLES (DRAWER)
   - Remove selected + hover highlighting (per request)
   =================================================================== */

.ae-nav.ae-drawer-nav {
    display: block;
    background: transparent;
    padding: 0;
    margin: 0;
}

/* Force vertical stack */
.ae-drawer-nav ul,
.ae-drawer-nav .ae-bar {
    list-style: none;
    margin: 0 !important;
    padding: 0 !important;
}

.ae-drawer-nav .ae-bar {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px;
}

/* Links/buttons: no hover / no active highlight */
.ae-drawer-nav .ae-link,
.ae-drawer-nav .ae-button,
.ae-drawer-nav .nav-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none !important;
    color: #000a28 !important;
    border: 1px solid transparent;
    background: transparent !important;
    transform: none !important;
    transition: none !important;
}

    /* Kill mouse-over highlighting */
    .ae-drawer-nav .ae-link:hover,
    .ae-drawer-nav .ae-button:hover,
    .ae-drawer-nav .nav-link:hover {
        background: transparent !important;
        border-color: transparent !important;
        color: #000a28 !important;
        transform: none !important;
        text-decoration: none !important;
    }

    /* Kill active/selected highlighting */
    .ae-drawer-nav .ae-link.active,
    .ae-drawer-nav .nav-link.active,
    .ae-drawer-nav a.active {
        background: transparent !important;
        box-shadow: none !important;
        color: #000a28 !important;
        border-color: transparent !important;
    }

/* Dropdown container */
.ae-has-menu {
    position: relative;
}

/* Dropdown toggle button */
.ae-button {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    justify-content: space-between;
    font-size: 0.85rem;
}

/* Drawer submenus: accordion (exists in DOM, collapses via max-height) */
.ae-drawer-nav .ae-menu {
    position: static;
    display: block; /* keep in DOM so JS can inspect children */
    max-height: 0; /* collapsed */
    overflow: hidden;
    margin: 6px 0 0 0 !important;
    padding: 0 !important;
    border-top: 1px solid rgba(0,0,0,.06);
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    min-width: 0;
}

/* Expanded */
.ae-drawer-nav .ae-has-menu.is-open > .ae-menu {
    max-height: 1200px; /* big enough for any submenu */
    padding-top: 6px !important;
}

/* Optional indentation for submenu items */
.ae-drawer-nav .ae-menu .ae-link,
.ae-drawer-nav .ae-menu .ae-button,
.ae-drawer-nav .ae-menu .nav-link {
    padding-left: 22px;
}


.ae-drawer-nav .ae-menu-item {
    margin-top: 6px;
}

/* Keep caret rotation only (visual cue is OK even with no highlight) */
.ae-caret {
    font-size: 0.8em;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.ae-button[aria-expanded="true"] .ae-caret {
    transform: rotate(180deg);
}

/* Focus sink used to clear focus-within */
.ae-focus-sink {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    outline: none;
}

/* Mobile tweaks */
@media (max-width: 576px) {
    :root {
        --ae-top-offset: 64px;
    }

    .ae-nav-toggle {
        width: 52px;
        height: 52px;
    }

    .ae-header-logo-img {
        height: 40px !important;
        max-height: 40px !important;
        max-width: 62vw !important;
    }
}

/* ===================================================================
   6) MODALS & OVERLAYS
   =================================================================== */

.modal {
    z-index: 2000 !important;
}

.modal-backdrop {
    z-index: 1990 !important;
}

.modal-dialog {
    max-width: 900px;
    width: 90vw;
}

    .modal-dialog.modal-xl {
        max-width: 1100px;
        width: 95vw;
    }

.ae-modal-top {
    position: fixed !important;
    inset: 0 !important;
    z-index: 75000 !important;
    background: rgba(0,0,0,.45);
    padding: 14px 14px 6px 14px;
}

    .ae-modal-top.modal-dialog {
        margin: 0.75rem auto;
        max-width: 98vw;
    }

/* Location modal */
.ae-loc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 2147483000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5vh 1rem;
}

.ae-loc-card {
    width: min(95vw, 900px);
    height: 75vh;
    background: #fff;
    color: #212529;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ae-loc-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,.1);
}

.ae-loc-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* Chat UI */
.ae-chat-launcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.ae-chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ae-chat-modal {
    width: min(900px, 100%);
    max-height: 80vh;
    background: #151515;
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ae-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #212529;
    color: #fff;
}

.ae-chat-body {
    background: #fff;
    color: #212529;
    padding: 0.5rem;
    overflow: auto;
    max-height: calc(80vh - 3rem);
}

/* ===================================================================
   7) APP-SPECIFIC COMPONENTS (KEEP EXISTING BEHAVIOR)
   =================================================================== */

.list-group-item.active,
.invoice-list .list-group-item.active,
.invoice-list .list-group-item.active:focus,
.invoice-list .list-group-item.active:hover {
    background-color: #a7ccf8;
    border-color: #0d6efd;
    color: darkslategray;
}

    .invoice-list .list-group-item.active .text-muted,
    .invoice-list .list-group-item.active small,
    .invoice-list .list-group-item.active strong,
    .invoice-list .list-group-item.active div,
    .invoice-list .list-group-item.active span {
        color: #e9ecef !important;
        opacity: 1;
    }

    .invoice-list .list-group-item.active .badge {
        background-color: rgba(233, 236, 239, 0.18);
        color: #e9ecef;
        border: 1px solid rgba(233, 236, 239, 0.28);
    }

.invoice-totals {
    font-weight: 700;
    color: #c1121f;
    font-size: 1.25rem;
    letter-spacing: 0.2px;
}

.alert-info {
    background-color: #eef5ff;
    border-color: #cfe2ff;
    color: #084298;
}

/* Dynamic HTML preview */
.dyn-html-preview {
    white-space: normal;
}

    .dyn-html-preview table {
        width: 100%;
        border-collapse: collapse;
    }

    .dyn-html-preview th,
    .dyn-html-preview td {
        border: 1px solid #cbd5e1;
        padding: 4px;
    }

/* Search wrapper */
.search-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
}

    .search-wrapper .input-group {
        width: 100%;
        max-width: 100%;
    }

/* Cart steps (keep as-is) */
.cart-steps {
    display: flex;
    flex-wrap: nowrap;
    margin-bottom: 0;
}

    .cart-steps .nav-item {
        margin-right: 0.25rem;
        padding: 0;
    }

    .cart-steps .nav-link {
        font-size: 0.8rem;
        padding: 0.25rem 0.75rem;
        line-height: 1.25;
        border-radius: 0.25rem 0.25rem 0 0;
        background-color: rgba(0, 0, 0, 0.45);
        color: #f8f9fa;
        border: 1px solid rgba(255, 255, 255, 0.45);
        margin-bottom: 0;
    }

        .cart-steps .nav-link.active {
            background-color: #0d6efd;
            border-color: #0d6efd;
            color: #ffffff;
        }

        .cart-steps .nav-link:disabled {
            opacity: 0.55;
            cursor: default;
        }

/* Product center cards */
.ae-prod-list {
    margin-top: 0.5rem;
}

.ae-prod-center-card {
    display: flex;
    flex-direction: column;
}

.ae-prod-center-img {
    flex: 0 0 30%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .ae-prod-center-img img {
        width: 60%;
        max-width: 60%;
        height: auto;
        object-fit: contain;
    }

.ae-prod-center-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.ae-prod-item,
.ae-prod-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.06);
    background: rgba(0,0,0,.02);
    margin-bottom: 0.5rem;
}

.ae-prod-footer {
    background: rgba(11, 20, 36, 0.98);
    color: antiquewhite;
}

.ae-sku {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    opacity: 0.8;
}

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }
