/**
 * WC Credit System - Customer-facing styles (My Account)
 */

.wccs-customer {
    --wccs-c-primary: #6366f1;
    --wccs-c-primary-2: #8b5cf6;
    --wccs-c-success: #10b981;
    --wccs-c-success-2: #059669;
    --wccs-c-danger: #ef4444;
    --wccs-c-danger-2: #dc2626;
    --wccs-c-warning: #f59e0b;
    --wccs-c-text: #0f172a;
    --wccs-c-muted: #64748b;
    --wccs-c-bg: #ffffff;
    --wccs-c-soft: #f8fafc;
    --wccs-c-border: #e2e8f0;
    --wccs-c-radius: 16px;
    --wccs-c-radius-sm: 8px;
    --wccs-c-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --wccs-c-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);

    color: var(--wccs-c-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.wccs-customer * {
    box-sizing: border-box;
}

/* ===== HERO ===== */
.wccs-customer-hero {
    border-radius: var(--wccs-c-radius);
    padding: 32px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    box-shadow: var(--wccs-c-shadow-md);
    position: relative;
    overflow: hidden;
}

.wccs-customer-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 60%);
    pointer-events: none;
}

.wccs-balance-debt {
    background: linear-gradient(135deg, var(--wccs-c-danger) 0%, var(--wccs-c-danger-2) 100%);
}

.wccs-balance-credit {
    background: linear-gradient(135deg, var(--wccs-c-success) 0%, var(--wccs-c-success-2) 100%);
}

.wccs-balance-zero {
    background: linear-gradient(135deg, var(--wccs-c-primary) 0%, var(--wccs-c-primary-2) 100%);
}

.wccs-customer-hero-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.wccs-hero-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.wccs-hero-value {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.wccs-hero-meta {
    font-size: 14px;
    opacity: 0.95;
    margin-top: 4px;
}

.wccs-customer-hero-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.wccs-customer-hero-icon svg {
    width: 40px;
    height: 40px;
    color: #fff;
}

/* ===== INFO / PAYMENT INSTRUCTIONS ===== */
.wccs-customer-info {
    background: var(--wccs-c-soft);
    border: 1px solid var(--wccs-c-border);
    border-radius: var(--wccs-c-radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.wccs-customer-info h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--wccs-c-text);
}

.wccs-customer-info p {
    margin: 0;
    color: var(--wccs-c-muted);
    font-size: 14px;
    line-height: 1.6;
}

.wccs-customer-info ul {
    margin: 8px 0 0;
    padding-left: 20px;
    color: var(--wccs-c-muted);
    font-size: 14px;
    line-height: 1.7;
}

.wccs-customer-info strong {
    color: var(--wccs-c-text);
}

/* ===== SUMMARY CARDS ===== */
.wccs-customer-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.wccs-summary-card {
    background: var(--wccs-c-bg);
    border: 1px solid var(--wccs-c-border);
    border-radius: var(--wccs-c-radius-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wccs-summary-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--wccs-c-shadow-md);
}

.wccs-summary-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--wccs-c-muted);
    font-weight: 600;
}

.wccs-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--wccs-c-text);
    letter-spacing: -0.01em;
}

/* ===== HISTORY ===== */
.wccs-customer-history {
    background: var(--wccs-c-bg);
    border: 1px solid var(--wccs-c-border);
    border-radius: var(--wccs-c-radius);
    padding: 24px;
    box-shadow: var(--wccs-c-shadow);
}

.wccs-customer-history h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--wccs-c-text);
}

.wccs-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--wccs-c-muted);
}

.wccs-empty-state svg {
    width: 56px;
    height: 56px;
    color: var(--wccs-c-border);
    margin-bottom: 12px;
}

.wccs-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ===== TIMELINE ===== */
.wccs-customer-timeline {
    position: relative;
    padding-left: 28px;
}

.wccs-customer-timeline::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--wccs-c-border);
}

.wccs-timeline-item {
    position: relative;
    padding: 16px 0;
    border-bottom: 1px solid var(--wccs-c-border);
}

.wccs-timeline-item:last-child {
    border-bottom: none;
}

