/* Note: This file uses standalone colors. Consider adopting shared design tokens from premium-shared.css in future. */

/**
 * Affiliate Plugin — Admin Stylesheet
 *
 * Replaces all inline style="" attributes previously scattered through
 * class-affiliate-admin.php. Enqueued via STRP_SUB_Affiliate_Admin::enqueue_admin_scripts().
 */

/* ---------------------------------------------------------------
   Search / filter bar card
   --------------------------------------------------------------- */
.strp-sub-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.strp-sub-card-blue {
    background: #fff;
    border: 1px solid #c8e1ff;
    border-left-width: 4px;
    padding: 20px 25px;
    margin: 20px 0;
    border-radius: 4px;
}

.strp-sub-card-blue h2 {
    margin-top: 0;
}

.strp-sub-card-blue p {
    color: #555;
}

/* ---------------------------------------------------------------
   Search form
   --------------------------------------------------------------- */
.strp-sub-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.strp-sub-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ---------------------------------------------------------------
   Create affiliate / settings form containers
   --------------------------------------------------------------- */
.strp-sub-form-wrap {
    max-width: 600px;
}

.strp-sub-settings-form-wrap {
    max-width: 800px;
}

/* ---------------------------------------------------------------
   Summary stats grid
   --------------------------------------------------------------- */
.strp-sub-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .strp-sub-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 782px) {
    .strp-sub-stats-grid { grid-template-columns: 1fr; }
}

.strp-sub-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    /* border-left colour is set via a data attribute and JS, or via modifier classes below */
    border-left: 4px solid #ccc;
}

.strp-sub-stat-card--blue   { border-left-color: #2271b1; }
.strp-sub-stat-card--green  { border-left-color: #00a32a; }
.strp-sub-stat-card--red    { border-left-color: #d63638; }
.strp-sub-stat-card--purple { border-left-color: #8444F9; }

.strp-sub-stat-card h3 {
    margin: 0 0 10px;
    color: #666;
    font-size: 14px;
}

.strp-sub-stat-card p {
    font-size: 32px;
    font-weight: bold;
    margin: 0;
}

.strp-sub-stat-card--blue   p { color: #2271b1; }
.strp-sub-stat-card--green  p { color: #00a32a; }
.strp-sub-stat-card--red    p { color: #d63638; }
.strp-sub-stat-card--purple p { color: #8444F9; }

/* ---------------------------------------------------------------
   Affiliate table helpers
   --------------------------------------------------------------- */
.strp-sub-col-code   { width: 150px; }
.strp-sub-col-narrow { width: 80px; }

.strp-sub-sortable-link {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
}

.strp-sub-code-display {
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
    color: #2271b1;
}

.strp-sub-edit-code-btn {
    margin-left: 8px;
}

.strp-sub-code-edit-form {
    display: none;
}

.strp-sub-code-input {
    width: 100px;
    text-transform: uppercase;
    font-family: monospace;
}

.strp-sub-full-width { width: 100%; }

.strp-sub-centered { text-align: center; }

.strp-sub-empty-row {
    text-align: center;
    padding: 40px;
    color: #666;
}

.strp-sub-muted { color: #999; }

.strp-sub-trial-count {
    color: #ffc107;
    font-weight: bold;
    font-size: 16px;
}

.strp-sub-referrals-btn {
    background: none;
    border: none;
    color: #2271b1;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    text-decoration: underline;
}

.strp-sub-export-btn {
    margin-top: 20px;
}

/* ---------------------------------------------------------------
   Inline field widths
   --------------------------------------------------------------- */
.strp-sub-input-number-sm { width: 120px; }
.strp-sub-input-percent   { width: 100px; }

/* ---------------------------------------------------------------
   Settings page — Danger Zone label
   --------------------------------------------------------------- */
.strp-sub-danger-label {
    color: #d63638;
    font-weight: 600;
}

/* ---------------------------------------------------------------
   Payout modal
   --------------------------------------------------------------- */
.strp-sub-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, .7);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

/* JS sets display:flex when open */
.strp-sub-modal-overlay.is-open {
    display: flex;
}

.strp-sub-modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
}

.strp-sub-modal-box h2 {
    margin-top: 0;
}

.strp-sub-modal-input {
    width: 100%;
    padding: 8px;
}

.strp-sub-modal-input--readonly {
    background: #f5f5f5;
    font-size: 16px;
}

.strp-sub-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ---------------------------------------------------------------
   AJAX notice placeholder
   --------------------------------------------------------------- */
#strp-sub-admin-notice {
    display: none;
}

/* RTL Support */
[dir="rtl"] .strp-sub-admin-card {
    border-left: none;
    border-right: 4px solid #2271b1;
}

[dir="rtl"] .strp-sub-summary-card {
    border-left: none;
    border-right: 3px solid #2271b1;
}

[dir="rtl"] .strp-sub-admin-table th,
[dir="rtl"] .strp-sub-admin-table td {
    text-align: right;
}

[dir="rtl"] .strp-sub-search-form {
    flex-direction: row-reverse;
}

.strp-sub-chart-empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 40px 0;
}

/* Accessibility: Focus styles (WCAG 2.1 AA) */
.strp-sub-edit-code-btn:focus-visible,
.strp-sub-save-code-btn:focus-visible,
.strp-sub-cancel-code-btn:focus-visible,
.strp-sub-payout-btn:focus-visible,
.strp-sub-modal-box *:focus-visible,
#strp-sub-export-affiliates:focus-visible,
#strp-sub-export-payout-history:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}
