/* ═══════════════════════════════════════════════════════════════
   SSPRODIGI Super Admin Panel — CSS
   ═══════════════════════════════════════════════════════════════ */

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

:root {
    --saas-dark:    #1a1f2e;
    --saas-darker:  #141824;
    --saas-accent:  #6c63ff;
    --saas-accent2: #22d3ee;
    --saas-danger:  #ef4444;
    --saas-warn:    #f59e0b;
    --saas-success: #10b981;
    --saas-text:    #e2e8f0;
    --saas-muted:   #94a3b8;
    --saas-border:  #2d3748;
    --saas-card:    #1e2535;
    --saas-hover:   #252d3f;
    --sidebar-w:    240px;
}

html, body {
    margin: 0; height: 100%;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    background: #0f1219;
    color: var(--saas-text);
}

a { color: var(--saas-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Sidebar ──────────────────────────────────────────────────── */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--saas-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    border-right: 1px solid var(--saas-border);
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--saas-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand-logo {
    width: 32px; height: 32px;
    background: var(--saas-accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 10px;
    color: var(--saas-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--saas-muted);
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--saas-muted);
    border-radius: 0;
    transition: all .15s;
    font-size: 13.5px;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--saas-hover);
    color: var(--saas-text);
}

.sidebar-nav a.active {
    background: rgba(108,99,255,.12);
    color: var(--saas-accent);
    border-left-color: var(--saas-accent);
    font-weight: 600;
}

.sidebar-nav a i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--saas-border);
    font-size: 12px;
    color: var(--saas-muted);
}

.sidebar-footer .admin-name { color: var(--saas-text); font-weight: 600; }

/* ── Main content ─────────────────────────────────────────────── */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-topbar {
    background: var(--saas-dark);
    border-bottom: 1px solid var(--saas-border);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0;
    z-index: 90;
}

