/* WC Affiliate Commissions – Frontend Panel */

.wcaff-panel {
    font-family: inherit;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.wcaff-panel__header {
    margin-bottom: 24px;
}

.wcaff-panel__header h2 {
    font-size: 22px;
    margin-bottom: 14px;
}

.wcaff-panel__totals {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.wcaff-total-card {
    flex: 1;
    min-width: 160px;
    max-width: 220px;
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.wcaff-total-card--pending {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
}

.wcaff-total-card--paid {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
}

.wcaff-total-card__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #555;
}

.wcaff-total-card__value {
    font-size: 22px;
    font-weight: 800;
    color: #111;
}

/* ── Month tabs ──────────────────────────────────────────────────────── */
.wcaff-panel__months {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.wcaff-month-tab {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #ddd;
    text-decoration: none;
    font-size: 13px;
    color: #555;
    background: #fff;
    transition: all .15s ease;
}

.wcaff-month-tab:hover {
    border-color: #7c3aed;
    color: #7c3aed;
    background: #f5f3ff;
}

.wcaff-month-tab--active {
    background: #7c3aed;
    color: #fff !important;
    border-color: #7c3aed;
}

/* ── Month summary ───────────────────────────────────────────────────── */
.wcaff-panel__month-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid #eee;
}

/* ── Table ───────────────────────────────────────────────────────────── */
.wcaff-panel__table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid #eee;
}

.wcaff-panel__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}

.wcaff-panel__table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #555;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}

.wcaff-panel__table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.wcaff-panel__table tr:last-child td {
    border-bottom: none;
}

.wcaff-panel__table tr:hover td {
    background: #fafafa;
}

.wcaff-panel__table code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    letter-spacing: .5px;
}

.wcaff-panel__table a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 600;
}

/* ── Badges (reuse admin logic) ──────────────────────────────────────── */
.wcaff-badge {
    display: inline-flex;
    align-items: center;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.wcaff-badge--paid    { background: #d4edda; color: #155724; }
.wcaff-badge--pending { background: #fff3cd; color: #856404; }
.wcaff-badge--cancelled { background: #f8d7da; color: #721c24; }

.wcaff-badge small {
    font-weight: 400;
    font-size: 10px;
    opacity: .8;
}

.wcaff-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e9ecef;
    white-space: nowrap;
}

/* ── Empty state ─────────────────────────────────────────────────────── */
.wcaff-panel__empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #fafafa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .wcaff-panel__totals {
        flex-direction: column;
    }
    .wcaff-total-card {
        max-width: 100%;
    }
    .wcaff-panel__month-summary {
        flex-direction: column;
        gap: 6px;
    }
}

/* ── Payout bar ───────────────────────────────────────────────────────── */
.wcaff-payout-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    padding: 14px 20px;
    margin-top: 16px;
}

.wcaff-payout-bar__text {
    font-size: 15px;
    color: #4c1d95;
}

.wcaff-payout-btn {
    background: #7c3aed;
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .1s;
    white-space: nowrap;
}

.wcaff-payout-btn:hover {
    background: #6d28d9;
    transform: translateY(-1px);
}

/* ── Payout modal overlay ────────────────────────────────────────────── */
.wcaff-payout-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wcaff-payout-overlay.is-open {
    display: flex;
}

.wcaff-payout-modal {
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    animation: wcaff-modal-in .2s ease;
}

@keyframes wcaff-modal-in {
    from { transform: translateY(-16px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.wcaff-payout-modal__icon {
    font-size: 40px;
    display: block;
    text-align: center;
    margin-bottom: 10px;
}

.wcaff-payout-modal__title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 10px;
    color: #111827;
}

.wcaff-payout-modal__intro {
    font-size: 14px;
    color: #4b5563;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ── Invoice data box ────────────────────────────────────────────────── */
.wcaff-invoice-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.wcaff-invoice-row {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    align-items: flex-start;
}

.wcaff-invoice-row:last-child {
    border-bottom: none;
}

.wcaff-invoice-row--highlight {
    background: #f0fdf4;
}

.wcaff-invoice-row--note {
    background: #fffbeb;
}

.wcaff-invoice-label {
    font-weight: 600;
    color: #6b7280;
    min-width: 110px;
    flex-shrink: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    padding-top: 2px;
}

.wcaff-invoice-value {
    color: #111827;
    font-weight: 500;
    line-height: 1.5;
}

.wcaff-invoice-value a {
    color: #7c3aed;
    font-weight: 700;
    text-decoration: none;
}

.wcaff-invoice-value a:hover {
    text-decoration: underline;
}

/* ── Modal close button ──────────────────────────────────────────────── */
.wcaff-payout-modal__close {
    display: block;
    width: 100%;
    padding: 11px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.wcaff-payout-modal__close:hover {
    background: #e5e7eb;
}

@media (max-width: 480px) {
    .wcaff-payout-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .wcaff-payout-btn {
        width: 100%;
        text-align: center;
    }
    .wcaff-payout-modal {
        padding: 24px 18px;
    }
    .wcaff-invoice-label {
        min-width: 80px;
    }
}
