/* 05-cart-checkout.css
   Cart, checkout steps, order summary/confirmation, quote form, account pages,
   plus the header cart badge and account dropdown. Loaded after
   04-product-detail.css and before 06-content-pages.css (file order is cascade
   order; see App.razor). */

/* ===== Header: cart badge + account dropdown ===== */

.cart-header-link {
    position: relative;
}

.cart-count-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--brand-500);
    color: var(--text-on-brand);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.account-menu {
    position: relative;
}

.account-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: transparent;
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 100;
    min-width: 210px;
    padding: 8px;
    display: flex;
    flex-direction: column;
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    min-height: 44px;
}

.account-menu-item:hover {
    background: var(--bg-subtle);
    color: var(--brand-600);
}

.account-menu-item.sign-out {
    color: var(--danger);
}

.account-menu-divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--border);
}

/* Sign-out is a real form POST (antiforgery + POST-only logout): make the
   button render exactly like the anchor menu items around it. */
.account-menu-signout-form {
    display: flex;
    flex-direction: column;
}

.account-menu-signout-form .account-menu-item {
    width: 100%;
    background: none;
    border: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.account-menu-signout-form .account-menu-item:hover {
    background: var(--bg-subtle);
}

.admin-signout-form {
    display: inline-flex;
}

/* ===== Cart page ===== */

.cart-page h1,
.checkout-page h1,
.account-page h1 {
    margin-bottom: 20px;
}

.cart-empty {
    max-width: 460px;
    margin: 40px auto;
    padding: 40px 28px;
    text-align: center;
}

.cart-empty i {
    font-size: 42px;
    color: var(--brand-200);
}

.cart-empty h1,
.cart-empty h2 {
    margin: 12px 0 8px;
}

.cart-empty p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

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

.cart-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-line {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
}

.cart-line-warranty {
    margin-left: 28px;
    background: var(--bg-subtle);
}

.cart-line-image {
    flex: 0 0 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    overflow: hidden;
}

.cart-line-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-line-image i {
    font-size: 28px;
    color: var(--brand-200);
}

.cart-line-warranty-icon i {
    color: var(--brand-600);
}

.cart-line-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-line-name {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

a.cart-line-name:hover {
    color: var(--brand-600);
}

.cart-line-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.cart-line-serial {
    font-size: 13px;
    color: var(--text-muted);
}

.cart-reservation-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--warning);
    font-weight: 500;
}

.cart-line-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.qty-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-card);
    color: var(--brand-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover:not(:disabled) {
    background: var(--bg-subtle);
}

.qty-btn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: .5;
}

.qty-cap-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--warning);
    margin-top: 4px;
}

.checkout-reservation-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--warning);
    margin-top: 12px;
}

.qty-value {
    min-width: 34px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.qty-single {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.cart-line-price {
    min-width: 84px;
    text-align: right;
}

.cart-line-remove {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-sm);
}

.cart-line-remove:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ===== Summary cards (cart + checkout + confirmation) ===== */

.cart-summary,
.checkout-summary {
    padding: 20px;
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-summary h2,
.checkout-summary h2 {
    font-size: 18px;
    margin: 0 0 4px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-total {
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--text);
    font-weight: 700;
    font-size: 16px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.summary-line-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.summary-qty,
.summary-serial {
    color: var(--text-muted);
    font-size: 13px;
}

.cart-export-note {
    margin-top: 4px;
}

/* ===== Checkout ===== */

.checkout-preview-banner a {
    font-weight: 600;
}

.checkout-steps {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    flex-wrap: wrap;
}

.checkout-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.checkout-step.active {
    background: var(--brand-100);
    color: var(--brand-700);
}

.checkout-step.done {
    color: var(--success);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    font-size: 12px;
    font-weight: 700;
}

.checkout-step.active .step-number {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: var(--text-on-brand);
}

.checkout-step.done .step-number {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}

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

.checkout-main {
    padding: 24px;
}

.checkout-main h2 {
    font-size: 20px;
    margin: 0 0 16px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 120px;
    gap: 12px;
}

.checkout-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.ship-method {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: default;
}

.ship-method.selected {
    border-color: var(--brand-500);
    background: var(--brand-50);
}

.ship-method-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ship-method-name {
    font-weight: 600;
}

.ship-method-note {
    font-size: 13px;
    color: var(--text-muted);
}

.ship-method-price {
    font-weight: 700;
    color: var(--brand-600);
}

.card-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 440px;
}

.secure-note {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--success-bg);
    color: var(--success);
    font-size: 13px;
}

/* ===== Confirmation / order detail ===== */

.confirmation-hero {
    padding: 36px 28px;
    text-align: center;
    margin-bottom: 24px;
}

.confirmation-hero i {
    font-size: 46px;
    color: var(--success);
}

.confirmation-hero h1 {
    margin: 10px 0 8px;
}

.confirmation-hero p {
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

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

.confirmation-main,
.confirmation-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.confirmation-block {
    padding: 20px;
}

.confirmation-block h2 {
    font-size: 17px;
    margin: 0 0 12px;
}

.address-block {
    line-height: 1.6;
    color: var(--text-secondary);
}

.status-timeline {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-timeline li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 16px;
    border-left: 2px solid var(--brand-200);
}

.timeline-status {
    font-weight: 600;
    font-size: 14px;
}

.timeline-date,
.timeline-note {
    font-size: 13px;
    color: var(--text-muted);
}

.account-nudge p {
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.order-detail-head {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* ===== Quote page ===== */

.quote-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 32px;
    align-items: start;
}

.quote-intro > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.quote-product-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 20px;
}

.quote-product-image {
    flex: 0 0 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    overflow: hidden;
}

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

.quote-product-image i {
    font-size: 26px;
    color: var(--brand-200);
}

.quote-product-brand {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.quote-product-name {
    display: block;
    font-weight: 700;
}

.quote-product-sku {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

.quote-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quote-points li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.quote-points i {
    color: var(--brand-600);
    margin-top: 2px;
}

.quote-form {
    padding: 24px;
}

.quote-export-notice {
    margin: 4px 0 14px;
}

/* ===== Account pages ===== */

.account-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.account-nav-link {
    padding: 10px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.account-nav-link:hover {
    color: var(--brand-600);
}

.account-nav-link.active {
    color: var(--brand-700);
    border-bottom-color: var(--brand-500);
}

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

.account-block {
    padding: 22px;
}

.account-block h2 {
    font-size: 18px;
    margin: 0 0 14px;
}

.account-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.account-block-head h2 {
    margin: 0;
}

.address-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.address-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.address-item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.address-item-label {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.address-item-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.address-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-danger-ghost:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

.address-editor {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-row {
    display: grid;
    grid-template-columns: 140px 110px 1fr auto 100px 20px;
    align-items: center;
    gap: 14px;
    padding: 16px;
    text-decoration: none;
    color: var(--text);
}

.order-row:hover {
    border-color: var(--brand-200);
}

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

.order-row-date,
.order-row-items {
    font-size: 14px;
    color: var(--text-muted);
}

.order-row-total {
    text-align: right;
}

/* ===== Responsive ===== */

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

    .cart-summary,
    .checkout-summary {
        position: static;
    }

    .cart-line {
        flex-wrap: wrap;
    }

    .cart-line-controls {
        width: 100%;
        justify-content: space-between;
    }

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

    .order-row i {
        display: none;
    }
}

@media (max-width: 640px) {
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .cart-line-warranty {
        margin-left: 12px;
    }

    .checkout-actions {
        flex-direction: column-reverse;
    }

    .checkout-actions .btn {
        width: 100%;
    }
}
