/* =========================================================
   TrasTec Portal (cookie-only)
   Structured, deduplicated, and organized stylesheet
   ========================================================= */

/* ---------------------- */
/* 1) THEME & TOKENS      */
/* ---------------------- */
:root {
    /* palette */
    --bg: #0b1220;
    --ink: #e5e7eb;
    --muted: #94a3b8;
    --edge: #1c273a;
    --bd: #243044;
    --accent: #38bdf8;
    /* primary blue */
    --danger: #ef4444;
    --ok: #22c55e;

    /* effects */
    --radii: 14px;
    --shadow: 0 10px 28px rgba(2, 8, 23, .35);
    --focus: 0 0 0 2px #0ea5e9, 0 0 0 4px rgba(56, 189, 248, .25);

    /* layout */
    --hero-h: 180px;

    /* stage background image */
    --stage-img: url("/ui-common/img/hero-coldchain.png");
    --stage-bright: 0.85;
    /* darker for contrast */
    --stage-zoom: 1;
}

/* ---------------------- */
/* 2) RESET / BASE        */
/* ---------------------- */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Utilities */
.hidden {
    display: none !important;
}

.mt8 {
    margin-top: 8px;
}

.mt12 {
    margin-top: 12px;
}

.m0 {
    margin: 0;
}

/* ---------------------- */
/* 3) HERO (TOP SECTION)  */
/* ---------------------- */
.hero {
    height: var(--hero-h);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--edge);
    background:
        radial-gradient(900px 500px at -10% -60%, rgba(56, 189, 248, .18), transparent 40%),
        linear-gradient(180deg, #0b1426 0%, #0a1322 100%);
}

.hero-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: contain;
    background: #0a1424;
    border: 1px solid rgba(88, 114, 160, .35);
    box-shadow: 0 0 0 5px rgba(56, 189, 248, .12), 0 18px 44px rgba(56, 189, 248, .15);
}

.hero h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: .2px;
}

.tagline {
    margin: 4px 0 0;
    color: #c7d6ef;
    max-width: 70ch;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.badge {
    font-size: 12px;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #2a3a56;
    color: #9fc3ff;
    background: linear-gradient(180deg, #0f1f3a, #0c182e);
}

/* Fixed Logout button (appears after sign-in) */
.logout-fixed {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 1000;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* ---------------------- */
/* 4) STAGE (MAIN AREA)   */
/* ---------------------- */
.stage {
    position: relative;
    isolation: isolate;
    min-height: calc(100dvh - var(--hero-h) - 90px);
    /* leave room for footer */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    border-bottom: 1px solid #162338;
    background: transparent;
}

.stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--stage-img) center / cover no-repeat;
    transform: scale(var(--stage-zoom));
    filter: brightness(var(--stage-bright)) contrast(1.06) saturate(1.06);
}

.stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(9, 14, 24, .45);
}

/* ---------------------- */
/* 5) CARDS & TOPBAR      */
/* ---------------------- */
.card {
    width: 100%;
    max-width: 920px;
    background: rgba(14, 24, 40, .28);
    border: 1px solid rgba(36, 48, 68, .45);
    border-radius: var(--radii);
    padding: 18px;
    backdrop-filter: blur(8px) saturate(1.02);
    -webkit-backdrop-filter: blur(8px) saturate(1.02);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 8px 0 14px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.who {
    font-weight: 800;
}

/* ---------------------- */
/* 6) FORMS               */
/* ---------------------- */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin: 6px 0;
}

input {
    width: 100%;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid #2b3a53;
    background: #081324;
    color: var(--ink);
    outline: none;
}

input:focus {
    box-shadow: var(--focus);
    border-color: #0ea5e9;
}

