/* ===================================================================
   EduSphere SaaS — Shared Theme
   Extracted & extended from the supplied Dreams LMS UI design
   =================================================================== */

:root {
  --primary: #FF6B35;
  --primary-light: #fff3ef;
  --primary-dark: #e55a24;
  --secondary: #392C7D;
  --accent: #00C9A7;
  --bg: #F8F9FC;
  --sidebar-bg: #fff;
  --card-bg: #fff;
  --text-dark: #1a1a2e;
  --text-mid: #4b5563;
  --text-light: #9ca3af;
  --border: #e9ecef;
  --shadow: 0 4px 24px rgba(0,0,0,0.07);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
  --header-h: 68px;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
}

a { color: inherit; }

/* ── TOP NAV ───────────────────────────────── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  box-shadow: var(--shadow-sm);
}
.topnav-left { display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #ff9a5c);
  display: flex; align-items: center; justify-content: center;
}
.logo-icon svg { width: 20px; height: 20px; fill: #fff; }
.logo-text { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.25rem; color: var(--text-dark); }
.logo-text span { color: var(--primary); }

.hamburger {
  background: none; border: none; cursor: pointer;
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  transition: background .2s;
}
.hamburger:hover { background: var(--bg); }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text-mid); border-radius: 2px; transition: .3s; }

.topnav-right { display: flex; align-items: center; gap: 12px; }

.nav-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px;
}
.nav-search input {
  border: none; background: none; outline: none;
  font-size: .875rem; color: var(--text-dark); width: 180px;
  font-family: inherit;
}
.nav-search i { color: var(--text-light); font-size: .85rem; }

.nav-icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s; text-decoration: none;
}
.nav-icon-btn:hover { background: var(--primary-light); }
.nav-icon-btn i { color: var(--text-mid); font-size: .95rem; }
.nav-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--primary); color: #fff;
  font-size: .65rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 14px 5px 5px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 40px; cursor: pointer; transition: background .2s;
  text-decoration: none;
  position: relative;
}
.user-pill:hover { background: var(--primary-light); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg,#FF6B35,#392C7D);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: #fff;
}
.user-name { font-size: .82rem; font-weight: 600; color: var(--text-dark); }
.user-pill i { font-size: .7rem; color: var(--text-light); }

.user-dropdown {
  position: absolute; top: 48px; right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  min-width: 180px; display: none; z-index: 200; overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: .82rem; text-decoration: none;
  color: var(--text-mid);
}
.user-dropdown a:hover { background: var(--primary-light); color: var(--primary); }

/* ── LAYOUT ────────────────────────────────── */
.layout { display: flex; padding-top: var(--header-h); min-height: 100vh; }

/* ── SIDEBAR ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 50;
  transition: transform .3s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-profile {
  margin: 20px 16px 16px;
  background: linear-gradient(135deg, var(--secondary) 0%, #6a3de8 100%);
  border-radius: var(--radius);
  padding: 22px 18px 18px;
  color: #fff;
  position: relative; overflow: hidden;
}
.sidebar-profile::before {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.sidebar-profile::after {
  content: ''; position: absolute; bottom: -30px; right: 20px;
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.sp-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg,#FF6B35,#ffbd8a);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800; color: #fff;
  border: 3px solid rgba(255,255,255,.3);
  margin-bottom: 10px; position: relative; z-index: 1;
}
.sp-name { font-weight: 700; font-size: 1rem; margin-bottom: 2px; position: relative; z-index: 1; }
.sp-role { font-size: .75rem; opacity: .75; margin-bottom: 14px; position: relative; z-index: 1; }
.sp-btns { display: flex; gap: 8px; position: relative; z-index: 1; }
.sp-btn {
  flex: 1; padding: 7px 6px; border-radius: 8px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: .72rem; font-weight: 600;
  cursor: pointer; text-align: center; transition: background .2s;
  text-decoration: none; display: block;
  font-family: inherit;
}
.sp-btn:hover { background: rgba(255,255,255,.3); }
.sp-btn.primary { background: var(--primary); border-color: var(--primary); }
.sp-btn.primary:hover { background: var(--primary-dark); }

.sidebar-section { padding: 10px 16px 4px; }
.sidebar-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  color: var(--text-light); text-transform: uppercase; margin-bottom: 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-mid);
  font-size: .875rem; font-weight: 500;
  transition: all .2s; margin-bottom: 2px;
  cursor: pointer;
}
.nav-item i { width: 18px; text-align: center; font-size: .9rem; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.active i { color: var(--primary); }
.nav-item .nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); margin-left: auto;
  animation: pulse 2s infinite;
}
.nav-item .nav-count {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 20px;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

.sidebar-divider { height: 1px; background: var(--border); margin: 10px 16px; }

/* ── MAIN CONTENT ──────────────────────────── */
.main {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 28px 28px 60px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 22px;
}
.breadcrumb a { text-decoration: none; color: var(--text-light); font-size: .82rem; transition: color .2s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb i { font-size: .6rem; color: var(--text-light); }
.breadcrumb span { font-size: .82rem; font-weight: 600; color: var(--text-dark); }

.page-title-row { display:flex; align-items:center; justify-content:space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title {
  font-size: 1.5rem; font-weight: 800;
  font-family: 'Nunito', sans-serif;
  color: var(--text-dark);
}
.page-subtitle { font-size: .85rem; color: var(--text-light); margin-top: 4px; }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: .84rem; font-weight: 700; font-family: inherit;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
  transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text-mid); border-color: var(--border); }
