/* ═══════════════════════════════════════════════════════════════════════════
   CC KILLER — Admin Panel Dark Theme
   Premium dark UI with glassmorphism, gradients, micro-animations
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────────────────── */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(17, 24, 39, 0.9);
    --bg-sidebar: #0d1321;
    --bg-input: #1a2332;
    --bg-input-focus: #1e293b;
    --border: rgba(56, 189, 248, 0.1);
    --border-hover: rgba(56, 189, 248, 0.3);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.15);
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.1);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.1);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.1);
    --purple: #a78bfa;
    --purple-bg: rgba(167, 139, 250, 0.1);
    --gradient-accent: linear-gradient(135deg, #0ea5e9, #38bdf8, #7dd3fc);
    --gradient-card: linear-gradient(135deg, rgba(56, 189, 248, 0.05), rgba(167, 139, 250, 0.05));
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --sidebar-width: 260px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: var(--gradient-accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}
.sidebar-brand .brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}
.nav-section {
    margin-bottom: 24px;
}
.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--accent-glow);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    box-shadow: var(--shadow-glow);
}
.nav-item .nav-icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

/* ─── Page Header ───────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.page-header .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}
.header-actions {
    display: flex;
    gap: 10px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
}
.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* ─── Stat Cards ────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.accent::before { background: var(--gradient-accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.purple::before { background: var(--purple); }

.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 16px;
}
.stat-card.accent .stat-icon { background: var(--accent-glow); color: var(--accent); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.purple .stat-icon { background: var(--purple-bg); color: var(--purple); }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 4px;
}
.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Tables ────────────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
thead th {
    background: rgba(56, 189, 248, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 1px;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.05);
    vertical-align: middle;
}
tbody tr {
    transition: background var(--transition);
}
tbody tr:hover {
    background: rgba(56, 189, 248, 0.03);
}
tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-accent { background: var(--accent-glow); color: var(--accent); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-muted { background: rgba(100,116,139,0.15); color: var(--text-muted); }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-input);
    color: var(--text-primary);
    white-space: nowrap;
}
.btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-input-focus);
    transform: translateY(-1px);
}
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.3);
}
.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-primary);
}
.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
}
.btn-icon {
    width: 32px; height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
}

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: all var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder {
    color: var(--text-muted);
}
.form-textarea {
    min-height: 80px;
    resize: vertical;
}
.form-input-group {
    display: flex;
    gap: 10px;
}
.form-input-group .form-input {
    flex: 1;
}

/* ─── Search Bar ────────────────────────────────────────────────────────── */
.search-bar {
    position: relative;
    max-width: 360px;
}
.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}
.search-bar .form-input {
    padding-left: 40px;
}

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.active {
    display: flex;
}
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    min-width: 420px;
    max-width: 560px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

/* ─── Login Page ────────────────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(56, 189, 248, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(167, 139, 250, 0.06) 0%, transparent 60%);
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}
.login-card .brand {
    text-align: center;
    margin-bottom: 32px;
}
.login-card .brand-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    background: var(--gradient-accent);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.3);
}
.login-card .brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.login-card .brand p {
    color: var(--text-muted);
    font-size: 0.88rem;
}
.login-error {
    background: var(--danger-bg);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ─── Grid Layouts ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

/* ─── Details / Expandable ──────────────────────────────────────────────── */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(56, 189, 248, 0.05);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-weight: 500; }
.detail-value { font-weight: 600; font-family: 'JetBrains Mono', monospace; }

/* ─── Code / Mono ───────────────────────────────────────────────────────── */
.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.83rem;
}
code {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
}

/* ─── Filter Bar ────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-bar .form-select, .filter-bar .form-input {
    width: auto;
    min-width: 160px;
}

/* ─── Settings Grid ─────────────────────────────────────────────────────── */
.settings-section {
    margin-bottom: 28px;
}
.settings-section h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ─── Gateway Cards ─────────────────────────────────────────────────────── */
.cc-killer-grid, .gateway-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.cc-killer-card, .gateway-card {
    position: relative;
}
.cc-killer-card.active, .gateway-card.active {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.1);
}
.cc-killer-card .active-badge, .gateway-card .active-badge {
    position: absolute;
    top: 12px; right: 12px;
}

/* ─── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state p {
    font-size: 0.95rem;
}

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.animate-in {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; padding: 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ─── Utility ───────────────────────────────────────────────────────────── */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.justify-between { justify-content: space-between; }
