@import url("/static/css/header_top.css");

/* ===========================
   Global Variables
   =========================== */
:root {
    --color-primary: #082346;
    --color-primary-soft: #f3f7fc;
    --color-accent: #cfdaea;
    --color-light: #edf2f8;
    --color-highlight: #dce8f6;
    --color-admin-mode: #e6edfa;
    --color-admin-user: #edebb2;
    --color-dark-bg: #222;
    --color-link: #0d3f73;
    --color-hover-link-text: #072746;
    --color-text: #101d30;
    --color-focus: #d06d00;
    --color-filter-active: #c35f00;
    --color-filter-active-hover: #974700;
    --color-on-dark: #fff;
    --color-surface: rgba(255, 255, 255, 0.94);
    --color-surface-alt: #f8fbff;
    --color-border: rgba(24, 42, 64, 0.12);
    --color-border-strong: rgba(24, 42, 64, 0.2);
    --color-muted: #5c6d80;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    --space-1: 0.35rem;
    --space-2: 0.55rem;
    --space-3: 0.8rem;
    --space-4: 1rem;
    --space-5: 1.25rem;

    --text-xs: 0.78rem;
    --text-sm: 0.92rem;
    --text-md: 1rem;
    --text-lg: 1.18rem;
    --text-xl: clamp(1.5rem, 3vw, 2.3rem);

    --control-height: 44px;
    --transition-speed: 0.2s;

    --font-main: Arial, Helvetica, sans-serif;
    --top-chrome-height: 188px;
}

/* ===========================
   Reset / Base
   =========================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 350px;
    overflow-x: hidden;
    word-wrap: break-word;
    color: var(--color-text);
    background: #fff;
    line-height: 1.45;
}

/* Conservative transitions */
a,
button,
.navitem,
.tile {
    transition:
        background-color var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

/* ===========================
   Layout
   =========================== */
section {
    flex: 1;
    display: flex;
    flex-direction: row;
}

/* ===========================
   USSP Logo Sizes
   =========================== */
.ussplogo {
    display: inline-block;
    width: 120px;
    height: 120px;
    background-image: url("/static/img/ussplogo.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    text-indent: -9999px;
    overflow: hidden;
    transform: scale(1);
    transform-origin: center center;
    transition: transform 0.18s ease;
}

.ussplogo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 0;
}

.ussplogo-link:hover .ussplogo,
.ussplogo-link:focus-visible .ussplogo {
    transform: scale(1.08);
}

.ussplogo-large {
    width: 140px;
    height: 140px;
}

.ussplogo-medium {
    width: 110px;
    height: 110px;
}

.ussplogo-small {
    width: 80px;
    height: 80px;
}

/* ===========================
   Links
   =========================== */
a {
    color: var(--color-link);
}

a:visited {
    color: var(--color-link);
}

a:hover {
    color: var(--color-hover-link-text);
}

a:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* ===========================
   Header Banner (NOT headertop)
   =========================== */
header {
    background-color: #666;
    color: white;
}

.site-top-chrome {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
}

.site-top-spacer {
    height: var(--top-chrome-height);
    flex: 0 0 auto;
}

.headerbanner {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--color-primary);
    height: 140px;
    padding: 0 1em;
}

.searchbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2em;
    margin: 0 auto;
}

/* ===========================
   Navigation Sidebar
   =========================== */
nav {
    width: 15%;
    min-width: 15em;
    background-color: var(--color-accent);
}

nav ul {
    list-style-type: none;
}

.navitem {
    background-color: var(--color-accent);
    padding: 0.5em;
    text-align: center;
    cursor: pointer;
}

.navitem:hover {
    background-color: var(--color-highlight);
}

.navitem a {
    display: block;
    color: black;
    text-decoration: none;
    font-weight: bold;
}

/* ===========================
   Main Content
   =========================== */
.maincontent {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ===========================
   Product Tiles
   =========================== */
.tilegrid {
    display: grid;
    grid-template-columns: repeat(6, minmax(180px, 1fr));
    gap: 1em;
    padding: 1em;
    background-color: var(--color-light);
    width: 100%;
}

.tile {
    background-color: var(--color-light);
    padding: 5px;
    width: 7em;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 0.1em;
}

.tile-label {
    color: black;
}

.tile:hover {
    background-color: var(--color-highlight);
}

/* ===========================
   Sprite Icons
   =========================== */
.tile-icon {
    width: 100px;
    height: 100px;
    background-image: url("/static/img/sprites.png");
    background-repeat: no-repeat;
    background-size: 1000px 100px;
    image-rendering: crisp-edges;
}

.icon-pump {
    background-position: 0 0;
}

.icon-motor {
    background-position: -100px 0;
}

.icon-accessory {
    background-position: -200px 0;
}

.icon-hardware {
    background-position: -300px 0;
}

.icon-controls {
    background-position: -400px 0;
}

.icon-automation {
    background-position: -500px 0;
}

/* ===========================
   Highlight State
   =========================== */
.highlight {
    background-color: var(--color-highlight) !important;
    color: black !important;
}

/* ===========================
   Product Filter
   =========================== */
.productfiltertilegrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5em;
    padding: 0.5em;
    background-color: var(--color-highlight);
}