.btn-secondary:hover { background: #eef0f5; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover { background: #00a889; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 6px 12px; font-size: .74rem; }

/* ── STAT CARDS ─────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 18px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  transition: transform .25s, box-shadow .25s;
  animation: fadeUp .5s ease both;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
@keyframes fadeUp {
  from { opacity:0; transform: translateY(18px); }
  to   { opacity:1; transform: translateY(0); }
}
.stat-card:nth-child(1) { animation-delay:.05s; }
.stat-card:nth-child(2) { animation-delay:.1s; }
.stat-card:nth-child(3) { animation-delay:.15s; }
.stat-card:nth-child(4) { animation-delay:.2s; }

.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-icon.orange { background: #fff3ef; color: var(--primary); }
.stat-icon.purple { background: #f0ecff; color: #7c5cbf; }
.stat-icon.green  { background: #e6faf7; color: var(--accent); }
.stat-icon.blue   { background: #e8f4ff; color: #3b82f6; }
.stat-icon.pink   { background: #ffeef5; color: #e91e8c; }
.stat-icon.teal   { background: #e8fff8; color: #0d9488; }
.stat-icon.red    { background: #fef2f2; color: #ef4444; }

.stat-info { flex: 1; }
.stat-label { font-size: .78rem; color: var(--text-light); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: 800; font-family: 'Nunito', sans-serif; color: var(--text-dark); }

.stat-trend {
  display: flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 600; margin-top: 4px;
}
.stat-trend.up { color: #10b981; }
.stat-trend.down { color: #ef4444; }

/* ── CARD ───────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  animation: fadeUp .5s ease both;
  animation-delay: .2s;
  margin-bottom: 22px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.card-body { padding: 22px; }
.card-title {
  font-size: 1rem; font-weight: 700; color: var(--text-dark);
  font-family: 'Nunito', sans-serif;
}
.card-action {
  font-size: .78rem; font-weight: 600; color: var(--primary);
  text-decoration: none; display: flex; align-items: center; gap: 4px;
  cursor: pointer; transition: opacity .2s;
}
.card-action:hover { opacity: .75; }

/* ── TABLES ──────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr { background: var(--bg); }
.data-table th {
  padding: 11px 18px; text-align: left;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-light);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 18px; font-size: .84rem; color: var(--text-mid);
  border-top: 1px solid var(--border); vertical-align: middle;
}
.data-table tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--primary-light); }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fff3ef; color: var(--primary); }
.badge-blue { background: #e0f2fe; color: #0369a1; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

.entity-cell { display: flex; align-items: center; gap: 12px; }
.entity-thumb {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg,#f0ecff,#e8f4ff);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: .78rem; font-weight: 700; color: #7c5cbf;
}
.entity-name { font-weight: 600; color: var(--text-dark); font-size: .84rem; line-height: 1.35; }
.entity-name small { font-weight: 400; color: var(--text-light); font-size: .72rem; display: block; margin-top: 1px; }

.action-icons { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: #fff; color: var(--text-mid);
  cursor: pointer; text-decoration: none; font-size: .78rem; transition: all .15s;
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary-light); }
.icon-btn.danger:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger-light); }

/* ── FORMS ──────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { margin-bottom: 18px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-dark); margin-bottom: 6px; }
.form-label .req { color: var(--danger); }

.settings-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.settings-tab-btn {
  background: none; border: none; cursor: pointer; font-family: inherit;
  padding: 12px 18px; font-size: .88rem; font-weight: 600; color: var(--text-light);
  border-bottom: 2px solid transparent; white-space: nowrap; transition: color .2s, border-color .2s;
}
.settings-tab-btn:hover { color: var(--primary); }
.settings-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.settings-tab-panel { display: none; }
.settings-tab-panel.active { display: block; }
.form-control {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: .86rem; font-family: inherit;
  background: #fff; color: var(--text-dark); outline: none; transition: border-color .2s;
}
.form-control:focus { border-color: var(--primary); }
.form-hint { font-size: .72rem; color: var(--text-light); margin-top: 4px; }
select.form-control { cursor: pointer; }

/* ── ALERTS ──────────────────────────── */
.alert {
  padding: 13px 18px; border-radius: var(--radius-sm);
  font-size: .84rem; font-weight: 500; margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #e0f2fe; color: #0369a1; }
.alert-warning { background: var(--warning-light); color: #92400e; }

/* ── FOOTER AREA ────────────────────────────── */
.footer-note {
  margin-top: 30px; text-align: center;
  font-size: .78rem; color: var(--text-light);
}
.footer-note a { color: var(--primary); text-decoration: none; }

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

/* ── AUTH PAGES ──────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--secondary) 0%, #241b57 100%);
  padding: 24px;
}
.auth-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 420px; padding: 40px 36px; animation: fadeUp .5s ease both;
}
.auth-logo { display:flex; align-items:center; gap:10px; justify-content:center; margin-bottom: 8px; }
.auth-title { text-align: center; font-family:'Nunito',sans-serif; font-weight: 800; font-size: 1.3rem; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-light); font-size: .84rem; margin-bottom: 28px; }
.auth-demo-box {
  background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 14px; margin-top: 22px; font-size: .74rem; color: var(--text-mid); line-height: 1.7;
}
.auth-demo-box b { color: var(--text-dark); }

/* ── MODAL ─────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,26,46,.5);
  display: none; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 420px;
  padding: 26px; box-shadow: var(--shadow);
}
.modal-title { font-family:'Nunito',sans-serif; font-weight: 800; font-size: 1.1rem; margin-bottom: 10px; }
.modal-text { font-size: .85rem; color: var(--text-mid); margin-bottom: 22px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── RESPONSIVE ─────────────────────────────── */
@media(max-width:1100px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media(max-width:768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .nav-search { display: none; }
}
@media(max-width:480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
