/**
 * Buyer account — dashboard + profile modal.
 * Light surfaces; beats theme3 white heading defaults.
 */

.customer-account-page {
    --ca-ink: #141414;
    --ca-muted: #6b6b6b;
    --ca-line: rgba(20, 20, 20, 0.1);
    --ca-soft: #f6f5f3;
    --ca-surface: #ffffff;
    --ca-accent: var(--theme-color, #141414);
    background: var(--ca-soft) !important;
    color: var(--ca-ink) !important;
    min-height: 60vh;
}

.customer-account-page .ca-shell {
    max-width: 920px;
    margin: 0 auto;
    padding: 28px 18px 56px;
}

/* Hero */
.customer-account-page .ca-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 22px 24px;
    margin-bottom: 18px;
    background: var(--ca-surface);
    border: 1px solid var(--ca-line);
    border-radius: 18px;
}

.customer-account-page .ca-hero__identity {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.customer-account-page .ca-avatar {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    background: var(--ca-accent);
}

.customer-account-page .ca-hero__eyebrow {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.customer-account-page .ca-hero__name {
    margin: 0;
    font-size: clamp(1.35rem, 3.2vw, 1.85rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-transform: none !important;
}

.customer-account-page .ca-hero__email {
    margin: 4px 0 0;
    font-size: 14px;
    word-break: break-word;
}

.customer-account-page .ca-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

/* Stats */
.customer-account-page .ca-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.customer-account-page .ca-stat {
    background: var(--ca-surface);
    border: 1px solid var(--ca-line);
    border-radius: 16px;
    padding: 16px 18px;
}

.customer-account-page .ca-stat__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.customer-account-page .ca-stat__value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

/* Panels */
.customer-account-page .ca-panel {
    background: var(--ca-surface);
    border: 1px solid var(--ca-line);
    border-radius: 18px;
    padding: 22px 22px 20px;
    margin-bottom: 16px;
}

.customer-account-page .ca-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--ca-line);
}

.customer-account-page .ca-panel__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: none !important;
}

.customer-account-page .ca-panel__sub {
    margin: 4px 0 0;
    font-size: 13px;
}

.customer-account-page .ca-panel__link {
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

/* Orders */
.customer-account-page .ca-orders {
    display: grid;
    gap: 12px;
}

.customer-account-page .ca-order {
    border: 1px solid var(--ca-line);
    border-radius: 14px;
    padding: 16px;
    background: #fbfbfa;
}

.customer-account-page .ca-order__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.customer-account-page .ca-order__id {
    display: block;
    font-size: 15px;
}

.customer-account-page .ca-order__top .ca-muted {
    margin: 4px 0 0;
    font-size: 13px;
}

.customer-account-page .ca-order__meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.customer-account-page .ca-order__meta span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.customer-account-page .ca-order__meta strong {
    font-size: 14px;
    font-weight: 600;
}

.customer-account-page .ca-order__actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--ca-line);
}

.customer-account-page .ca-badge {
    align-self: flex-start;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: #eee;
    color: #333 !important;
    -webkit-text-fill-color: #333 !important;
    text-transform: capitalize;
}

.customer-account-page .ca-badge--delivered,
.customer-account-page .ca-badge--completed {
    background: #e7f6ec;
    color: #146c35 !important;
    -webkit-text-fill-color: #146c35 !important;
}

.customer-account-page .ca-badge--pending,
.customer-account-page .ca-badge--processing,
.customer-account-page .ca-badge--confirmed {
    background: #fff4df;
    color: #8a5a00 !important;
    -webkit-text-fill-color: #8a5a00 !important;
}

/* Empty */
.customer-account-page .ca-empty {
    text-align: center;
    padding: 40px 16px 28px;
}

.customer-account-page .ca-empty--compact {
    padding: 28px 16px 18px;
}

.customer-account-page .ca-empty__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ca-soft);
    color: var(--ca-muted) !important;
    -webkit-text-fill-color: var(--ca-muted) !important;
}

.customer-account-page .ca-empty h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    text-transform: none !important;
}

.customer-account-page .ca-empty__copy {
    margin: 0 0 18px;
    font-size: 14px;
}

/* Buttons */
.customer-account-page .customer-btn,
#profileview-modal .customer-btn,
.ca-profile .customer-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.customer-account-page .customer-btn--sm {
    min-height: 36px;
    padding: 8px 14px !important;
    font-size: 13px !important;
}

.customer-account-page .customer-btn--solid,
#profileview-modal .customer-btn--solid,
.ca-profile .customer-btn--solid {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    background: #141414 !important;
    border: 1px solid #141414 !important;
}

