/* ============================================================
   HOSTANA NETWORK DASHBOARD — CSS v2.1
   ============================================================ */

:root {
  --bg-primary:    #080c14;
  --bg-secondary:  #0e1420;
  --bg-card:       #121a28;
  --bg-sidebar:    #0a0f1c;
  --accent:        #4f8ef7;
  --accent-dim:    rgba(79,142,247,0.1);
  --accent-hover:  #6aa0ff;
  --green:         #34d399;
  --green-dim:     rgba(52,211,153,0.12);
  --red:           #f87171;
  --red-dim:       rgba(248,113,113,0.12);
  --orange:        #fb923c;
  --orange-dim:    rgba(251,146,60,0.12);
  --blue:          #60a5fa;
  --blue-dim:      rgba(96,165,250,0.12);
  --text-primary:  #e2e8f0;
  --text-secondary:#7a8899;
  --text-muted:    #3d4e63;
  --border:        rgba(255,255,255,0.055);
  --border-accent: rgba(79,142,247,0.25);
  --shadow:        0 4px 32px rgba(0,0,0,0.5);
  --radius:        10px;
  --radius-sm:     6px;
  --sidebar-width: 232px;
  --header-height: 56px;
  --font: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
}

body.light {
  --bg-primary:    #f0f4f9;
  --bg-secondary:  #e4eaf3;
  --bg-card:       #ffffff;
  --bg-sidebar:    #1a2236;
  --accent:        #3b7de9;
  --accent-dim:    rgba(59,125,233,0.1);
  --accent-hover:  #2d6dd8;
  --green:         #059669;
  --green-dim:     rgba(5,150,105,0.1);
  --red:           #dc2626;
  --red-dim:       rgba(220,38,38,0.1);
  --orange:        #d97706;
  --orange-dim:    rgba(217,119,6,0.1);
  --blue:          #2563eb;
  --blue-dim:      rgba(37,99,235,0.1);
  --text-primary:  #111827;
  --text-secondary:#4b5563;
  --text-muted:    #9ca3af;
  --border:        rgba(0,0,0,0.08);
  --border-accent: rgba(59,125,233,0.25);
  --shadow:        0 4px 24px rgba(0,0,0,0.08);
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}

.btn-theme {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
}
.btn-theme:hover { color: var(--accent); border-color: var(--border-accent); }

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse 60% 40% at 50% -10%, rgba(79,142,247,0.07) 0%, transparent 70%), var(--bg-primary);
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border-accent);
  border-radius: 16px; padding: 2.5rem 2rem; text-align: center;
  max-width: 380px; width: 90%;
  box-shadow: 0 0 80px rgba(79,142,247,0.06), var(--shadow);
}
.login-logo { margin-bottom: 1.5rem; }
.login-logo-img { width: 80px; height: auto; object-fit: contain; }
.login-card h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.3px; }
.login-sub { color: var(--accent); font-size: 0.75rem; margin: 0.25rem 0 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 500; }
.login-divider { height: 1px; background: var(--border); margin: 1rem 0; }
.login-desc { color: var(--text-secondary); font-size: 0.875rem; line-height: 1.6; margin-bottom: 1.5rem; }
.btn-discord { display: inline-flex; align-items: center; gap: 10px; background: #5865F2; color: white; text-decoration: none; padding: 0.7rem 1.6rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; transition: all 0.2s; border: none; cursor: pointer; font-family: var(--font); }
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(88,101,242,0.35); }
.login-footer { margin-top: 1.2rem; font-size: 0.72rem; color: var(--text-muted); }

