/* ─────────────────────────────────────────────────────────────────────────
   TrimURL — Premium URL Shortener Styles
   ───────────────────────────────────────────────────────────────────────── */

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure [hidden] always wins over any display property set by a class rule */
[hidden] { display: none !important; }

:root {
    --bg:           #09090f;
    --surface:      #111120;
    --surface2:     #1a1a2e;
    --border:       rgba(255,255,255,0.07);
    --border-hover: rgba(124,58,237,0.5);
    --primary:      #7c3aed;
    --primary-light:#a78bfa;
    --primary-glow: rgba(124,58,237,0.35);
    --accent:       #06b6d4;
    --text:         #e2e8f0;
    --text-muted:   #94a3b8;
    --text-dim:     #64748b;
    --success:      #10b981;
    --error:        #f43f5e;
    --radius:       16px;
    --radius-sm:    10px;
    --radius-lg:    24px;
    --shadow:       0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow:  0 0 40px rgba(124,58,237,0.25);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── Animated BG Orbs ──────────────────────────────────────────────────── */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: float 12s ease-in-out infinite;
}
.orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #7c3aed, transparent);
    top: -200px; left: -150px;
    animation-delay: 0s;
}
.orb-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #06b6d4, transparent);
    bottom: -100px; right: -100px;
    animation-delay: 4s;
}
.orb-3 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #ec4899, transparent);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 8s;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(30px, -40px) scale(1.05); }
    66%       { transform: translate(-20px, 20px) scale(0.95); }
}

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(9,9,15,0.7);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}
.brand-icon { font-size: 22px; }
.brand-text  { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.btn-nav {
    background: var(--primary-glow);
    color: var(--primary-light) !important;
    border: 1px solid rgba(124,58,237,0.3);
}
.btn-nav:hover { background: var(--primary) !important; color: #fff !important; }

/* ── Card ──────────────────────────────────────────────────────────────── */
.card {
    background: rgba(17,17,32,0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.card:hover {
    border-color: rgba(124,58,237,0.2);
    box-shadow: var(--shadow), var(--shadow-glow);
}

/* ── Hero Section ──────────────────────────────────────────────────────── */
main { position: relative; z-index: 1; }
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 130px 24px 80px;
    max-width: 820px;
    margin: 0 auto;
}
.hero-badge {
    display: inline-block;
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.3);
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 16px;
    border-radius: 99px;
    margin-bottom: 24px;
    letter-spacing: 0.3px;
}
.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -2px;
    margin-bottom: 20px;
}
.gradient-text {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 560px;
    margin-bottom: 48px;
    line-height: 1.7;
}

/* ── Shortener Card ────────────────────────────────────────────────────── */
.shortener-card {
    width: 100%;
    max-width: 720px;
    padding: 32px;
}
.input-group {
    display: flex;
    align-items: center;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 4px 4px 16px;
    gap: 12px;
    transition: border-color 0.25s, box-shadow 0.25s;
    margin-bottom: 12px;
}
.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}
.input-icon { font-size: 18px; flex-shrink: 0; }
.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    padding: 12px 0;
}
.input-group input::placeholder { color: var(--text-dim); }

/* Toggle advanced */
.toggle-advanced {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    margin-bottom: 4px;
    transition: color 0.2s;
}
.toggle-advanced:hover { color: var(--primary-light); }
.toggle-arrow { transition: transform 0.25s; display: inline-block; }
.toggle-arrow.open { transform: rotate(90deg); }

/* Advanced options */
.advanced-opts {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease, opacity 0.3s;
    opacity: 0;
}
.advanced-opts.open {
    max-height: 200px;
    opacity: 1;
    margin-bottom: 16px;
}
.adv-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 12px;
}
.adv-field { display: flex; flex-direction: column; gap: 6px; }
.adv-field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.alias-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.25s;
}
.alias-wrapper:focus-within { border-color: var(--primary); }
.alias-prefix {
    font-size: 12px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.04);
    padding: 10px 10px 10px 12px;
    white-space: nowrap;
    border-right: 1px solid var(--border);
}
.alias-wrapper input,
.adv-field > input[type="datetime-local"] {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.25s;
    width: 100%;
}
.alias-wrapper input {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 10px 12px;
    width: 100%;
}
.adv-field > input:focus { border-color: var(--primary); }

