/* Account page - order history, order detail, profile settings */

.account-main {
    background: var(--bc-bg);
    max-width: 1180px;
    margin: 0 auto;
    padding: calc(var(--header-offset) + 2rem) 1.25rem 4rem;
}

/* ── Reusable card pattern ─────────────────────────────────────────────── */

.bc-card {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    border-radius: 22px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 769px) {
    .bc-card {
        padding: 1.5rem;
    }
}

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

.account-header {
    margin-bottom: 2rem;
}

.account-header h1 {
    margin: 0 0 0.35rem;
    font-family: var(--font-serif);
    font-size: clamp(1.7rem, 4vw, 2.2rem);
    color: var(--bc-ink);
}

.account-header p {
    margin: 0;
    color: var(--bc-text-muted);
    font-size: 0.95rem;
}

/* ── Auth gate ───────────────────────────────────────────────────────── */

.account-auth-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    min-height: 60vh;
}

.account-auth-gate .bc-card {
    max-width: 420px;
    text-align: center;
}

.account-auth-gate h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--bc-ink);
}

.account-auth-gate p {
    margin: 0;
    color: var(--bc-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.account-auth-gate .btn {
    align-self: center;
}

/* ── Content wrapper (two-column layout) ──────────────────────────────── */

.account-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 769px) {
    .account-content-wrapper {
        flex-direction: row;
        gap: 2rem;
    }
}

/* ── Left column ─────────────────────────────────────────────────────── */

.account-left {
    flex: 1;
    min-width: 0;
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */

.account-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.account-tab-btn {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    color: var(--bc-text-warm);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: var(--bc-radius-pill);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.account-tab-btn:hover {
    border-color: var(--bc-border-strong);
    background: var(--bc-bg);
}

.account-tab-btn.active {
    background: #5a4f47;
    border-color: #5a4f47;
    color: #FFFDF8;
}

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

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

.order-card {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    border-radius: 22px;
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-default);
    user-select: none;
}

.order-card:hover {
    border-color: var(--bc-border-strong);
}

.order-card.is-open {
    border-color: var(--bc-clay);
}

.order-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.order-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--bc-ink);
    flex: 1 1 auto;
    min-width: 0;
}

.order-card-meta {
    color: var(--bc-text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.order-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.order-status-badge.status-paid,
.order-status-badge.status-submitted_to_gelato {
    background: rgba(99, 149, 255, 0.15);
    color: #a5beff;
}

.order-status-badge.status-in_production {
    background: rgba(216, 160, 126, 0.15);
    color: var(--bc-clay);
}

.order-status-badge.status-shipped {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.order-status-badge.status-delivered {
    background: rgba(74, 222, 128, 0.2);
    color: #86efac;
}

.order-status-badge.status-draft,
.order-status-badge.status-awaiting_payment {
    background: rgba(255, 255, 255, 0.06);
    color: var(--bc-text-muted);
}

.order-status-badge.status-failed,
.order-status-badge.status-canceled {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
}

.order-card-chevron {
    color: var(--bc-text-muted);
    flex-shrink: 0;
    transition: transform var(--duration-fast) var(--ease-default);
}

.order-card.is-open .order-card-chevron {
    transform: rotate(180deg);
}

/* ── Order detail (expanded) ─────────────────────────────────────────── */

.order-detail {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bc-border);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.order-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.order-detail-label {
    color: var(--bc-text-muted);
    flex-shrink: 0;
}

.order-detail-value {
    color: var(--bc-ink);
    text-align: right;
    word-break: break-all;
}

.order-tracking-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    background: var(--bc-clay-soft);
    color: var(--bc-text-clay-deep);
    border: 1px solid var(--bc-border);
    border-radius: var(--bc-radius-field);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-default);
    margin-top: 0.25rem;
}

.order-tracking-btn:hover {
    background: var(--bc-border);
}

.order-detail-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Empty state ──────────────────────────────────────────────────────── */

.orders-empty {
    text-align: center;
}

.orders-empty .bc-card {
    max-width: 480px;
    margin: 0 auto;
}

.orders-empty h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bc-ink);
}

.orders-empty p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--bc-text-muted);
}

/* ── Loading / feedback ───────────────────────────────────────────────── */

.account-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bc-text-muted);
    font-size: 0.95rem;
}