.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform 0.3s; overflow-y: auto;
}
.sidebar-header { padding: 1rem 0.875rem; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 10px; }
.sidebar-logo-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.sidebar-title { font-size: 0.85rem; font-weight: 700; color: #e2e8f0; letter-spacing: -0.2px; }
.sidebar-subtitle { font-size: 0.68rem; color: #4a5568; }

nav { padding: 0.5rem 0; flex: 1; }
.nav-section { padding: 0.75rem 0.5rem 0.25rem; }
.nav-label { font-size: 0.62rem; font-weight: 600; color: #4a5568; text-transform: uppercase; letter-spacing: 1.2px; padding: 0 0.5rem 0.4rem; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); color: #94a3b8; font-size: 0.84rem; cursor: pointer; transition: all 0.15s; border: none; background: none; width: 100%; text-align: left; font-family: var(--font); font-weight: 400; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.nav-item.active { background: rgba(79,142,247,0.15); color: #7ab3ff; font-weight: 500; }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge { margin-left: auto; background: var(--red); color: white; border-radius: 20px; padding: 1px 6px; font-size: 0.65rem; font-weight: 600; }
.nav-badge.green { background: var(--green); color: #000; }
.nav-badge.orange { background: var(--orange); color: #000; }

.sidebar-user { padding: 0.875rem; border-top: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 9px; }
.sidebar-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--accent); flex-shrink: 0; background: #1e2d3d; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-username { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e2e8f0; }
.sidebar-role { font-size: 0.67rem; color: #7ab3ff; }
.btn-logout { color: #4a5568; padding: 5px; border-radius: 5px; transition: color 0.15s; display: flex; align-items: center; }
.btn-logout:hover { color: var(--red); }

.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: var(--header-height); background: var(--bg-secondary); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; position: sticky; top: 0; z-index: 50; transition: background 0.25s; }
.topbar-title { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.2px; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar-time { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }
.page-content { padding: 1.25rem; flex: 1; }

.section { display: none; animation: fadeIn 0.2s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.2px; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; transition: border-color 0.2s, background 0.25s; }
.card:hover { border-color: rgba(79,142,247,0.15); }
.card-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 0.75rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; display: flex; align-items: center; gap: 1rem; transition: border-color 0.2s, background 0.25s; }
.stat-card:hover { border-color: var(--border-accent); }
.stat-icon-wrap { width: 40px; height: 40px; border-radius: 9px; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.stat-icon-wrap svg { width: 18px; height: 18px; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); line-height: 1; letter-spacing: -0.5px; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
th { padding: 0.6rem 0.875rem; background: rgba(0,0,0,0.04); color: var(--text-muted); font-weight: 600; text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--border); }
td { padding: 0.65rem 0.875rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(79,142,247,0.03); }
tr:last-child td { border-bottom: none; }
.loading-cell { text-align: center; padding: 2rem; color: var(--text-muted); }

.btn { display: inline-flex; align-items: center; gap: 5px; padding: 0.45rem 0.875rem; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; font-family: var(--font); white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }
.btn-success:hover { background: var(--green); color: #000; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.77rem; }
.btn-icon { padding: 0.35rem; }

.tab-group { display: flex; gap: 2px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.tab-btn { padding: 0.3rem 0.75rem; border-radius: 4px; font-size: 0.78rem; font-weight: 500; cursor: pointer; border: none; background: transparent; color: var(--text-secondary); transition: all 0.15s; font-family: var(--font); }
.tab-btn.active { background: var(--bg-card); color: var(--text-primary); }

.filter-row { display: flex; gap: 4px; margin-bottom: 0.875rem; flex-wrap: wrap; }
.filter-btn { padding: 0.3rem 0.75rem; border-radius: 20px; font-size: 0.77rem; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); transition: all 0.15s; font-family: var(--font); }
.filter-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.filter-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--border-accent); }

.form-group { margin-bottom: 0.875rem; }
.form-label { display: block; font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.35rem; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 0.55rem 0.8rem; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.84rem; transition: border-color 0.15s; font-family: var(--font); }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { cursor: pointer; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.75rem; text-align: center; }

.tag { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 0.68rem; font-weight: 600; }
.tag-role  { background: var(--accent-dim); color: var(--accent); }
.tag-green { background: var(--green-dim); color: var(--green); }
.tag-red   { background: var(--red-dim); color: var(--red); }
.tag-orange{ background: var(--orange-dim); color: var(--orange); }
.tag-blue  { background: var(--blue-dim); color: var(--blue); }
.tag-gray  { background: rgba(139,148,158,0.12); color: var(--text-secondary); }

.avatar { border-radius: 50%; object-fit: cover; background: var(--bg-secondary); }
.avatar-sm { width: 28px; height: 28px; }
.avatar-md { width: 40px; height: 40px; }
.member-row { display: flex; align-items: center; gap: 9px; }
.member-name { font-weight: 500; font-size: 0.84rem; }
.member-id { font-size: 0.68rem; color: var(--text-muted); font-family: var(--font-mono); }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-secondary); border-radius: 22px; transition: 0.25s; border: 1px solid var(--border); }
.toggle-slider:before { content: ''; position: absolute; height: 16px; width: 16px; left: 2px; bottom: 2px; background: var(--text-muted); border-radius: 50%; transition: 0.25s; }
input:checked + .toggle-slider { background: var(--green-dim); border-color: var(--green); }
input:checked + .toggle-slider:before { transform: translateX(18px); background: var(--green); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; font-size: 0.84rem; color: var(--text-secondary); }

.tags-container { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 0.5rem; }
.word-tag { display: inline-flex; align-items: center; gap: 5px; background: var(--red-dim); border: 1px solid rgba(248,113,113,0.2); color: var(--red); padding: 3px 9px; border-radius: 20px; font-size: 0.75rem; }
.word-tag .remove { cursor: pointer; opacity: 0.6; font-size: 0.8rem; }
.word-tag .remove:hover { opacity: 1; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.75rem; }
.file-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.4rem; transition: all 0.2s; }
.file-card:hover { border-color: var(--border-accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.file-icon-wrap { width: 44px; height: 44px; border-radius: 9px; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; margin-bottom: 0.3rem; color: var(--accent); }
.file-icon-wrap svg { width: 20px; height: 20px; }
.file-name { font-weight: 600; font-size: 0.875rem; word-break: break-all; }
.file-meta { font-size: 0.72rem; color: var(--text-secondary); }
.file-actions { display: flex; gap: 5px; margin-top: auto; padding-top: 0.6rem; border-top: 1px solid var(--border); }

.upload-zone { border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; cursor: pointer; transition: all 0.2s; color: var(--text-secondary); }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.upload-icon { color: var(--text-muted); margin-bottom: 0.75rem; display: flex; justify-content: center; }
.upload-zone p { font-size: 0.875rem; }
.upload-hint { font-size: 0.75rem; margin-top: 0.25rem; color: var(--text-muted); }
.file-preview-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.875rem; }

.alert-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.875rem; margin-bottom: 0.625rem; border-left: 3px solid var(--orange); }
.alert-item.high { border-left-color: var(--red); }
.alert-item.low  { border-left-color: var(--blue); }
.alert-item.resolved { opacity: 0.45; border-left-color: var(--text-muted); }
.alert-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; }
.alert-desc { font-size: 0.82rem; color: var(--text-secondary); }
.alert-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; width: min(90vw, 480px); max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,0.5); animation: modalIn 0.2s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-title { font-size: 0.95rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 3px; border-radius: 4px; display: flex; transition: color 0.15s; }
.modal-close:hover { color: var(--text-primary); }

#toast-container { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.4rem; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 1rem; display: flex; align-items: center; gap: 8px; font-size: 0.84rem; animation: slideIn 0.25s ease; box-shadow: var(--shadow); max-width: 320px; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.empty-state { text-align: center; padding: 2.5rem; color: var(--text-muted); }
.empty-state p { font-size: 0.875rem; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  #menu-toggle { display: flex !important; }
}

.separator { height: 1px; background: var(--border); margin: 0.875rem 0; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.font-mono { font-family: var(--font-mono); }
.flex { display: flex; }
.align-center { align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 0.875rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.875rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.875rem; }
.w-full { width: 100%; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
