/* ============================================================
   LEXANT DASHBOARD - style.css
   ============================================================ */

:root {
  --primary:      #1e3a5f;
  --primary-dark: #152d4a;
  --accent:       #c9a84c;
  --accent-light: #f0d890;
  --bg:           #f4f6fa;
  --bg-card:      #ffffff;
  --text:         #1a1a2e;
  --text-muted:   #6b7280;
  --border:       #e2e8f0;
  --danger:       #dc2626;
  --success:      #16a34a;
  --warning:      #d97706;
  --info:         #2563eb;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
  --sidebar-w:    240px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── LOGIN PAGE ─────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.login-box {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 40px 44px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── FORMS ──────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  transition: border-color .2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); background: #fff; }
.form-group textarea { resize: vertical; min-height: 80px; }

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent    { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #b8943e; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.9); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }
.btn-ghost     { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); background: #f0f4ff; }
.btn-sm        { padding: 6px 12px; font-size: 13px; }
.btn-full      { width: 100%; justify-content: center; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── SHELL ──────────────────────────────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo h2 { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.sidebar-logo span { font-size: 12px; opacity: .6; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { padding: 8px 16px 4px; font-size: 11px; font-weight: 700; opacity: .45; letter-spacing: 1px; text-transform: uppercase; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  font-size: 14px;
  border-radius: 0;
  transition: background .15s, color .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.nav-item .nav-icon { font-size: 18px; min-width: 22px; text-align: center; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 13px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-user .avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
}
.sidebar-user .user-info { flex: 1; overflow: hidden; }
.sidebar-user .user-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; opacity: .6; }

/* ── MAIN CONTENT ───────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--primary); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

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

/* ── CARDS ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }

/* ── STAT CARDS ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-card .stat-icon  { font-size: 28px; }

/* ── APP GRID (Dashboard) ───────────────────────────── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 10px 0;
}
.app-tile {
  border-radius: 14px;
  padding: 28px 20px 22px;
  cursor: pointer;
  text-align: center;
  transition: transform .18s, box-shadow .18s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.app-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.app-tile .tile-icon { font-size: 40px; margin-bottom: 12px; display: block; }
.app-tile .tile-name { font-size: 15px; font-weight: 700; }
.app-tile .tile-desc { font-size: 12px; opacity: .75; margin-top: 5px; }

/* ── TABLES ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; background: var(--bg); }
tr:hover td { background: #f8faff; }

/* ── BADGES ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #f1f5f9; color: #475569; }

/* ── MODAL ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.modal-large { max-width: 860px; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 20px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted);
  line-height: 1;
}
.modal-close:hover { color: var(--danger); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }

/* ── TABS ───────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 4px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
  width: fit-content;
}
.tab-btn {
  padding: 8px 18px;
  border: none; background: none; cursor: pointer;
  border-radius: 8px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); transition: all .15s;
}
.tab-btn.active { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow); }

/* ── ALERTS ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; margin-bottom: 14px;
  display: flex; gap: 8px; align-items: flex-start;
}
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #16a34a; }
.alert-warning { background: #fef9c3; color: #854d0e; border-left: 4px solid #d97706; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #2563eb; }

/* ── SEARCH BAR ─────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-bar input { flex: 1; min-width: 200px; padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; }
.search-bar input:focus { border-color: var(--primary); }

/* ── CHIP MULTISELECT ───────────────────────────────── */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #e0e7ff; color: #3730a3;
  border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 600;
}
.chip-remove { cursor: pointer; font-size: 14px; line-height: 1; color: #6366f1; }
.chip-remove:hover { color: var(--danger); }

/* ── TOGGLE ─────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle {
  width: 42px; height: 24px; background: var(--border); border-radius: 12px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle.on { background: var(--success); }
.toggle.on::after { transform: translateX(18px); }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── UTILS ──────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mt-2 { margin-top: 8px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }

/* Loading spinner */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
