/* ═══════════════════════════════════════════════════════════════
   RedirectPro — Dark Admin Theme
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg: #0a0a0f;
    --bg-card: #12121f;
    --bg-card-alt: #16162a;
    --bg-input: #0d0d18;
    --border: #1e1e32;
    --border-light: #2a2a3e;
    --text: #e0e0e8;
    --text-muted: #666;
    --text-dim: #444;
    --purple: #6366f1;
    --purple-light: #a78bfa;
    --purple-glow: rgba(99, 102, 241, 0.15);
    --green: #22c55e;
    --red: #ef4444;
    --amber: #f59e0b;
    --pink: #ec4899;
    --cyan: #06b6d4;
    --violet: #8b5cf6;
    --radius: 12px;
    --radius-sm: 8px;
    --font-display: 'Outfit', -apple-system, sans-serif;
    --font-mono: 'Space Mono', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-display);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a5e; }

/* ─── Login ──────────────────────────────────────────────────── */
.login-body {
    background: linear-gradient(135deg, #0a0a0f 0%, #12121f 50%, #0a0a0f 100%);
    min-height: 100vh;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-card-alt));
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 52px 44px;
    width: 400px;
    max-width: 100%;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.04);
    animation: fadeUp 0.6s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 48px;
    margin-bottom: 8px;
    animation: pulse-glow 3s ease-in-out infinite;
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--purple), var(--violet), var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.login-sub {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 4px;
    font-family: var(--font-mono);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

/* ─── Header ─────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 28px;
}

.logo {
    font-size: 20px;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--purple-light);
}

.logo span {
    background: linear-gradient(135deg, var(--purple), var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-tabs {
    display: flex;
    gap: 4px;
}

.nav-tab {
    padding: 8px 18px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-display);
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--text);
    background: rgba(255,255,255,0.03);
}

.nav-tab.active {
    background: var(--purple-glow);
    color: var(--purple-light);
    border-color: rgba(99, 102, 241, 0.3);
}

.header-right {
    display: flex;
    gap: 8px;
}

/* ─── Main ───────────────────────────────────────────────────── */
.main {
    padding: 28px 32px;
    max-width: 1280px;
    margin: 0 auto;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-card-alt));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    animation: fadeUp 0.3s ease;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Stat Grid ──────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    border-radius: 16px;
    padding: 24px;
    border: 1px solid;
}

.stat-purple { background: rgba(99,102,241,0.06); border-color: rgba(99,102,241,0.15); }
.stat-green { background: rgba(34,197,94,0.06); border-color: rgba(34,197,94,0.15); }
.stat-amber { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.15); }
.stat-pink { background: rgba(236,72,153,0.06); border-color: rgba(236,72,153,0.15); }
.stat-cyan { background: rgba(6,182,212,0.06); border-color: rgba(6,182,212,0.15); }
.stat-violet { background: rgba(139,92,246,0.06); border-color: rgba(139,92,246,0.15); }

.stat-num {
    font-size: 36px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -2px;
}

.stat-purple .stat-num { color: var(--purple); }
.stat-green .stat-num { color: var(--green); }
.stat-amber .stat-num { color: var(--amber); }
.stat-pink .stat-num { color: var(--pink); }
.stat-cyan .stat-num { color: var(--cyan); }
.stat-violet .stat-num { color: var(--violet); }

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 10px;
    font-weight: 600;
}

/* ─── Country Bars ───────────────────────────────────────────── */
.country-bars { display: flex; flex-direction: column; gap: 10px; }

.country-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.country-flag { font-size: 20px; width: 30px; text-align: center; }
.country-name { font-size: 13px; color: #aaa; width: 110px; }

.bar-track {
    flex: 1;
    height: 28px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--purple-light));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    min-width: 32px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-value {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    font-family: var(--font-mono);
}

/* ─── Country Grid ───────────────────────────────────────────── */
.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.country-tile {
    background: rgba(99,102,241, calc(var(--intensity) * 0.003));
    border: 1px solid rgba(99,102,241, 0.12);
    border-radius: 12px;
    padding: 18px 12px;
    text-align: center;
    transition: transform 0.2s;
}