.customer-account-page .customer-btn--solid:hover,
#profileview-modal .customer-btn--solid:hover {
    background: #2a2a2a !important;
    border-color: #2a2a2a !important;
}

.customer-account-page .customer-btn--ghost {
    color: #141414 !important;
    -webkit-text-fill-color: #141414 !important;
    background: transparent !important;
    border: 1px solid rgba(20, 20, 20, 0.22) !important;
}

.customer-account-page .customer-btn--ghost:hover {
    background: #141414 !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    border-color: #141414 !important;
}

/* Legacy class aliases used elsewhere */
.customer-account-page .customer-btn--hero-solid,
.customer-account-page .customer-btn--surface-solid {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    background: #141414 !important;
    border: 1px solid #141414 !important;
}

.customer-account-page .customer-btn--hero-outline,
.customer-account-page .customer-btn--surface-outline {
    color: #141414 !important;
    -webkit-text-fill-color: #141414 !important;
    background: transparent !important;
    border: 1px solid rgba(20, 20, 20, 0.22) !important;
}

@media (max-width: 768px) {
    .customer-account-page .ca-hero {
        flex-direction: column;
        align-items: stretch;
        padding: 18px;
    }

    .customer-account-page .ca-hero__actions {
        justify-content: stretch;
    }

    .customer-account-page .ca-hero__actions .customer-btn {
        flex: 1 1 auto;
    }

    .customer-account-page .ca-stats,
    .customer-account-page .ca-order__meta {
        grid-template-columns: 1fr;
    }

    .customer-account-page .ca-panel {
        padding: 18px 16px;
    }
}

/* ── Profile modal ── */
#profileview-modal .modal-body,
#profileview-modal .ca-profile,
#profileview-modal .ca-profile__body {
    color: #141414 !important;
    background: #fff !important;
}

#profileview-modal .ca-profile {
    padding: 4px 2px 8px;
}

#profileview-modal .ca-profile__section {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(20, 20, 20, 0.08);
}

#profileview-modal .ca-profile__section:last-of-type {
    border-bottom: 0;
    margin-bottom: 8px;
}

#profileview-modal .ca-profile__heading {
    margin: 0 0 14px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    text-transform: none !important;
    color: #141414 !important;
    -webkit-text-fill-color: #141414 !important;
}

#profileview-modal .ca-profile__hint {
    margin: -8px 0 14px;
    font-size: 13px;
    color: #6b6b6b !important;
    -webkit-text-fill-color: #6b6b6b !important;
}

#profileview-modal .ca-profile__grid {
    display: grid;
    gap: 14px 16px;
}

#profileview-modal .ca-profile__grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#profileview-modal .ca-profile__grid--2 {
    grid-template-columns: 1fr;
}

#profileview-modal .ca-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#profileview-modal .ca-field label {
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #6b6b6b !important;
    -webkit-text-fill-color: #6b6b6b !important;
}

#profileview-modal .ca-field__error {
    font-size: 12px;
    color: #c0392b !important;
}

#profileview-modal .ca-input.form-control,
#profileview-modal .form-control.ca-input {
    width: 100% !important;
    min-height: 44px;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(20, 20, 20, 0.14) !important;
    background: #fafafa !important;
    color: #141414 !important;
    -webkit-text-fill-color: #141414 !important;
    font-size: 14px !important;
    box-shadow: none !important;
}

#profileview-modal .ca-input.form-control:focus {
    outline: none !important;
    border-color: #141414 !important;
    background: #fff !important;
}

#profileview-modal .ca-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px dashed rgba(20, 20, 20, 0.28);
    background: #fafafa;
    color: #141414 !important;
    -webkit-text-fill-color: #141414 !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

#profileview-modal .ca-file__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

#profileview-modal .ca-profile__footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
}

#profileview-modal .ca-profile__save {
    border-radius: 999px !important;
    min-width: 140px;
}

@media (max-width: 768px) {
    #profileview-modal .ca-profile__grid--3 {
        grid-template-columns: 1fr;
    }

    #profileview-modal .ca-profile__footer {
        justify-content: stretch;
    }

    #profileview-modal .ca-profile__save {
        width: 100%;
    }
}

/* Order modal readability */
#orderview-modal .modal-body,
.common-modal .order-view-body {
    color: #141414 !important;
    background: #fff !important;
}

#orderview-modal .modal-body h2,
#orderview-modal .modal-body h3,
#orderview-modal .modal-body p,
#orderview-modal .modal-body span,
#orderview-modal .modal-body th,
#orderview-modal .modal-body td,
#orderview-modal .modal-body a {
    color: #141414 !important;
}
