/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0a0f;
    --bg2: #0f0f1a;
    --glass: rgba(255,255,255,0.05);
    --glass-border: rgba(255,255,255,0.1);
    --glass-hover: rgba(255,255,255,0.08);
    --accent: #7c5cbf;
    --accent2: #a07ce0;
    --accent-glow: rgba(124,92,191,0.4);
    --red: #e05c5c;
    --red-glow: rgba(224,92,92,0.4);
    --green: #5ce08a;
    --green-glow: rgba(92,224,138,0.3);
    --yellow: #e0c05c;
    --text: #e8e8f0;
    --text2: #9090b0;
    --text3: #5a5a7a;
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.22s cubic-bezier(.4,0,.2,1);
}

html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }

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

/* ===== GLASS ===== */
.glass {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* ===== PAGE SYSTEM ===== */
.page { position: fixed; inset: 0; transition: opacity var(--transition); }
.page.hidden { opacity: 0; pointer-events: none; }
.page.active { opacity: 1; }

/* ===== LOGIN PAGE ===== */
#page-login {
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 30% 50%, #1a0f2e 0%, var(--bg) 60%),
                radial-gradient(ellipse at 80% 20%, #0f1a2e 0%, transparent 50%);
}

.login-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.orb {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.35; animation: float 8s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; background: #7c5cbf; top: -100px; left: -100px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: #5c7cbf; bottom: -80px; right: 10%; animation-delay: -3s; }
.orb-3 { width: 300px; height: 300px; background: #bf5c9a; top: 40%; left: 60%; animation-delay: -5s; }

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.login-container {
    width: 400px; border-radius: 24px; padding: 48px 40px;
    position: relative; z-index: 10;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px var(--glass-border);
    animation: slideUp 0.5s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:translateY(0); } }

.login-logo { text-align: center; margin-bottom: 36px; }
.logo-icon {
    width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; box-shadow: 0 8px 32px var(--accent-glow);
}
.logo-icon.small { width: 38px; height: 38px; border-radius: 10px; font-size: 18px; margin: 0; }
.login-logo h1 { font-size: 28px; font-weight: 700; letter-spacing: 1px; }
.login-subtitle { color: var(--text2); font-size: 13px; letter-spacing: 3px; text-transform: uppercase; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.input-group {
    position: relative; display: flex; align-items: center;
    background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); transition: border-color var(--transition), box-shadow var(--transition);
}
.input-group:focus-within {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-icon { position: absolute; left: 14px; color: var(--text3); font-size: 14px; pointer-events: none; }
.input-group input {
    width: 100%; background: transparent; border: none; outline: none;
    color: var(--text); font-size: 14px; padding: 14px 16px 14px 42px;
}
.input-group input::placeholder { color: var(--text3); }
.password-toggle { position: absolute; right: 14px; color: var(--text3); cursor: pointer; font-size: 14px; transition: color var(--transition); }
.password-toggle:hover { color: var(--text); }

.error-msg {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: rgba(224,92,92,0.1); border: 1px solid rgba(224,92,92,0.3);
    border-radius: var(--radius-sm); color: var(--red); font-size: 13px;
}

.login-footer { text-align: center; color: var(--text3); font-size: 12px; margin-top: 24px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 600; border: none; cursor: pointer; transition: all var(--transition);
    text-decoration: none; white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white; box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); box-shadow: 0 8px 28px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-danger { background: linear-gradient(135deg, #c0392b, var(--red)); color: white; box-shadow: 0 4px 20px var(--red-glow); }
.btn-danger:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-success { background: linear-gradient(135deg, #27ae60, var(--green)); color: #0a1a0f; box-shadow: 0 4px 20px var(--green-glow); }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost {
    background: var(--glass); border: 1px solid var(--glass-border); color: var(--text2);
}
.btn-ghost:hover { background: var(--glass-hover); color: var(--text); border-color: rgba(255,255,255,0.2); }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 8px; }
.btn-icon {
    width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--glass); border: 1px solid var(--glass-border); border-radius: 10px;
    color: var(--text2); cursor: pointer; transition: all var(--transition); font-size: 14px;
}
.btn-icon:hover { background: var(--glass-hover); color: var(--text); border-color: rgba(255,255,255,0.2); }

/* ===== APP LAYOUT ===== */
#page-app { display: flex; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w); height: 100vh; display: flex; flex-direction: column;
    border-right: 1px solid var(--glass-border); border-radius: 0;
    padding: 20px 12px; flex-shrink: 0; transition: width var(--transition), transform var(--transition);
    z-index: 100;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 20px; border-bottom: 1px solid var(--glass-border); margin-bottom: 16px;
    font-size: 18px; font-weight: 700; letter-spacing: 0.5px;
}
.sidebar-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--text3); padding: 12px 12px 4px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border-radius: var(--radius-sm); color: var(--text2); text-decoration: none;
    font-size: 14px; font-weight: 500; transition: all var(--transition); position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-item:hover { background: var(--glass-hover); color: var(--text); }
.nav-item.active {
    background: linear-gradient(135deg, rgba(124,92,191,0.25), rgba(160,124,224,0.15));
    color: var(--accent2); border: 1px solid rgba(124,92,191,0.3);
}
.nav-item.active i { color: var(--accent2); }
.nav-badge {
    margin-left: auto; background: var(--accent); color: white;
    font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}
.nav-badge.red { background: var(--red); }
.nav-badge.hidden { display: none; }

.sidebar-footer {
    border-top: 1px solid var(--glass-border); padding-top: 16px;
    display: flex; align-items: center; gap: 8px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--accent2); text-transform: uppercase; letter-spacing: 1px; }

/* ===== TOPBAR ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
    height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; border-bottom: 1px solid var(--glass-border);
    background: var(--glass); backdrop-filter: blur(20px); flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.breadcrumb { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-time { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green-glow); animation: pulse 2s infinite; }
.status-dot.offline { background: var(--red); }
.status-label { font-size: 12px; color: var(--text2); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ===== CONTENT AREA ===== */
.content-area { flex: 1; overflow-y: auto; padding: 24px; }

/* ===== CARDS ===== */
.card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 24px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--accent2); }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
    padding: 20px; display: flex; align-items: center; gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center;
    justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-icon.purple { background: rgba(124,92,191,0.2); color: var(--accent2); }
