/* ════════════════════════════════════════════════════════════
   affiliate.css — affiliate partner portal styles
   ════════════════════════════════════════════════════════════ */

/* ── Variables & reset ──────────────────────────────────── */
:root {
    --sidebar-w:     220px;
    --sidebar-bg:    #0f2027;
    --sidebar-text:  #8db5c4;
    --sidebar-hover: rgba(255,255,255,.06);
    --accent:        #0fa68e;
    --accent-light:  #12c4a8;
    --topbar-h:      50px;
    --page-bg:       #f0f4f5;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--page-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #212529;
}

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 300;
    overflow-y: auto;
    transition: transform .25s ease;
}

.sb-brand {
    padding: 18px 20px 16px;
    display: block;
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.sb-brand span { color: var(--accent-light); }

.sb-section {
    padding: 18px 20px 5px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(255,255,255,.25);
    font-weight: 600;
}

.sb-nav { flex: 1; padding: 6px 0; }

.sb-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s;
}
.sb-nav a:hover  { background: var(--sidebar-hover); color: #fff; }
.sb-nav a.active { color: #fff; border-left-color: var(--accent); background: rgba(15,166,142,.15); }
.sb-nav a i      { width: 16px; text-align: center; font-size: 13px; opacity: .75; }

.sb-footer {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.sb-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,.15);
    color: var(--sidebar-text);
    padding: 7px 12px;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.sb-footer a:hover { background: var(--sidebar-hover); color: #fff; }

/* ── Mobile overlay ─────────────────────────────────────── */
#sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 250;
}
#sb-overlay.visible { display: block; }

/* ── Main wrapper ───────────────────────────────────────── */
#main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

/* ── Topbar ─────────────────────────────────────────────── */
#topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    gap: 14px;
}

#sb-toggle {
    display: none;
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--sidebar-text);
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}
#sb-toggle:hover { color: #fff; }

#topbar .breadcrumb {
    background: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
}
#topbar .breadcrumb-item                        { color: #fff !important; }
#topbar .breadcrumb-item + .breadcrumb-item::before { color: var(--sidebar-text) !important; }

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}
.topbar-user {
    color: var(--sidebar-text);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.topbar-user i { font-size: 16px; }

/* ── Content ────────────────────────────────────────────── */
#content {
    flex: 1;
    padding: 24px;
}

