/* Admin Panel — clean dark UI */

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

:root {
    --bg: #0b0e14;
    --bg2: #11151d;
    --surface: #161b25;
    --surface2: #1d2330;
    --border: #252b3a;
    --text: #e6e9ef;
    --text2: #9aa2b1;
    --text3: #5b6273;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --green: #10b981;
    --green-bg: rgba(16, 185, 129, 0.15);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.15);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.15);
    --radius: 10px;
}

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: #818cf8; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Navbar */
.navbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    color: var(--text) !important;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    font-weight: 900;
    font-size: 0.95rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    flex-shrink: 0;
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 6px;
}
.login-logo .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
}
.nav-links { display: flex; align-items: center; gap: 14px; }
.nav-links a:not(.btn) { color: var(--text2); font-size: 0.9rem; }
.nav-links a:not(.btn):hover { color: var(--text); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    font-family: 'Inter', sans-serif;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-mini {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
    text-decoration: none !important;
    display: inline-block;
    line-height: 1;
}
.btn-mini:hover { border-color: var(--accent); color: var(--text); background: var(--surface2); }

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.stat-box.stat-green { border-color: rgba(16, 185, 129, 0.3); background: linear-gradient(135deg, var(--surface), rgba(16, 185, 129, 0.05)); }
.stat-box.stat-red { border-color: rgba(239, 68, 68, 0.3); background: linear-gradient(135deg, var(--surface), rgba(239, 68, 68, 0.05)); }
.stat-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text2); font-size: 0.82rem; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Pipeline card */
.pipeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 32px;
}
.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.pipeline-header h3 { font-size: 1rem; margin-bottom: 6px; }

/* Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section-header h2 { font-size: 1.4rem; font-weight: 700; }

/* Table */
.subs-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.subs-table th, .subs-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
.subs-table th {
    color: var(--text2);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    background: var(--bg2);
}
.subs-table tr:last-child td { border-bottom: none; }
.subs-table tr:hover { background: var(--surface2); }
.row-disabled { opacity: 0.55; }
.cell-link { max-width: 380px; }
.sub-url {
    background: var(--bg);
    padding: 5px 9px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--accent);
    border: 1px solid var(--border);
    display: inline-block;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
.cell-actions { white-space: nowrap; }
.cell-actions form { display: inline; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-green { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(245, 158, 11, 0.3); }

/* Empty state */
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 60px 20px;
    text-align: center;
}
.empty-state h3 { margin-bottom: 8px; font-weight: 700; }
.empty-state p { color: var(--text2); margin-bottom: 20px; }

/* Auth */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--text2); margin-bottom: 28px; font-size: 0.9rem; }
.auth-card label { display: block; font-size: 0.8rem; color: var(--text2); font-weight: 600; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.auth-card input { width: 100%; }

/* Form card */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 720px;
    margin: 0 auto;
}
.form-card h2 { margin-bottom: 6px; font-weight: 700; }
.form-card .muted { color: var(--text2); margin-bottom: 24px; font-size: 0.92rem; }
.form-card label {
    display: block;
    font-size: 0.78rem;
    color: var(--text2);
    font-weight: 600;
    margin: 18px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.form-card .req { color: var(--red); }
.form-card .hint { display: block; color: var(--text3); font-size: 0.8rem; margin-top: 5px; }

input[type=text], input[type=password], input[type=datetime-local], textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.92rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 60px; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

/* Sub view */
.back-link { margin-bottom: 18px; }
.back-link a { color: var(--text2); font-size: 0.9rem; }
.sub-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}
.block-h {
    margin: 26px 0 12px;
    font-size: 1rem;
    color: var(--text2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.copy-box {
    display: flex;
    gap: 8px;
}
.copy-box input {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent);
}
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.action-buttons form { display: inline; }
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0;
}

.muted { color: var(--text2); }
.small { font-size: 0.82rem; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.88rem;
}
.alert-error { background: var(--red-bg); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }

/* Responsive */
@media (max-width: 900px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .subs-table { font-size: 0.85rem; display: block; overflow-x: auto; }
    .pipeline-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 540px) {
    .stats-row { grid-template-columns: 1fr; }
    .nav-links { gap: 8px; }
    .nav-links a:not(.btn) { display: none; }
    .form-card { padding: 22px; }
}
