/* =============================================
   DIGINUSA LICENSE MANAGER - MAIN STYLESHEET
   ============================================= */

:root {
    --bg-primary: #0a0f1e;
    --bg-secondary: #0d1526;
    --bg-card: rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.07);
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.15);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99,102,241,0.3);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --sidebar-w: 260px;
    --topbar-h: 64px;
}

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

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

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

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

/* ======== BUTTONS ======== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); color:#fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color:#fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color:#fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #d97706; color:#000; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card-hover); border-color: var(--border-strong); color:#fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { font-size: 15px; }

/* ======== CARDS ======== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }

/* ======== FORMS ======== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    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 { cursor: pointer; }
select.form-control option { background: #1e293b; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ======== TABLE ======== */
.table-wrapper { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: rgba(255,255,255,0.04);
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}
tbody td { padding: 14px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover td { background: var(--bg-card-hover); }

/* ======== BADGES ======== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.badge-active { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.badge-pending { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.badge-suspended { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.badge-expired { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }
.badge-superadmin { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.badge-admin { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }

/* ======== STATS CARDS ======== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s;
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-accent { background: rgba(99,102,241,0.15); color: var(--accent); }
.stat-success { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-danger { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ======== SIDEBAR ======== */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.brand-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.brand-version { font-size: 10px; color: var(--text-muted); }

.nav-section { padding: 20px 12px 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 2px 8px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--accent); }
.nav-item .nav-icon { font-size: 17px; width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 10px; font-weight: 700; }

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
}
.admin-info { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    color: #fff;
}
.admin-name { font-size: 13px; font-weight: 600; }
.admin-role { font-size: 11px; color: var(--text-muted); }
.logout-btn {
    display: block;
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(239,68,68,0.1);
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(239,68,68,0.2);
    transition: all 0.2s;
}
.logout-btn:hover { background: rgba(239,68,68,0.2); color: var(--danger); }

/* ======== TOPBAR ======== */
.topbar {
    position: fixed;
    left: var(--sidebar-w);
    right: 0; top: 0;
    height: var(--topbar-h);
    background: rgba(10,15,30,0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 99;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ======== MAIN CONTENT ======== */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-h));
}

/* ======== PAGE HEADER ======== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ======== SEARCH BAR ======== */
.search-bar { position: relative; }
.search-bar input {
    padding: 9px 14px 9px 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 240px;
    transition: all 0.2s;
}
.search-bar input:focus { border-color: var(--accent); width: 280px; }
.search-bar .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; }

/* ======== MODAL ======== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #0d1526;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { opacity:0; transform: scale(0.95) translateY(10px); } to { opacity:1; transform: none; } }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ======== FLASH MESSAGE ======== */
.flash-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-left: 3px solid;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13.5px;
}
.flash-icon { font-size: 16px; font-weight: 700; }

/* ======== EMPTY STATE ======== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ======== DIVIDER ======== */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ======== COPY BUTTON ======== */
.copy-wrap { display: flex; align-items: center; gap: 8px; }
.copy-text { font-family: 'Fira Code', monospace; font-size: 13px; color: var(--accent); background: rgba(99,102,241,0.1); padding: 4px 10px; border-radius: 6px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-copy { padding: 4px 10px; font-size: 11px; }

/* ======== LOGIN PAGE ======== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.login-bg {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.1) 0%, transparent 60%),
                radial-gradient(ellipse at 60% 80%, rgba(16,185,129,0.08) 0%, transparent 60%);
}
.login-card {
    position: relative;
    background: rgba(13,21,38,0.95);
    border: 1px solid var(--border-strong);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}
.login-logo-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.login-logo-text { font-size: 20px; font-weight: 800; }
.login-logo-sub { font-size: 12px; color: var(--text-muted); }

.login-step { display: none; }
.login-step.active { display: block; animation: fade-in 0.3s ease; }
@keyframes fade-in { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: none; } }

/* ======== OTP INPUT ======== */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.otp-digit {
    width: 52px; height: 60px;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--border);
    border-radius: 12px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
    font-family: 'Fira Code', monospace;
}
.otp-digit:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ======== TOOLTIP ======== */
[data-tooltip] { position: relative; cursor: pointer; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%; transform: translateX(-50%);
    background: #1e293b;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 9999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ======== RESPONSIVE ======== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: none; }
    .topbar { left: 0; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
