/* =============================================================
   Super Admin Portal — Dark Indigo/Purple Theme
   ============================================================= */

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

:root {
    --bg-primary: #080818;
    --bg-secondary: #0e0e24;
    --bg-card: rgba(255, 255, 255, 0.035);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-sidebar: rgba(8, 8, 24, 0.97);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-active: rgba(129, 103, 232, 0.5);
    --text-primary: #eeeef5;
    --text-secondary: #8585b0;
    --text-muted: #55557a;
    --accent: #8167E8;
    --accent-light: #b8a9ff;
    --accent-glow: rgba(129, 103, 232, 0.2);
    --success: #00d28c;
    --success-bg: rgba(0, 210, 140, 0.1);
    --warning: #ffc048;
    --warning-bg: rgba(255, 192, 72, 0.1);
    --danger: #ff4757;
    --danger-bg: rgba(255, 71, 87, 0.1);
    --info: #54a0ff;
    --info-bg: rgba(84, 160, 255, 0.1);
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

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

a { color: var(--accent-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: #fff; }

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0; left: 0; height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    backdrop-filter: blur(20px);
}

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

.sidebar-brand .logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), #e056a0);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: #fff;
}

.sidebar-brand h2 { font-size: 1.1rem; font-weight: 700; }
.sidebar-brand small { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav .nav-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); padding: 12px 16px 6px; }

.sidebar-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); transition: all var(--transition); margin-bottom: 2px; position: relative;
}
.sidebar-nav a:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.sidebar-nav a.active { background: var(--accent-glow); color: var(--accent-light); }
.sidebar-nav a.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0; }
.sidebar-nav a .icon { font-size: 1.15rem; width: 24px; text-align: center; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-color); }
.sidebar-footer .user-info { display: flex; align-items: center; gap: 10px; padding: 8px; }
.sidebar-footer .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #e056a0); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: #fff; }
.sidebar-footer .user-meta { flex: 1; }
.sidebar-footer .user-meta .name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.sidebar-footer .user-meta .role { font-size: 0.7rem; color: var(--text-muted); }

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

.top-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between; padding: 0 32px;
    background: rgba(8, 8, 24, 0.85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 50;
}
.top-header h1 { font-size: 1.2rem; font-weight: 700; }
.hamburger { display: none; background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; }

.page-content { flex: 1; padding: 28px 32px; animation: pageIn 0.4s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

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

.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    padding: 22px 24px; transition: all var(--transition); position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), #e056a0); opacity: 0; transition: opacity var(--transition); }
.stat-card:hover { background: var(--bg-card-hover); border-color: var(--border-active); }
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 12px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* Card */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; transition: all var(--transition); }
.card:hover { border-color: rgba(255,255,255,0.1); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h2 { font-size: 1.05rem; font-weight: 700; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-family: var(--font); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all var(--transition); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #fff; box-shadow: 0 4px 15px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); color: #fff; }
.btn-secondary { background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,71,87,0.2); }
.btn-danger:hover { background: rgba(255,71,87,0.2); }
.btn-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,210,140,0.2); }
.btn-success:hover { background: rgba(0,210,140,0.2); }
.btn-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,192,72,0.2); }
.btn-warning:hover { background: rgba(255,192,72,0.2); }
.btn-sm { padding: 6px 14px; font-size: 0.78rem; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-control { width: 100%; padding: 11px 16px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font); font-size: 0.9rem; transition: all var(--transition); outline: none; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238585b0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* Tables */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-color); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th { padding: 12px 16px; text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border-color); white-space: nowrap; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); vertical-align: middle; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-revoked { background: var(--danger-bg); color: var(--danger); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge-active .badge-dot { background: var(--success); }
.badge-inactive .badge-dot { background: var(--text-muted); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); width: 90%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn 0.3s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 14px 20px; min-width: 280px; box-shadow: var(--shadow); animation: toastIn 0.35s ease, toastOut 0.3s ease 3.7s forwards; display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* Auth Pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #080818, #1a1040, #0e0e24); padding: 20px; }
.auth-card { background: rgba(255,255,255,0.035); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.07); border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); animation: pageIn 0.5s ease; }
.auth-card .auth-logo { text-align: center; margin-bottom: 28px; }
.auth-card .auth-logo .logo-icon { width: 52px; height: 52px; background: linear-gradient(135deg, var(--accent), #e056a0); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 12px; }
.auth-card .auth-logo h1 { font-size: 1.4rem; font-weight: 700; }
.auth-card .auth-logo p { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.auth-card .btn-primary { width: 100%; padding: 13px; font-size: 0.95rem; justify-content: center; }
.auth-card .auth-footer { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); }
.auth-card .error-msg { background: var(--danger-bg); border: 1px solid rgba(255,71,87,0.2); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 16px; text-align: center; }

/* Copy box */
.copy-box { display: flex; align-items: center; gap: 10px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 10px 14px; }
.copy-box code { flex: 1; font-family: monospace; font-size: 0.82rem; color: var(--accent-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.copy-box .btn-copy { background: none; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 6px 12px; border-radius: 6px; font-size: 0.78rem; cursor: pointer; transition: all var(--transition); font-family: var(--font); }
.copy-box .btn-copy:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* Search */
.search-box { position: relative; }
.search-box input { width: 100%; padding: 10px 16px 10px 38px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font); font-size: 0.85rem; outline: none; transition: all var(--transition); }
.search-box input:focus { border-color: var(--accent); }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem; pointer-events: none; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .page-content { padding: 20px 16px; }
    .form-row { flex-direction: column; }
}
