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

.checkout-page {
    background: var(--bg-secondary);
    min-height: 100vh;
}

.checkout {
    padding: 8rem 0 5rem;
}

.checkout-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 3rem;
}

.checkout-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.checkout-title::after {
    content: '';
    display: block;
    width: 56px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 999px;
    margin: 0.875rem auto 0;
}

.checkout-subtitle {
    color: var(--text-secondary);
    font-size: 1.0625rem;
}

.checkout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.checkout-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.checkout-section-title.summary-heading {
    margin-top: 2rem;
}

/* Mode picker tabs */
.picker-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.picker-title {
    margin-bottom: 0;
}

.picker-tabs {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.25rem;
    gap: 0.125rem;
}

.picker-tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.picker-tab:hover:not(.is-active) {
    color: var(--text-primary);
}

.picker-tab.is-active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.picker-intro {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Guided rows */
.guided-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.guided-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 96px;
    gap: 1rem;
    align-items: center;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--bg-primary);
    cursor: text;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.guided-row:hover {
    border-color: var(--primary-color);
}

.guided-row-active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(139, 92, 246, 0.04));
}

.guided-row-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.guided-row-icon img {
    max-width: 75%;
    max-height: 75%;
    object-fit: contain;
}

.guided-row-body {
    min-width: 0;
}

.guided-row-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.guided-row-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1.4;
}

.guided-row-sep {
    margin: 0 0.375rem;
    opacity: 0.6;
}

.guided-row-price {
    color: var(--text-secondary);
    font-weight: 500;
}

.guided-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    font-family: inherit;
    -moz-appearance: textfield;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.guided-input::-webkit-outer-spin-button,
.guided-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.guided-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: var(--bg-primary);
}

/* Product list */
.checkout-products {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    gap: 1.25rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--bg-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.product-row:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.product-row-active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(139, 92, 246, 0.04));
}

.product-row-media {
    width: 96px;
    height: 96px;
    border-radius: 0.625rem;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-row-media img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.product-row-body {
    min-width: 0;
}

.product-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.product-row-name {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
}

.product-row-price {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.product-row-price .vat {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.25rem;
}

.product-row-tagline {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.product-row-specs {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 0.875rem;
    padding: 0;
    font-size: 0.75rem;
    color: var(--text-light);
}

.product-row-specs li {
    position: relative;
    padding-left: 0.875rem;
}

.product-row-specs li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Quantity stepper */
.product-row-qty {
    display: inline-flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.25rem;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.qty-btn:hover {
    background: var(--primary-color);
    color: white;
}

.qty-input {
    width: 44px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: inherit;
    -moz-appearance: textfield;
}

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

.qty-input:focus {
    outline: none;
}

/* Summary card */
.checkout-summary {
    position: sticky;
    top: 6rem;
}

.summary-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.875rem 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-field .optional {
    color: var(--text-light);
    font-weight: 400;
}

.form-field input,
.form-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: var(--bg-primary);
}

.form-field textarea {
    resize: vertical;
    min-height: 84px;
}

/* Summary lines */
.summary-lines {
    border-top: 1px dashed var(--border-color);
    padding-top: 0.875rem;
    margin-bottom: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.summary-empty {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.summary-line-qty {
    color: var(--primary-color);
    font-weight: 700;
    margin-right: 0.375rem;
}

.summary-line-amount {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 0.875rem;
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-total-amount {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-note {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.volume-discount {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-top: 0.875rem;
    padding: 0.75rem 0.875rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
    animation: fadeInUp 0.35s ease-out;
}

.volume-discount strong {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.volume-discount-icon {
    font-size: 1.125rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.checkout-submit {
    width: 100%;
    margin-top: 1.25rem;
}

.checkout-status {
    margin-top: 0.875rem;
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    line-height: 1.4;
}

.checkout-status[data-kind="success"] {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.checkout-status[data-kind="error"] {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

/* Responsive */
@media (max-width: 960px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
    .checkout-summary {
        position: static;
    }
}

@media (max-width: 640px) {
    .checkout {
        padding: 6.5rem 0 3rem;
    }
    .checkout-products,
    .summary-card {
        padding: 1.25rem;
    }
    .product-row {
        grid-template-columns: 64px minmax(0, 1fr);
        grid-template-areas:
            "media body"
            "qty   qty";
        gap: 0.875rem;
    }
    .product-row-media {
        grid-area: media;
        width: 64px;
        height: 64px;
    }
    .product-row-body {
        grid-area: body;
    }
    .product-row-qty {
        grid-area: qty;
        justify-self: end;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .guided-row {
        grid-template-columns: 40px minmax(0, 1fr) 72px;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    .guided-row-icon {
        width: 40px;
        height: 40px;
    }
    .picker-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}