.country-tile:hover { transform: translateY(-2px); }
.tile-flag { font-size: 28px; }
.tile-name { font-size: 11px; color: #aaa; margin-top: 6px; }
.tile-count { font-size: 22px; font-weight: 900; color: var(--purple-light); margin-top: 4px; font-family: var(--font-mono); }

/* ─── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 5px;
}

.table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
}

.table td {
    padding: 14px 16px;
    background: var(--bg-input);
    font-size: 13px;
    vertical-align: middle;
}

.table tbody tr td:first-child { border-radius: 10px 0 0 10px; }
.table tbody tr td:last-child { border-radius: 0 10px 10px 0; }

.table tbody tr {
    transition: transform 0.15s;
}

.table tbody tr:hover { 
    transform: translateX(2px);
}

.table tbody tr:hover td {
    background: rgba(99,102,241,0.05);
}

/* ─── Link Cards ─────────────────────────────────────────────── */
.link-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.link-info { flex: 1; min-width: 0; }

.link-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.link-name {
    font-size: 17px;
    font-weight: 700;
}

.link-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.slug-display {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--purple-light);
    background: rgba(99,102,241,0.08);
    padding: 6px 12px;
    border-radius: 6px;
    word-break: break-all;
    border: 1px solid rgba(99,102,241,0.15);
}

.btn-copy {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.4);
    transform: scale(1.05);
}

.btn-copy:active {
    transform: scale(0.95);
}

.optional-hint {
    font-size: 10px;
    color: var(--text-dim);
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.link-target {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    word-break: break-all;
}

.link-meta {
    font-size: 12px;
    color: var(--text-dim);
}

.link-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

.link-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Badges & Tags ──────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-family: var(--font-mono);
}

.badge-green { background: rgba(34,197,94,0.12); color: var(--green); }
.badge-red { background: rgba(239,68,68,0.12); color: var(--red); }
.badge-cyan { background: rgba(6,182,212,0.12); color: var(--cyan); }
.badge-gray { background: rgba(102,102,102,0.12); color: #888; }
.badge-amber { background: rgba(245,158,11,0.12); color: var(--amber); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--purple-glow);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 6px;
    font-size: 11px;
    color: var(--purple-light);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-green { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,0.4); }
.dot-red { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,0.4); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-display);
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--purple), var(--violet));
    color: #fff;
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

.btn-ghost:hover { color: var(--text); border-color: #3a3a5e; }

.btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover { background: rgba(239,68,68,0.08); }

.btn-sm { padding: 8px 14px; font-size: 12px; }

.btn-full { width: 100%; justify-content: center; }

.arrow { transition: transform 0.2s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11px;
    color: #888;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 700;
}

.input, .select {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-display);
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.input:focus, .select:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.select { cursor: pointer; }

.form-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
    font-family: var(--font-mono);
}

.form-hint code {
    color: var(--text-muted);
    font-size: 11px;
}

.form-hint span { color: var(--purple-light); }

/* ─── Section Header ─────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 800;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-actions .select {
    width: auto;
    min-width: 180px;
}

/* ─── Geo Form ───────────────────────────────────────────────── */
.geo-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.geo-row .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.geo-row .flex-2 { flex: 2; }

.geo-modal-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: 10px;
    border: 1px solid var(--border);
    animation: fadeUp 0.2s ease;
}

.geo-modal-row .select { flex: 0 0 180px; }
.geo-modal-row .input { flex: 1; }

/* ─── Modals ─────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
}

.modal.show { display: flex; align-items: center; justify-content: center; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(8px);
}

.modal-box {
    position: relative;
    background: linear-gradient(145deg, #14141f, #1a1a2e);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 36px;
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 32px 100px rgba(0,0,0,0.6);
    animation: modalIn 0.3s ease;
}

.modal-wide { width: 620px; }

.modal-box h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 52px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ─── Alert ──────────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    color: var(--red);
}

/* ─── Toast ──────────────────────────────────────────────────── */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-display);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.toast.show { transform: translateX(0); }

.toast-success {
    background: #1a2e1a;
    border: 1px solid #2a4a2a;
    color: #4ade80;
}

.toast-warn {
    background: #2e1a0a;
    border: 1px solid #4a2a0a;
    color: #fb923c;
}

.toast-error {
    background: #2e0a0a;
    border: 1px solid #4a0a0a;
    color: #f87171;
}

/* ─── Tab Content ────────────────────────────────────────────── */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeUp 0.3s ease;
}

/* ─── Utilities ──────────────────────────────────────────────── */
.text-purple { color: var(--purple-light); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.fw-600 { font-weight: 600; }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(99,102,241,0.3)); }
    50% { filter: drop-shadow(0 0 20px rgba(99,102,241,0.6)); }
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        padding: 16px 20px;
    }

    .header-left {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .nav-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .main { padding: 20px 16px; }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .link-card-top {
        flex-direction: column;
    }

    .link-actions {
        align-self: flex-end;
    }

    .geo-row {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .geo-modal-row {
        flex-direction: column;
    }

    .geo-modal-row .select,
    .geo-modal-row .input {
        flex: auto;
        width: 100%;
    }
}
