/* ==========================================================================
   InfusionPro customer portal (INF-121)
   Layered on the shared theme (infusionpro-mud-theme.css): the brand navy, the warm gold and
   Playfair/Lato come from there. This file is the portal's own frame and pages.
   ========================================================================== */

:root {
    --portal-navy: #292B6A;
    --portal-navy-deep: #1a1c45;
    --portal-gold: #D9A456;
    --portal-ink: #1a1c45;
    --portal-muted: #5a6a85;
    --portal-line: #e4e2dc;
    --portal-paper: #ffffff;
    --portal-canvas: #f7f5f1;
    --portal-max: 1200px;
}

body {
    background: var(--portal-canvas);
}

.portal-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--portal-canvas);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.portal-header {
    background: var(--portal-navy);
    color: #fff;
    border-bottom: 3px solid var(--portal-gold);
    position: sticky;
    top: 0;
    z-index: 10;
}

.portal-header-inner {
    max-width: var(--portal-max);
    margin: 0 auto;
    padding: 0 16px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.portal-brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.portal-brand img {
    width: 28px;
    height: 28px;
    align-self: center;
}

.portal-brand-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    font-weight: 600;
}

.portal-brand-sub {
    color: var(--portal-gold);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.portal-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.portal-nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 500;
}

.portal-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.portal-nav a.active {
    color: #fff;
    box-shadow: inset 0 -2px 0 var(--portal-gold);
    border-radius: 0;
}

.portal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-cart-link,
.portal-account {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    background: none;
    border: 0;
    padding: 8px 10px;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
}

.portal-cart-link:hover,
.portal-account:hover {
    background: rgba(255, 255, 255, 0.08);
}

.portal-account-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Page frame ─────────────────────────────────────────────────────────── */

.portal-main {
    flex: 1;
    width: 100%;
    max-width: var(--portal-max);
    margin: 0 auto;
    padding: 32px 16px 48px;
}

.portal-footer {
    text-align: center;
    color: var(--portal-muted);
    font-size: 0.8rem;
    padding: 24px 16px;
    border-top: 1px solid var(--portal-line);
}

.portal-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.portal-page-head h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--portal-ink);
    margin: 0;
}

.portal-page-head p {
    color: var(--portal-muted);
    margin: 4px 0 0;
}

.portal-panel {
    background: var(--portal-paper);
    border: 1px solid var(--portal-line);
    border-radius: 10px;
    padding: 20px;
}

.portal-empty {
    text-align: center;
    padding: 64px 16px;
    color: var(--portal-muted);
}

.portal-empty h1,
.portal-empty h2 {
    font-family: 'Playfair Display', serif;
    color: var(--portal-ink);
}

.portal-loading {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--portal-muted);
    font-family: 'Lato', sans-serif;
}

.portal-loading img {
    width: 48px;
    height: 48px;
}

/* ── Home ───────────────────────────────────────────────────────────────── */

.portal-welcome {
    background: var(--portal-navy);
    color: #fff;
    border-radius: 12px;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.portal-welcome h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 6px;
}

.portal-welcome p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

.portal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.portal-stat {
    background: var(--portal-paper);
    border: 1px solid var(--portal-line);
    border-radius: 10px;
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
}

.portal-stat:hover {
    border-color: var(--portal-gold);
}

.portal-stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--portal-navy);
    line-height: 1.1;
}

.portal-stat-label {
    color: var(--portal-muted);
    font-size: 0.85rem;
}

/* ── Catalogue ──────────────────────────────────────────────────────────── */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--portal-paper);
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 120ms ease;
}

.product-card:hover {
    border-color: var(--portal-gold);
}