.stat-icon.green { background: rgba(92,224,138,0.15); color: var(--green); }
.stat-icon.red { background: rgba(224,92,92,0.15); color: var(--red); }
.stat-icon.yellow { background: rgba(224,192,92,0.15); color: var(--yellow); }
.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { border-bottom: 1px solid var(--glass-border); }
th { padding: 10px 14px; text-align: left; color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-active { background: rgba(92,224,138,0.15); color: var(--green); border: 1px solid rgba(92,224,138,0.3); }
.badge-banned { background: rgba(224,92,92,0.15); color: var(--red); border: 1px solid rgba(224,92,92,0.3); }
.badge-expired { background: rgba(90,90,122,0.2); color: var(--text3); border: 1px solid rgba(90,90,122,0.3); }
.badge-owner { background: rgba(224,192,92,0.15); color: var(--yellow); border: 1px solid rgba(224,192,92,0.3); }
.badge-admin { background: rgba(124,92,191,0.2); color: var(--accent2); border: 1px solid rgba(124,92,191,0.3); }
.badge-moder { background: rgba(92,124,224,0.15); color: #7ca0e0; border: 1px solid rgba(92,124,224,0.3); }

/* ===== SEARCH & TOOLBAR ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 13px; pointer-events: none; }
.search-input {
    width: 100%; background: var(--glass); border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); padding: 10px 16px 10px 36px;
    color: var(--text); font-size: 13px; outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-input::placeholder { color: var(--text3); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
    width: 480px; max-width: 95vw; border-radius: 20px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7);
    animation: modalIn 0.25s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn { from{opacity:0;transform:scale(0.95)translateY(10px)} to{opacity:1;transform:scale(1)translateY(0)} }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--glass-border); }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--glass-border); }

/* FORM INSIDE MODAL */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; color: var(--text2); font-weight: 600; letter-spacing: 0.5px; }
.form-input, .form-select, .form-textarea {
    background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); padding: 10px 14px;
    color: var(--text); font-size: 13px; outline: none; width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text3); }
.form-select { appearance: none; cursor: pointer; }
.form-select option { background: #1a1a2e; }
.form-textarea { resize: vertical; min-height: 80px; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px;
    background: rgba(20,20,35,0.95); border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); min-width: 280px; max-width: 380px;
    backdrop-filter: blur(20px); box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: toastIn 0.3s cubic-bezier(.4,0,.2,1);
    font-size: 13px;
}
@keyframes toastIn { from{opacity:0;transform:translateX(40px)} to{opacity:1;transform:translateX(0)} }
.toast.removing { animation: toastOut 0.3s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes toastOut { to{opacity:0;transform:translateX(40px)} }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--red); }
.toast.info .toast-icon { color: var(--accent2); }
.toast.warning .toast-icon { color: var(--yellow); }
.toast-text { flex: 1; }
.toast-close { color: var(--text3); cursor: pointer; font-size: 12px; flex-shrink: 0; }
.toast-close:hover { color: var(--text); }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 2px; background: currentColor; border-radius: 0 0 0 8px; animation: progress linear forwards; }
.toast { position: relative; overflow: hidden; }

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    border: 2px dashed var(--glass-border); border-radius: var(--radius);
    padding: 40px; text-align: center; cursor: pointer;
    transition: all var(--transition); color: var(--text2);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent); background: rgba(124,92,191,0.05); color: var(--text);
}
.upload-zone i { font-size: 40px; color: var(--accent2); margin-bottom: 12px; display: block; }
.upload-zone p { font-size: 14px; margin-bottom: 6px; }
.upload-zone span { font-size: 12px; color: var(--text3); }

/* ===== GRID LAYOUTS ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ===== VERSIONS LIST ===== */
.version-item {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); transition: background var(--transition);
}
.version-item:hover { background: rgba(255,255,255,0.05); }
.version-item.active-ver { border-color: rgba(92,224,138,0.3); background: rgba(92,224,138,0.05); }
.version-num { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.version-meta { flex: 1; min-width: 0; }
.version-date { font-size: 11px; color: var(--text3); }
.version-changelog { font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== LOG ENTRIES ===== */
.log-entry {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 12px;
}
.log-entry:last-child { border-bottom: none; }
.log-time { color: var(--text3); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 140px; }
.log-action { color: var(--text2); flex: 1; }
.log-type { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.log-type.info { background: var(--accent2); }
.log-type.warn { background: var(--yellow); }
.log-type.error { background: var(--red); }
.log-type.success { background: var(--green); }

/* ===== UTILS ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-accent { color: var(--accent2); }
.text-muted { color: var(--text2); }
.fw-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.align-center { align-items: center; }
.actions-cell { display: flex; gap: 6px; }
.divider { height: 1px; background: var(--glass-border); margin: 16px 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .sidebar { position: absolute; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .two-col, .three-col { grid-template-columns: 1fr; }
}