.wccs-timeline-dot {
    position: absolute;
    left: -28px;
    top: 18px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--wccs-c-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.wccs-timeline-dot svg {
    width: 12px;
    height: 12px;
    color: var(--wccs-c-primary);
}

.wccs-timeline-debt .wccs-timeline-dot {
    border-color: var(--wccs-c-danger);
    background: #fef2f2;
}

.wccs-timeline-debt .wccs-timeline-dot svg {
    color: var(--wccs-c-danger);
}

.wccs-timeline-payment .wccs-timeline-dot {
    border-color: var(--wccs-c-success);
    background: #ecfdf5;
}

.wccs-timeline-payment .wccs-timeline-dot svg {
    color: var(--wccs-c-success);
}

.wccs-timeline-adjust .wccs-timeline-dot,
.wccs-timeline-refund .wccs-timeline-dot {
    border-color: var(--wccs-c-warning);
    background: #fffbeb;
}

.wccs-timeline-adjust .wccs-timeline-dot svg,
.wccs-timeline-refund .wccs-timeline-dot svg {
    color: var(--wccs-c-warning);
}

.wccs-timeline-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wccs-timeline-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.wccs-timeline-row strong {
    font-size: 15px;
    font-weight: 600;
    color: var(--wccs-c-text);
}

.wccs-timeline-amount {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.wccs-timeline-amount.is-positive {
    color: var(--wccs-c-danger);
}

.wccs-timeline-amount.is-negative {
    color: var(--wccs-c-success);
}

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

.wccs-timeline-meta time {
    color: var(--wccs-c-muted);
}

.wccs-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: var(--wccs-c-soft);
    border: 1px solid var(--wccs-c-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: var(--wccs-c-text);
}

.wccs-timeline-notes {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--wccs-c-muted);
    line-height: 1.5;
}

.wccs-timeline-ref {
    margin: 0;
    font-size: 13px;
    color: var(--wccs-c-muted);
}

.wccs-timeline-ref code {
    background: var(--wccs-c-soft);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--wccs-c-text);
}

.wccs-proof-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--wccs-c-primary);
    text-decoration: none;
    font-weight: 500;
    margin-top: 4px;
}

.wccs-proof-link:hover {
    text-decoration: underline;
}

.wccs-proof-link svg {
    width: 14px;
    height: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .wccs-customer-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px;
        text-align: left;
    }

    .wccs-hero-value {
        font-size: 32px;
    }

    .wccs-customer-hero-icon {
        width: 56px;
        height: 56px;
    }

    .wccs-customer-hero-icon svg {
        width: 28px;
        height: 28px;
    }

    .wccs-customer-summary {
        grid-template-columns: 1fr;
    }

    .wccs-customer-history {
        padding: 16px;
    }

    .wccs-timeline-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ==========================================================================
   Theme override protection
   wc_price() outputs .woocommerce-Price-amount inside <bdi>, which many
   themes style with their link/brand color. We force our own palette
   inside all wccs-customer price containers.
   ========================================================================== */

/* Hero value must be white on the gradient regardless of theme */
.wccs-customer .wccs-hero-value,
.wccs-customer .wccs-hero-value *,
.wccs-customer .wccs-hero-value bdi,
.wccs-customer .wccs-hero-value .woocommerce-Price-amount,
.wccs-customer .wccs-hero-value .woocommerce-Price-currencySymbol {
    color: #ffffff !important;
    text-decoration: none !important;
}

.wccs-customer .wccs-hero-meta,
.wccs-customer .wccs-hero-meta *,
.wccs-customer .wccs-hero-label {
    color: #ffffff !important;
    opacity: 0.95;
}

/* Summary card values use dark text */
.wccs-customer .wccs-summary-value,
.wccs-customer .wccs-summary-value *,
.wccs-customer .wccs-summary-value bdi,
.wccs-customer .wccs-summary-value .woocommerce-Price-amount,
.wccs-customer .wccs-summary-value .woocommerce-Price-currencySymbol {
    color: var(--wccs-c-text) !important;
}

/* Timeline amount inherits red/green from is-positive / is-negative */
.wccs-customer .wccs-timeline-amount.is-positive,
.wccs-customer .wccs-timeline-amount.is-positive *,
.wccs-customer .wccs-timeline-amount.is-positive bdi,
.wccs-customer .wccs-timeline-amount.is-positive .woocommerce-Price-amount,
.wccs-customer .wccs-timeline-amount.is-positive .woocommerce-Price-currencySymbol {
    color: var(--wccs-c-danger) !important;
}

.wccs-customer .wccs-timeline-amount.is-negative,
.wccs-customer .wccs-timeline-amount.is-negative *,
.wccs-customer .wccs-timeline-amount.is-negative bdi,
.wccs-customer .wccs-timeline-amount.is-negative .woocommerce-Price-amount,
.wccs-customer .wccs-timeline-amount.is-negative .woocommerce-Price-currencySymbol {
    color: var(--wccs-c-success) !important;
}

/* Strip the theme's underline/background on any prices inside our panel */
.wccs-customer bdi {
    background: transparent !important;
    text-decoration: none !important;
}