.account-feedback {
    padding: 0.75rem 1rem;
    border-radius: var(--bc-radius-field);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.account-feedback.is-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── Profile tab ──────────────────────────────────────────────────────── */

.profile-section {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    border-radius: 22px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.profile-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-field .profile-value {
    font-size: 0.95rem;
    color: var(--bc-ink);
}

.profile-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bc-clay-soft);
    border-radius: var(--bc-radius-field);
    border: none;
}

.profile-consent-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

.profile-consent-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.profile-consent-slider {
    position: absolute;
    inset: 0;
    background: var(--bc-border);
    border-radius: 99px;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-default);
}

.profile-consent-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--bc-surface);
    border-radius: 50%;
    transition: transform var(--duration-fast) var(--ease-default);
}

.profile-consent-toggle input:checked + .profile-consent-slider {
    background: #5a4f47;
}

.profile-consent-toggle input:checked + .profile-consent-slider::before {
    transform: translateX(18px);
}

.profile-consent-info {
    flex: 1;
}

.profile-consent-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bc-text-clay-deep);
    margin-bottom: 0.2rem;
}

.profile-consent-desc {
    font-size: 0.8rem;
    color: var(--bc-text-clay-deep);
}

.profile-save-btn {
    align-self: flex-start;
    background: var(--bc-clay);
    color: var(--bc-ink);
    border-radius: var(--bc-radius-pill);
    border: none;
}

.profile-save-btn:hover {
    background: #c99470;
}

.profile-feedback {
    font-size: 0.85rem;
    min-height: 1.2rem;
}

.profile-feedback.is-success { color: #4ade80; }
.profile-feedback.is-error { color: #f87171; }

/* ── Sidebar (desktop only) ────────────────────────────────────────────── */

.account-sidebar {
    flex: 0 0 300px;
}

@media (max-width: 768px) {
    .account-sidebar {
        display: none;
    }
}

.account-sidebar .bc-card {
    position: sticky;
    top: calc(var(--header-offset) + 2rem);
}

.account-sidebar h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--bc-ink);
}

.account-sidebar p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--bc-text-muted);
    line-height: 1.5;
}

/* ── Status timeline ──────────────────────────────────────────────────── */

.order-status-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0.25rem 0;
}

.timeline-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
    padding-bottom: 0.85rem;
}

.timeline-step:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bc-border);
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.timeline-step.is-done .timeline-dot {
    background: var(--bc-clay);
}

.timeline-step.is-current .timeline-dot {
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
}

.timeline-line {
    position: absolute;
    left: 4px;
    top: 14px;
    bottom: 0;
    width: 2px;
    background: var(--bc-border);
}

.timeline-step.is-done .timeline-line {
    background: var(--bc-clay);
    opacity: 0.35;
}

.timeline-step-label {
    font-size: 0.825rem;
    color: var(--bc-text-muted);
    line-height: 1.4;
}

.timeline-step.is-done .timeline-step-label {
    color: var(--bc-text-warm);
}

.timeline-step.is-current .timeline-step-label {
    color: var(--bc-ink);
    font-weight: 600;
}

/* ── Checkout consent ────────────────────────────────────────────────── */

.checkout-consent {
    margin-bottom: 1rem;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--bc-text-warm);
    line-height: 1.4;
}

.consent-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--bc-clay);
}

/* ── Checkout account CTA ────────────────────────────────────────────── */

.checkout-account-cta {
    margin: 1.25rem 0 0.5rem;
    padding: 1rem;
    background: var(--bc-clay-soft);
    border: 1px solid var(--bc-border);
    border-radius: var(--bc-radius-field);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.account-cta-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--bc-text-warm);
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .account-main {
        padding-top: calc(var(--header-offset) + 1rem);
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .account-header {
        margin-bottom: 1.5rem;
    }

    .account-tabs {
        margin-bottom: 1.5rem;
    }

    .account-tab-btn {
        font-size: 0.875rem;
        padding: 0.55rem 1rem;
    }

    .order-card {
        padding: 1rem;
    }

    .order-detail-row {
        flex-direction: column;
        gap: 0.2rem;
    }

    .order-detail-value {
        text-align: left;
    }

    .profile-section {
        max-width: 100%;
    }
}
