/* ==========================================================================
   CAV Referral — Styles
   ========================================================================== */

/* ── Page Mon Compte : Parrainage ────────────────────────────────────── */

.cav-referral-account {
    max-width: 720px;
}

.cav-referral-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

.cav-referral-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.cav-referral-card__header p {
    margin: 0 0 16px;
    color: #666;
    font-size: 14px;
}

/* Code display */
.cav-referral-code-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.cav-referral-code-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #2e7d32;
    font-family: monospace;
    background: #f0f7f0;
    padding: 12px 24px;
    border-radius: 8px;
    border: 2px dashed #2e7d32;
    user-select: all;
}

.cav-referral-offer {
    font-size: 15px;
    color: #555;
    margin: 0;
}

/* Boutons */
.cav-referral-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    text-decoration: none;
    line-height: 1;
}

.cav-referral-btn--copy {
    background: #2e7d32;
    color: #fff;
}

.cav-referral-btn--copy:hover {
    background: #1b5e20;
}

.cav-referral-btn--copy.copied {
    background: #66bb6a;
}

.cav-referral-btn--email {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.cav-referral-btn--email:hover {
    background: #eee;
    color: #333;
    text-decoration: none;
}

/* Stats */
.cav-referral-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.cav-referral-stat {
    text-align: center;
    padding: 16px;
    background: #fafafa;
    border-radius: 8px;
}

.cav-referral-stat__value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 4px;
}

.cav-referral-stat__label {
    font-size: 13px;
    color: #888;
}

/* Share */
.cav-referral-share-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* Table historique */
.cav-referral-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

.cav-referral-table th,
.cav-referral-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.cav-referral-table th {
    font-weight: 600;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cav-referral-table tbody tr:hover {
    background: #fafafa;
}

/* Status badges */
.cav-referral-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.cav-referral-status--credited {
    background: #e8f5e9;
    color: #2e7d32;
}

.cav-referral-status--pending {
    background: #fff3e0;
    color: #e65100;
}

.cav-referral-empty {
    color: #999;
    font-style: italic;
    padding: 20px 0;
}

/* Conditions */
.cav-referral-rules {
    margin: 12px 0 0;
    padding-left: 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.8;
}

.cav-referral-rules li {
    margin-bottom: 4px;
}

/* ── Checkout : Champ code parrain ───────────────────────────────────── */

.cav-referral-checkout-field {
    background: #f8fdf8;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.cav-referral-checkout-field h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.cav-referral-description {
    margin: 0 0 12px;
    font-size: 14px;
    color: #666;
}

.cav-referral-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.cav-referral-input-group input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    max-width: 240px;
}

.cav-referral-input-group input[type="text"]:focus {
    border-color: #2e7d32;
    outline: none;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

.cav-referral-input-group input[readonly] {
    background: #f0f0f0;
    color: #666;
}

.cav-referral-btn--apply {
    background: #2e7d32;
    color: #fff;
    white-space: nowrap;
}

.cav-referral-btn--apply:hover {
    background: #1b5e20;
}

.cav-referral-btn--apply:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cav-referral-btn--remove {
    background: #f5f5f5;
    color: #c62828;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.cav-referral-btn--remove:hover {
    background: #fce4ec;
}

/* Messages */
.cav-referral-message {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
}

.cav-referral-message--success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.cav-referral-message--error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #f8bbd0;
}

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

@media (max-width: 640px) {
    .cav-referral-stats-grid {
        grid-template-columns: 1fr;
    }

    .cav-referral-code-display {
        flex-direction: column;
        align-items: flex-start;
    }

    .cav-referral-code-value {
        font-size: 22px;
        padding: 10px 18px;
    }

    .cav-referral-input-group {
        flex-direction: column;
    }

    .cav-referral-input-group input[type="text"] {
        max-width: 100%;
    }

    /* Table responsive */
    .cav-referral-table thead {
        display: none;
    }

    .cav-referral-table tbody tr {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }

    .cav-referral-table td {
        display: flex;
        justify-content: space-between;
        padding: 4px 0;
        border: none;
    }

    .cav-referral-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
    }
}

/* ── Sidebar Checkout : Champ code parrain ────────────────────────────── */

.sidebar-checkout__referral-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.sidebar-checkout__referral-row input {
    flex: 1;
    min-width: 0;
}

.sidebar-checkout__referral-row .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.sidebar-checkout__referral-msg {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.sidebar-checkout__referral-msg--ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.sidebar-checkout__referral-msg--error {
    background: #fce4ec;
    color: #c62828;
}