/* ---------------------- */
/* 7) BUTTONS             */
/* ---------------------- */
.btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.btn.primary {
    background: linear-gradient(180deg, var(--accent), #0ea5e9);
    color: #00121a;
    box-shadow: var(--shadow);
}

.btn.ghost {
    background: #0b1426;
    color: var(--ink);
    border: 1px solid #233149;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Login button: same blue, centered & larger */
.login-actions {
    display: flex;
    justify-content: center;
}

#btnLogin {
    min-width: 200px;
    padding: 12px 18px;
}

/* ---------------------- */
/* 8) HOME TILES          */
/* ---------------------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

a.tile {
    display: block;
    text-decoration: none;
    color: inherit;
    background: rgba(14, 24, 40, .24);
    border: 1px solid rgba(36, 48, 68, .45);
    border-radius: var(--radii);
    padding: 14px;
    position: relative;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    backdrop-filter: blur(6px);
}

a.tile h3 {
    margin: 6px 0 6px;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: .2px;
}

a.tile:hover {
    transform: translateY(-2px);
    border-color: #2f415e;
    box-shadow: 0 12px 28px rgba(2, 8, 23, .35);
}

.pill {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #0f1b30;
    border: 1px solid #26344b;
    color: #9fb0c8;
    font-weight: 800;
}

.pill.ok {
    background: rgba(34, 197, 94, .12);
    border-color: rgba(34, 197, 94, .35);
    color: #86efac;
}

.pill.warn {
    background: rgba(56, 189, 248, .10);
    border-color: rgba(56, 189, 248, .35);
    color: #7dd3fc;
}

/* ---------------------- */
/* 9) MISC                */
/* ---------------------- */
.error {
    color: var(--danger);
    margin-top: 8px;
    font-weight: 700;
}

/* used only after sign-in; hide when empty */
.wrap:empty {
    display: none !important;
}

/* ---------------------- */
/* 10) FOOTER             */
/* ---------------------- */
.footer {
    background: #081020;
    color: #9fb3d0;
    text-align: center;
    padding: 18px 10px;
    font-size: 14px;
    border-top: 1px solid #1c2c44;
    letter-spacing: 0.3px;
    margin-top: auto;
    /* pushes footer down */
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin: 0 6px;
}

.footer a:hover {
    text-decoration: underline;
}

/* ---------------------- */
/* 11) RESPONSIVE         */
/* ---------------------- */
@media (max-width: 740px) {
    :root {
        --hero-h: 150px;
    }

    .logo {
        width: 56px;
        height: 56px;
    }

    .hero h1 {
        font-size: 22px;
    }

    .tagline {
        font-size: 14px;
    }

    .row {
        grid-template-columns: 1fr;
    }

    .stage {
        min-height: calc(100dvh - var(--hero-h) - 110px);
    }

    .logout-fixed {
        top: 10px;
        right: 10px;
        padding: 9px 14px;
    }
}

@media (max-width: 480px) {
    #btnLogin {
        min-width: 180px;
    }
}

/* ===== Portal Login Card (scoped) ===== */

/* Card sizing/spacing */
.login-card {
    width: 100%;
    max-width: 720px;
    /* card max width */
    padding: 22px 22px;
}

/* Title */
.login-card h2 {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .2px;
}

/* Form grid */
.login-form .fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

/* Labels/inputs inside the card only */
.login-card .fld {
    display: block;
}

.login-card .fld>span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin: 6px 0;
}

.login-card input {
    width: 100%;
    height: 44px;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid #2b3a53;
    background: #081324;
    color: var(--ink);
    outline: none;
}

.login-card input:focus {
    box-shadow: var(--focus);
    border-color: #0ea5e9;
}

/* Actions row – center the button fully */
.login-form .actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Big blue button – same look as header logout */
.btn.primary.xl {
    min-width: 280px;
    width: clamp(280px, 40vw, 360px);
    min-height: 48px;
    padding: 14px 22px;
    border-radius: 14px;
    border: 0;
    background: linear-gradient(180deg, var(--accent), #0ea5e9);
    color: #00121a;
    font-weight: 900;
    font-size: 17px;
    line-height: 1;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .12s ease;
}

.btn.primary.xl:hover {
    transform: translateY(-1px);
}

/* Error message spacing */
.login-card .error {
    margin-top: 10px;
}

/* Responsive: stack fields on small screens */
@media (max-width: 740px) {
    .login-form .fields {
        grid-template-columns: 1fr;
    }
}