/* Shorten button */
.btn-shorten {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s;
    letter-spacing: 0.3px;
}
.btn-shorten::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}
.btn-shorten:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(124,58,237,0.45); }
.btn-shorten:hover::before { opacity: 1; }
.btn-shorten:active { transform: translateY(0); }
.btn-shorten:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Result panel */
.result-panel {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    animation: slideUp 0.4s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.result-success {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.result-emoji { font-size: 24px; }
.result-label { font-weight: 700; font-size: 18px; }
.result-url-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface2);
    border: 1.5px solid rgba(124,58,237,0.4);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 12px;
}
.result-link {
    flex: 1;
    color: var(--primary-light);
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.result-link:hover { text-decoration: underline; }
.btn-copy {
    flex-shrink: 0;
    background: rgba(124,58,237,0.2);
    border: 1px solid rgba(124,58,237,0.35);
    color: var(--primary-light);
    font-size: 18px;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-copy:hover { background: var(--primary); color: #fff; }
.result-meta {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 16px;
}
.result-original { color: var(--text-muted); word-break: break-all; }
.result-actions { display: flex; gap: 10px; }
.btn-stats {
    background: rgba(6,182,212,0.15);
    border: 1px solid rgba(6,182,212,0.35);
    color: var(--accent);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-stats:hover { background: var(--accent); color: #000; }
.btn-another {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}
.btn-another:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.result-panel.is-duplicate .result-url-row {
    border-color: var(--accent);
}
.result-panel.is-duplicate .result-emoji {
    filter: drop-shadow(0 0 10px var(--accent));
}

/* Error panel */
.error-panel {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 18px;
    background: rgba(244,63,94,0.14);
    border: 1px solid rgba(244,63,94,0.45);
    border-radius: var(--radius-sm);
    color: #fff;           /* bright white — never invisible */
    font-size: 14px;
    line-height: 1.5;
    animation: slideUp 0.3s ease;
}
.error-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Features Section ──────────────────────────────────────────────────── */
.features {
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 24px;
}
.section-title {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 48px;
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.feature-card {
    padding: 28px;
    background: rgba(17,17,32,0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    cursor: default;
}
.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124,58,237,0.35);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 20px rgba(124,58,237,0.1);
}
.feature-icon { font-size: 32px; margin-bottom: 16px; }
.feature-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.feature-card p  { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.feature-card code {
    background: rgba(124,58,237,0.15);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-light);
}

/* ── History Section ───────────────────────────────────────────────────── */
.history {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 100px;
}
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.history-card {
    background: rgba(17,17,32,0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.history-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124,58,237,0.3);
}
.history-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.history-domain {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}
.history-clicks {
    font-size: 12px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.06);
    padding: 3px 9px;
    border-radius: 99px;
}
.history-short {
    color: var(--primary-light);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    word-break: break-all;
}
.history-short:hover { text-decoration: underline; }
.history-original {
    font-size: 12px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.history-date { font-size: 11px; color: var(--text-dim); }
.history-actions { display: flex; gap: 6px; }
.btn-copy-sm, .btn-stats-sm {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s;
    font-family: inherit;
}
.btn-copy-sm:hover { background: rgba(124,58,237,0.2); color: var(--primary-light); border-color: rgba(124,58,237,0.4); }
.btn-stats-sm:hover { background: rgba(6,182,212,0.2); color: var(--accent); border-color: rgba(6,182,212,0.4); }

/* ── Stats Page ────────────────────────────────────────────────────────── */
.stats-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 100px;
}
.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--primary-light); }
.stats-header { padding: 32px; margin-bottom: 24px; }
.stats-title { font-size: 2rem; font-weight: 800; margin-bottom: 16px; letter-spacing: -1px; }
.stats-code {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.stats-short-url {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-light);
    text-decoration: none;
}
.stats-short-url:hover { text-decoration: underline; }
.stats-original {
    font-size: 13px;
    color: var(--text-dim);
    word-break: break-all;
}
.stats-original a { color: var(--text-muted); text-decoration: none; }
.stats-original a:hover { color: var(--text); text-decoration: underline; }
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: rgba(17,17,32,0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: border-color 0.2s;
}
.kpi-card:hover { border-color: rgba(124,58,237,0.35); }
.kpi-icon  { font-size: 28px; margin-bottom: 10px; }
.kpi-value { font-size: 22px; font-weight: 800; margin-bottom: 4px; word-break: break-all; }
.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.chart-card { padding: 28px; }
.chart-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; color: var(--text-muted); }
.no-data { color: var(--text-dim); text-align: center; padding: 40px 0; font-size: 15px; }

/* ── 404 Page ──────────────────────────────────────────────────────────── */
.not-found-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}
.not-found-card {
    text-align: center;
    padding: 60px 48px;
    max-width: 460px;
    width: 100%;
}
.not-found-emoji { font-size: 64px; margin-bottom: 16px; }
.not-found-title { font-size: 96px; font-weight: 900; letter-spacing: -4px; line-height: 1; background: linear-gradient(135deg, var(--primary-light), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 16px; }
.not-found-sub { color: var(--text-muted); font-size: 16px; margin-bottom: 32px; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
    padding: 24px;
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 13px;
}
.footer-sep { color: var(--border); }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface);
    border: 1px solid rgba(16,185,129,0.4);
    color: #6ee7b7;
    padding: 12px 24px;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 600;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero { padding: 100px 16px 60px; }
    .shortener-card { padding: 20px; }
    .adv-row { grid-template-columns: 1fr; }
    .result-actions { flex-direction: column; }
    .btn-stats, .btn-another { text-align: center; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .nav-links { display: none; }
}

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