.topbar-title { font-size: 17px; font-weight: 600; color: #fff; }
.topbar-title small { font-size: 12px; color: var(--saas-muted); font-weight: 400; margin-left: 8px; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-badge {
    background: rgba(108,99,255,.15);
    color: var(--saas-accent);
    border: 1px solid rgba(108,99,255,.3);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
}

.admin-content { padding: 28px; flex: 1; }

/* ── Stat Cards ───────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--saas-card);
    border: 1px solid var(--saas-border);
    border-radius: 14px;
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, var(--saas-accent));
}

.stat-card .stat-num {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-lbl {
    font-size: 12px;
    color: var(--saas-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-card .stat-icon {
    position: absolute;
    right: 20px; top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    opacity: .1;
    color: var(--card-accent, var(--saas-accent));
}

.stat-active  { --card-accent: #10b981; }
.stat-warn    { --card-accent: #f59e0b; }
.stat-danger  { --card-accent: #ef4444; }
.stat-info    { --card-accent: #22d3ee; }

/* ── Panel / Card ─────────────────────────────────────────────── */
.panel {
    background: var(--saas-card);
    border: 1px solid var(--saas-border);
    border-radius: 14px;
    margin-bottom: 24px;
}

.panel-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--saas-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.panel-body { padding: 22px; }

/* ── Tables ───────────────────────────────────────────────────── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.admin-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--saas-muted);
    border-bottom: 1px solid var(--saas-border);
    font-weight: 600;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--saas-border);
    vertical-align: middle;
    color: var(--saas-text);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--saas-hover); }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.badge-active    { background: rgba(16,185,129,.15); color: #10b981; border: 1px solid rgba(16,185,129,.3); }
.badge-inactive  { background: rgba(100,116,139,.15); color: #94a3b8; border: 1px solid rgba(100,116,139,.3); }
.badge-expired   { background: rgba(239,68,68,.15);   color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.badge-suspended { background: rgba(245,158,11,.15);  color: #f59e0b; border: 1px solid rgba(245,158,11,.3); }
.badge-trial     { background: rgba(34,211,238,.15);  color: #22d3ee; border: 1px solid rgba(34,211,238,.3); }
.badge-basic     { background: rgba(108,99,255,.15);  color: #a78bfa; border: 1px solid rgba(108,99,255,.3); }
.badge-pro       { background: rgba(16,185,129,.15);  color: #34d399; border: 1px solid rgba(16,185,129,.3); }
.badge-enterprise{ background: rgba(245,158,11,.15);  color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all .15s;
    font-family: inherit;
}

.btn-primary {
    background: var(--saas-accent);
    color: #fff;
    border-color: var(--saas-accent);
}
.btn-primary:hover { background: #5a52e0; color: #fff; text-decoration: none; }

.btn-success {
    background: var(--saas-success);
    color: #fff;
    border-color: var(--saas-success);
}
.btn-success:hover { background: #059669; color: #fff; text-decoration: none; }

.btn-danger {
    background: var(--saas-danger);
    color: #fff;
    border-color: var(--saas-danger);
}
.btn-danger:hover { background: #dc2626; color: #fff; text-decoration: none; }

.btn-warn {
    background: var(--saas-warn);
    color: #fff;
    border-color: var(--saas-warn);
}
.btn-warn:hover { background: #d97706; color: #fff; text-decoration: none; }

.btn-outline {
    background: transparent;
    color: var(--saas-muted);
    border-color: var(--saas-border);
}
.btn-outline:hover { background: var(--saas-hover); color: var(--saas-text); text-decoration: none; }

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 5px; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--saas-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.form-control {
    width: 100%;
    padding: 9px 14px;
    background: var(--saas-darker);
    border: 1px solid var(--saas-border);
    border-radius: 8px;
    color: var(--saas-text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .15s;
    outline: none;
}
.form-control:focus { border-color: var(--saas-accent); }
.form-control::placeholder { color: #4a5568; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint { font-size: 11px; color: var(--saas-muted); margin-top: 4px; }

/* ── Login Page ───────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1219 0%, #1a1f2e 100%);
    padding: 24px;
}

.login-card {
    background: var(--saas-card);
    border: 1px solid var(--saas-border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,.5);
}

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

.login-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--saas-accent), #a855f7);
    border-radius: 16px;
    font-size: 26px;
    color: #fff;
    margin-bottom: 14px;
    box-shadow: 0 8px 20px rgba(108,99,255,.35);
}

.login-logo h1 { font-size: 22px; font-weight: 700; color: #fff; margin: 0; }
.login-logo p { font-size: 13px; color: var(--saas-muted); margin: 4px 0 0; }

.login-divider {
    border: none;
    border-top: 1px solid var(--saas-border);
    margin: 24px 0;
}

/* ── Alerts ───────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-danger  { background: rgba(239,68,68,.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.alert-success { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.alert-warn    { background: rgba(245,158,11,.12); color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }

/* ── Misc ─────────────────────────────────────────────────────── */
.text-muted  { color: var(--saas-muted); }
.text-white  { color: #fff; }
.text-danger { color: var(--saas-danger); }
.text-success{ color: var(--saas-success); }
.text-warn   { color: var(--saas-warn); }
.text-accent { color: var(--saas-accent); }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 16px; }
.fw-600 { font-weight: 600; }

.expiring-row td { background: rgba(245,158,11,.06); }
.expiring-row td:first-child { border-left: 3px solid var(--saas-warn); }

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-bar select,
.filter-bar input {
    padding: 7px 12px;
    background: var(--saas-darker);
    border: 1px solid var(--saas-border);
    border-radius: 8px;
    color: var(--saas-text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

/* ── Chart containers ─────────────────────────────────────────── */
.chart-wrap {
    position: relative;
    height: 280px;
    padding: 4px;
}

/* ── Usage meter ──────────────────────────────────────────────── */
.usage-bar-wrap { margin-top: 4px; }
.usage-bar-bg {
    height: 6px; background: var(--saas-border); border-radius: 3px;
}
.usage-bar-fill {
    height: 6px; border-radius: 3px;
    background: var(--saas-accent);
    transition: width .3s;
}

/* ── Footer ───────────────────────────────────────────────────── */
.admin-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--saas-border);
    font-size: 12px;
    color: var(--saas-muted);
    text-align: center;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar { width: 200px; }
    .admin-main { margin-left: 200px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
