/**
 * AffiliateEngine — Frontend Styles
 *
 * Clean, modern CSS for the affiliate area shortcodes.
 * Uses CSS custom properties for easy theming.
 */

:root {
    --ae-primary: #4f46e5;
    --ae-primary-hover: #4338ca;
    --ae-success: #059669;
    --ae-warning: #d97706;
    --ae-error: #dc2626;
    --ae-text: #1f2937;
    --ae-text-light: #6b7280;
    --ae-border: #e5e7eb;
    --ae-bg: #ffffff;
    --ae-bg-subtle: #f9fafb;
    --ae-radius: 8px;
    --ae-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ── Layout ────────────────────────────────────────────── */

.ae-affiliate-area {
    max-width: 960px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ae-text);
}

/* ── Tabs ──────────────────────────────────────────────── */

.ae-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid var(--ae-border);
    margin-bottom: 24px;
}

.ae-tab {
    padding: 10px 18px;
    text-decoration: none;
    color: var(--ae-text-light);
    font-weight: 500;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.ae-tab:hover {
    color: var(--ae-primary);
}

.ae-tab-active {
    color: var(--ae-primary);
    border-bottom-color: var(--ae-primary);
}

/* ── Stats Grid ────────────────────────────────────────── */

.ae-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.ae-stat-card {
    background: var(--ae-bg);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--ae-shadow);
}

.ae-stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ae-text-light);
}

.ae-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--ae-text);
}

/* ── Copy Field ────────────────────────────────────────── */

.ae-copy-field {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ae-copy-field input[type="text"],
.ae-copy-field input[type="url"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    font-size: 14px;
    background: var(--ae-bg-subtle);
    color: var(--ae-text);
}

/* ── Buttons ───────────────────────────────────────────── */

.ae-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--ae-primary);
    color: #fff;
    border: none;
    border-radius: var(--ae-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.ae-btn:hover {
    background: var(--ae-primary-hover);
    color: #fff;
}

.ae-btn-primary {
    background: var(--ae-primary);
}

.ae-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ── Tables ────────────────────────────────────────────── */

.ae-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 24px;
}

.ae-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--ae-bg-subtle);
    border-bottom: 2px solid var(--ae-border);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ae-text-light);
}

.ae-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ae-border);
    color: var(--ae-text);
}

.ae-table tbody tr:hover {
    background: var(--ae-bg-subtle);
}

/* ── Status Badges ─────────────────────────────────────── */

.ae-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.ae-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.ae-status-approved,
.ae-status-active,
.ae-status-completed {
    background: #d1fae5;
    color: #065f46;
}

.ae-status-rejected,
.ae-status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.ae-status-paid {
    background: #dbeafe;
    color: #1e40af;
}

.ae-status-processing {
    background: #ede9fe;
    color: #5b21b6;
}

/* ── Notices ───────────────────────────────────────────── */

.ae-notice {
    padding: 14px 20px;
    border-radius: var(--ae-radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.ae-notice-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.ae-notice-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.ae-notice-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ── Forms ─────────────────────────────────────────────── */

.ae-registration-form,
.ae-login-form,
.ae-settings-form,
.ae-url-generator {
    max-width: 480px;
}

.ae-registration-form label,
.ae-settings-form label,
.ae-url-generator label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--ae-text);
}

.ae-registration-form input[type="text"],
.ae-registration-form input[type="email"],
.ae-registration-form textarea,
.ae-settings-form input[type="text"],
.ae-settings-form input[type="email"],
.ae-settings-form select,
.ae-url-generator input[type="text"],
.ae-url-generator input[type="url"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    font-size: 14px;
    margin-bottom: 16px;
    background: var(--ae-bg);
    color: var(--ae-text);
    transition: border-color 0.15s;
}

.ae-registration-form input:focus,
.ae-settings-form input:focus,
.ae-settings-form select:focus,
.ae-url-generator input:focus {
    outline: none;
    border-color: var(--ae-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.ae-registration-form textarea {
    resize: vertical;
    min-height: 80px;
}

.ae-registration-form .required {
    color: var(--ae-error);
}

/* ── Creatives Grid ────────────────────────────────────── */

.ae-creatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.ae-creative-card {
    background: var(--ae-bg);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    padding: 16px;
    box-shadow: var(--ae-shadow);
}

.ae-creative-card img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 12px;
}

.ae-creative-card h4 {
    margin: 0 0 8px;
    font-size: 16px;
}

.ae-creative-card p {
    font-size: 13px;
    color: var(--ae-text-light);
    margin: 0 0 12px;
}

/* ── Quick Link ────────────────────────────────────────── */

.ae-quick-link {
    margin-top: 24px;
}

.ae-quick-link label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

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

@media (max-width: 640px) {
    .ae-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ae-tabs {
        gap: 0;
    }

    .ae-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    .ae-stat-value {
        font-size: 18px;
    }

    .ae-copy-field {
        flex-direction: column;
    }

    .ae-copy-field input {
        width: 100%;
    }
}