/* ── Selection ─────────────────────────────────────────────────────────── */
::selection { background: rgba(124,58,237,0.35); color: #fff; }

/* ── Shortener Note ─────────────────────────────────────────────────────── */
.shortener-note {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
    line-height: 1.8;
}
.shortener-note code {
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.2);
    padding: 2px 8px;
    border-radius: 5px;
    color: var(--primary-light);
    font-size: 11px;
    font-family: 'Courier New', monospace;
}
.shortener-note em { font-style: normal; opacity: 0.7; }

/* ═══════════════════════════════════════════════════════════════════════════
   NEW: URL Selector
   ═══════════════════════════════════════════════════════════════════════════ */
.url-selector {
    position: relative;
    margin-bottom: 24px;
}
.selector-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.selector-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(17,17,32,0.9);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    cursor: pointer;
    transition: border-color 0.25s, box-shadow 0.25s;
    user-select: none;
    outline: none;
}
.selector-trigger:hover,
.selector-trigger.open {
    border-color: rgba(124,58,237,0.55);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.selector-favicon  { width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0; }
.item-favicon      { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; }
.selector-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}
.selector-code {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.selector-domain { font-size: 12px; color: var(--text-dim); }
.selector-chevron {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.25s;
    flex-shrink: 0;
    line-height: 1;
}

/* Dropdown panel */
.selector-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: #13132a;
    border: 1.5px solid rgba(124,58,237,0.4);
    border-radius: var(--radius);
    z-index: 200;
    box-shadow: 0 24px 64px rgba(0,0,0,0.65);
    overflow: hidden;
    animation: dropIn 0.2s cubic-bezier(.16,1,.3,1);
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

/* Search bar inside dropdown */
.selector-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}
.selector-search-icon { font-size: 14px; flex-shrink: 0; }
.selector-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.selector-search::placeholder { color: var(--text-dim); }

/* Scrollable list */
.selector-list {
    max-height: 340px;
    overflow-y: auto;
}
.selector-list::-webkit-scrollbar       { width: 4px; }
.selector-list::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }

/* Individual URL items */
.selector-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}
.selector-item:last-child { border-bottom: none; }
.selector-item:hover  { background: rgba(124,58,237,0.12); }
.selector-item.active { background: rgba(124,58,237,0.2); }
.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}
.item-code   { font-size: 13px; font-weight: 700; color: var(--primary-light); }
.item-domain { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta   { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.item-clicks { font-size: 11px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.item-date   { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.selector-empty {
    padding: 28px 16px;
    color: var(--text-dim);
    font-size: 14px;
    text-align: center;
}
.selector-empty a { color: var(--primary-light); text-decoration: none; }
.selector-empty a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   NEW: Stats Header Card
   ═══════════════════════════════════════════════════════════════════════════ */
.stats-header-card {
    padding: 24px 28px;
    margin-bottom: 20px;
}
.stats-url-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.stats-url-info { flex: 1; min-width: 0; }
.stats-short-link {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-light);
    text-decoration: none;
    word-break: break-all;
}
.stats-short-link:hover { text-decoration: underline; }
.stats-original-url {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 5px;
    word-break: break-all;
    line-height: 1.5;
}
.stats-original-url a { color: var(--text-muted); text-decoration: none; }
.stats-original-url a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   NEW: Breakdown Grid (Country · Browser · Device)
   ═══════════════════════════════════════════════════════════════════════════ */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.breakdown-card { padding: 24px 22px; }
.breakdown-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
}
.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

/* Single breakdown row: [icon] [label] [bar] [count] [pct] */
.breakdown-row {
    display: grid;
    grid-template-columns: 26px 1fr minmax(60px,90px) 36px 36px;
    align-items: center;
    gap: 8px;
}
.bd-flag        { font-size: 18px; line-height: 1; text-align: center; }
.bd-dot         { width: 10px; height: 10px; border-radius: 50%; justify-self: center; }
.bd-device-icon { font-size: 15px; text-align: center; }
.bd-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bd-bar-wrap {
    background: rgba(255,255,255,0.06);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
}
.bd-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.7s cubic-bezier(.25,.8,.25,1);
    min-width: 4px;
}
.bd-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: right;
}
.bd-pct {
    font-size: 11px;
    color: var(--text-dim);
    text-align: right;
}

@media (max-width: 640px) {
    .breakdown-row { grid-template-columns: 24px 1fr minmax(48px,72px) 30px 30px; gap: 6px; }
    .breakdown-grid { grid-template-columns: 1fr; }
    .stats-header-card { padding: 18px; }
}

/* ── Rank Badge (Leaderboard) ─────────────────────────────────────────── */
.history-rank {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--surface2), rgba(255,255,255,0.05));
    border: 1px solid var(--border);
    color: var(--primary-light);
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.history-card:nth-child(1) .history-rank {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    border-color: #fbbf24;
}
.history-card:nth-child(2) .history-rank {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #000;
    border-color: #cbd5e1;
}
.history-card:nth-child(3) .history-rank {
    background: linear-gradient(135deg, #b45309, #78350f);
    color: #fff;
    border-color: #d97706;
}