.subheader {
    font-size: 18px;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 20px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 1px 10px rgba(0,0,0,.04);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #e8ecef;
    border-radius: 8px 8px 0 0 !important;
    padding: 13px 18px;
    font-weight: 600;
    font-size: 13.5px;
    color: #333;
}
.card-header i { color: var(--accent); margin-right: 6px; }
.card-body { padding: 18px; border-radius: 0 0 8px 8px; background: #fff; }

/* ── KPI cards ─────────────────────────────────────────── */
.kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 1px 10px rgba(0,0,0,.04);
    border-left: 4px solid transparent;
}
.kpi-card.kpi-primary { border-left-color: var(--accent); }
.kpi-card.kpi-success { border-left-color: #22c55e; }
.kpi-card.kpi-warning { border-left-color: #f59e0b; }
.kpi-card.kpi-info    { border-left-color: #6366f1; }

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.kpi-primary .kpi-icon { background: rgba(15,166,142,.1); color: var(--accent); }
.kpi-success .kpi-icon { background: rgba(34,197,94,.1); color: #22c55e; }
.kpi-warning .kpi-icon { background: rgba(245,158,11,.1); color: #f59e0b; }
.kpi-info .kpi-icon    { background: rgba(99,102,241,.1); color: #6366f1; }

.kpi-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}
.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a2332;
    margin-top: 2px;
}

/* ── Referral link box ─────────────────────────────────── */
.referral-link-box {
    display: flex;
    gap: 8px;
    align-items: center;
}
.referral-link-box code {
    flex: 1;
    background: #f0f4f5;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    word-break: break-all;
    color: #333;
}
.btn-copy {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.btn-copy:hover { background: var(--accent-light); }

/* ── Placeholder / empty states ────────────────────────── */
.placeholder-chart {
    text-align: center;
    padding: 50px 20px;
    color: #aaa;
}
.placeholder-chart i { font-size: 40px; margin-bottom: 10px; display: block; }
.placeholder-chart p { font-size: 13px; }

.empty-state-small {
    text-align: center;
    padding: 30px 10px;
    color: #bbb;
}
.empty-state-small i { font-size: 28px; margin-bottom: 8px; display: block; }
.empty-state-small p { font-size: 12px; margin: 0; }

/* ── Tables ─────────────────────────────────────────────── */
.table thead th {
    background: #f8f9fb;
    border-top: none;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #888;
    font-weight: 600;
}
.table-striped tbody tr:nth-of-type(odd) { background: #fafbfc; }
.table tbody tr:hover { background: #eef8f6 !important; }
.table td, .table th { vertical-align: middle !important; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ── Status badges ──────────────────────────────────────── */
.badge-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.badge-active   { background: #dcfce7; color: #166534; }
.badge-trial    { background: #dbeafe; color: #1e40af; }
.badge-inactive { background: #fef2f2; color: #991b1b; }
.badge-free     { background: #f3f4f6; color: #4b5563; }
.badge-pending  { background: #fef3c7; color: #92400e; }

/* ── Referral table ────────────────────────────────────── */
.ref-table {
    width: 100%;
    border-collapse: collapse;
}
.ref-table thead th {
    background: #f8f9fb;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #888;
    font-weight: 600;
    border-bottom: 2px solid #e8ecef;
    text-align: left;
}
.ref-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13px;
    vertical-align: middle;
}
.ref-table tbody tr:hover { background: #f7faf9; }
.ref-table tbody tr:last-child td { border-bottom: none; }

.ref-num {
    color: #aaa;
    font-weight: 600;
    width: 40px;
}
.ref-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ref-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.ref-user-name {
    font-weight: 600;
    color: #1a2332;
    font-size: 13px;
}
.ref-user-email {
    font-size: 12px;
    color: #888;
    margin-top: 1px;
}
.text-muted { color: #bbb; }

/* ── Conversion stats ──────────────────────────────────── */
.conversion-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f2f5;
}
.conversion-stat:last-child { border-bottom: none; }
.conversion-label {
    font-size: 13px;
    color: #666;
}
.conversion-value {
    font-size: 15px;
    font-weight: 700;
    color: #1a2332;
}

/* ── Table tweaks ──────────────────────────────────────── */
.card-body.p-0 { padding: 0 !important; }

/* ── Profile ────────────────────────────────────────────── */
.profile-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
}
.profile-row:last-child { border-bottom: none; }
.profile-label {
    width: 140px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   Login page
   ════════════════════════════════════════════════════════════ */
.login-page {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.login-logo i {
    font-size: 28px;
    color: #fff;
}
.login-brand h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a2332;
}
.login-brand h1 span { color: var(--accent); }
.login-brand p {
    margin: 4px 0 0;
    font-size: 13px;
    color: #888;
}

.login-form .form-group {
    margin-bottom: 18px;
}
.login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.input-icon {
    position: relative;
}
.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 14px;
}
.input-icon input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.input-icon input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15,166,142,.12);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: opacity .15s, transform .1s;
}
.btn-login:hover { opacity: .92; }
.btn-login:active { transform: scale(.98); }

.login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: rgba(255,255,255,.4);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); }
    #main { margin-left: 0; }
    #sb-toggle { display: block; }

    .login-card { padding: 30px 24px 28px; }

    .kpi-card { padding: 14px; gap: 12px; }
    .kpi-icon { width: 40px; height: 40px; font-size: 17px; }
    .kpi-value { font-size: 20px; }

    .referral-link-box { flex-direction: column; }
    .banner-grid { grid-template-columns: 1fr !important; }
    .banner-card-wide { grid-column: span 1 !important; }
}

/* ── Language switcher ────────────────────────────────── */
.lang-switcher {
    display: flex;
    gap: 4px;
}
.lang-switcher a {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: var(--sidebar-text);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 4px;
    transition: all .2s;
}
.lang-switcher a:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.lang-switcher a.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.flag-icon {
    margin-right: 2px;
}
.login-lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 4px;
}
.login-lang-switcher a {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255,255,255,.6);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 4px;
    transition: all .2s;
}
.login-lang-switcher a:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.login-lang-switcher a.active {
    background: rgba(255,255,255,.2);
    color: #fff;
    border-color: rgba(255,255,255,.4);
}

/* ── Banner grid ─────────────────────────────────────── */
.banner-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.banner-card {
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 1px 10px rgba(0,0,0,.04);
    overflow: hidden;
    background: #fff;
}
.banner-card-wide {
    grid-column: span 2;
}
.banner-card .card-header {
    display: flex;
    align-items: center;
    gap: 6px;
}
.banner-size {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    letter-spacing: .03em;
}
.banner-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8f9fb;
    min-height: 120px;
}
.banner-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
.banner-actions {
    display: flex;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid #e8ecef;
}
.btn-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    background: var(--accent);
    color: #fff;
}
.btn-banner:hover { opacity: .88; }
.btn-banner-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-banner-outline:hover {
    background: rgba(15,166,142,.08);
    opacity: 1;
}

/* ── Banner section titles ──────────────────────────────── */
.banner-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #1a2332;
    margin: 28px 0 14px;
}
.banner-section-title:first-of-type { margin-top: 0; }
.banner-size-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    background: #f0f2f5;
    padding: 2px 10px;
    border-radius: 10px;
    letter-spacing: .03em;
}

/* ── Embed code block ───────────────────────────────────── */
.banner-embed-section {
    border-top: 1px solid #e8ecef;
}
.embed-code-block {
    padding: 0 18px 14px;
}
.embed-code-block label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}
.embed-textarea {
    width: 100%;
    background: #f5f7f9;
    border: 1px solid #e0e4e8;
    border-radius: 6px;
    padding: 10px 12px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 11.5px;
    color: #444;
    resize: vertical;
    line-height: 1.5;
    cursor: text;
}
.embed-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(15,166,142,.12);
}

/* ── Settings form ───────────────────────────────────── */
.settings-hint {
    font-size: 13px;
    color: #888;
    margin: 0 0 20px;
}
.settings-form .form-group {
    margin-bottom: 16px;
}
.settings-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.settings-form input[type="text"],
.settings-form input[type="email"] {
    width: 100%;
    max-width: 420px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.settings-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15,166,142,.12);
}
.settings-section-label {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}
.settings-divider {
    border-top: 1px solid #e8ecef;
    margin: 20px 0;
}
.btn-save {
    padding: 10px 28px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity .15s;
}
.btn-save:hover { opacity: .9; }