.product-card-body {
    padding: 16px 16px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-code {
    color: var(--portal-muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.product-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--portal-ink);
    margin: 0;
    line-height: 1.25;
}

.product-description {
    color: var(--portal-muted);
    font-size: 0.85rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.product-price {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
}

.product-price strong {
    font-size: 1.2rem;
    color: var(--portal-navy);
}

.product-price span {
    color: var(--portal-muted);
    font-size: 0.75rem;
}

.product-order {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 16px 16px;
}

/* ── Product picture ────────────────────────────────────────────────────── */

.product-image {
    aspect-ratio: 4 / 3;
    background: #efece6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-image-placeholder {
    color: #c9c2b4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
}

.product-image.small {
    width: 72px;
    aspect-ratio: 1;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ── Quantity stepper ───────────────────────────────────────────────────── */

.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
    background: var(--portal-paper);
}

.qty-stepper button {
    border: 0;
    background: none;
    width: 32px;
    height: 36px;
    font-size: 1.1rem;
    color: var(--portal-navy);
    cursor: pointer;
}

.qty-stepper button:disabled {
    color: #c9c9d3;
    cursor: default;
}

.qty-stepper input {
    width: 64px;
    border: 0;
    text-align: center;
    font: inherit;
    font-weight: 600;
    color: var(--portal-ink);
    background: none;
    -moz-appearance: textfield;
}

.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* ── Cart ───────────────────────────────────────────────────────────────── */

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

.cart-line {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--portal-line);
}

.cart-line:last-child {
    border-bottom: 0;
}

.cart-line-info {
    flex: 1;
    min-width: 0;
}

.cart-line-total {
    min-width: 110px;
    text-align: right;
    font-weight: 600;
    color: var(--portal-ink);
}

.cart-summary {
    position: sticky;
    top: 88px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    color: var(--portal-ink);
}

.cart-summary-row.total {
    border-top: 1px solid var(--portal-line);
    margin-top: 6px;
    padding-top: 12px;
    font-size: 1.15rem;
    font-weight: 700;
}

.cart-summary-row.deposit {
    color: var(--portal-navy);
    font-weight: 600;
}

.cart-note {
    color: var(--portal-muted);
    font-size: 0.8rem;
    margin: 8px 0 0;
}

/* ── Orders ─────────────────────────────────────────────────────────────── */

.order-table {
    width: 100%;
    border-collapse: collapse;
}

.order-table th {
    text-align: left;
    color: var(--portal-muted);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 10px 12px;
    border-bottom: 1px solid var(--portal-line);
}

.order-table td {
    padding: 12px;
    border-bottom: 1px solid var(--portal-line);
    color: var(--portal-ink);
    vertical-align: middle;
}

.order-table tr:last-child td {
    border-bottom: 0;
}

.order-table .num {
    text-align: right;
    white-space: nowrap;
}

.order-number {
    font-weight: 700;
}

.order-sub {
    display: block;
    color: var(--portal-muted);
    font-size: 0.8rem;
}

.stage-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.stage-chip.awaiting-payment { background: #fdf1dc; color: #8a5a12; }
.stage-chip.received { background: #e9ebf5; color: var(--portal-navy); }
.stage-chip.in-production { background: #e3f0fb; color: #1d5a8c; }
.stage-chip.ready { background: #e6f4ea; color: #1e6b34; }
.stage-chip.delivered { background: #eeeeee; color: #4a4a4a; }
.stage-chip.cancelled { background: #fbe9e9; color: #9b2c2c; }

/* ── Order placed ───────────────────────────────────────────────────────── */

.order-placed {
    max-width: 760px;
    margin: 0 auto;
}

.order-placed-mark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e6f4ea;
    color: #1e6b34;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

/* ── Smaller screens ────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
    }
}

@media (max-width: 720px) {
    .portal-header-inner {
        gap: 12px;
    }

    .portal-brand-sub,
    .portal-account-name,
    .portal-cart-text {
        display: none;
    }

    .portal-nav a {
        padding: 8px 8px;
    }

    .order-table .hide-sm {
        display: none;
    }

    .portal-welcome {
        padding: 24px;
    }
}