.productfiltertile {
    background-color: var(--color-accent);
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.productfilterrow {
    padding: 1em;
    background-color: white;
}

/* ===========================
   Search Input
   =========================== */
#search {
    width: 60%;
    max-width: 400px;
    padding: 0.6em 1em;
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    background-color: var(--color-light);
}

#search:focus,
#search:hover {
    border-color: var(--color-focus);
    background-color: white;
}

/* ===========================
   Footer
   =========================== */
footer {
    background-color: var(--color-primary);
    padding: 1.2rem 1.25rem;
    color: white;
    margin-top: auto;
    flex: 0 0 auto;
    position: relative;
    width: 100%;
}

.footer {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 0.75rem 1.25rem;
    min-height: 7rem;
}

.footer-column h3 {
    font-size: 1rem;
    margin-bottom: 0.45rem;
}

.footer-column p {
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.9);
}

.footer-column a {
    display: block;
    color: #fff;
    text-decoration: none;
    margin-bottom: 0.25rem;
}

.footer-column a:visited {
    color: #fff;
}

.footer-column a:hover {
    color: #d6e7fb;
    text-decoration: underline;
}

/* ===========================
   Account Page
   =========================== */
.account-page {
    flex: 1 0 auto;
    min-height: calc(100vh - var(--top-chrome-height));
    padding-bottom: 2.5rem;
}

.account-hero {
    position: relative;
    overflow: hidden;
}

.account-hero::after {
    content: "";
    position: absolute;
    inset: auto -4rem -4rem auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(206, 126, 31, 0.16) 0%, rgba(206, 126, 31, 0) 72%);
    pointer-events: none;
}

.account-bento {
    align-items: stretch;
}

.account-card {
    display: grid;
    gap: var(--space-3);
}

.account-card-profile {
    grid-column: span 6;
}

.account-stat-card {
    grid-column: span 3;
    align-content: start;
    text-align: left;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 252, 0.96)),
        var(--color-surface);
}

.account-card-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: var(--text-xs);
    color: #6f7f8f;
}

.account-identity {
    display: grid;
    gap: 0.35rem;
}

.account-identity h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2.3vw, 2rem);
    color: #182739;
}

.account-identity p,
.account-lead {
    margin: 0;
    color: #516375;
}

.account-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.account-profile-item {
    display: grid;
    gap: 0.35rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
    border: 1px solid rgba(24, 42, 64, 0.1);
}

.account-profile-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #718293;
}

.account-stat-value {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1;
    color: #1c2f43;
}

.account-stat-label {
    margin: 0;
    color: #54677a;
    font-size: var(--text-sm);
}

.account-passkey-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: end;
}

.account-status {
    margin: 0;
    color: #425569;
    min-height: 1.45rem;
}

.account-passkey-list {
    display: grid;
    gap: 0.8rem;
}

.account-passkey-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(24, 42, 64, 0.1);
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
}

.account-passkey-item h3,
.account-passkey-item p {
    margin: 0;
}

.account-passkey-item h3 {
    font-size: var(--text-md);
    color: #213447;
}

.account-passkey-item p {
    color: #607284;
    font-size: var(--text-sm);
}

.account-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    padding: 0.7rem 1rem;
    border: 1px solid rgba(24, 42, 64, 0.12);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #17385d 0%, #0e2845 100%);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.account-action:visited,
.account-action:hover,
.account-action:focus-visible {
    color: #fff;
}

.account-action:hover {
    background: linear-gradient(180deg, #1c436e 0%, #133256 100%);
    text-decoration: none;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 1400px) {
    .tilegrid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    :root {
        --top-chrome-height: 210px;
    }

    section {
        flex-direction: column;
    }

    nav {
        width: 100%;
        min-width: 0;
    }

    .tilegrid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tile {
        width: 100%;
    }

    .footer {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .account-card-profile,
    .account-stat-card {
        grid-column: span 12;
    }

    .account-profile-grid,
    .account-passkey-form,
    .account-passkey-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    :root {
        --top-chrome-height: 250px;
    }

    .footer {
        grid-template-columns: 1fr;
        min-height: auto;
    }
}
