/* =====================================================================
   Schoooli School Management — Core Theme
   Carbon-copy styling of the reference dashboard: white cards, lavender
   sidebar highlight, purple/orange/blue/green accents, pill search bar.
   ===================================================================== */

:root{
  --primary:#6C5DD3;
  --primary-dark:#5b4cc4;
  --primary-light:#EFEBFB;
  --orange:#FFA53D;
  --orange-light:#FFF1E2;
  --blue:#4D8CFE;
  --blue-light:#E9F0FF;
  --green:#2ED47A;
  --green-light:#E6FAF0;
  --pink-light:#FDEAF2;
  --pink:#F564A9;
  --red:#FF5B5B;
  --red-light:#FFEAEA;

  --text-dark:#1E1B39;
  --text-muted:#8C8CA1;
  --text-soft:#A6A6BD;
  --bg-page:#F7F7FB;
  --card-bg:#FFFFFF;
  --border-color:#EEEEF4;

  --radius-lg:20px;
  --radius-md:14px;
  --radius-sm:10px;
  --sidebar-width:264px;
  --topbar-height:78px;
  --shadow-card:0 4px 24px rgba(30,27,57,0.05);
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;
  background:var(--bg-page);
  color:var(--text-dark);
  font-size:14.5px;
  line-height:1.5;
}
h1,h2,h3,h4,h5,h6{font-family:'Poppins','Inter',sans-serif;color:var(--text-dark);margin:0;}
a{text-decoration:none;color:inherit;}
ul{margin:0;padding:0;list-style:none;}
button{font-family:inherit;cursor:pointer;}
img{max-width:100%;}

/* =========================== LAYOUT =========================== */
.app-wrapper{display:flex;min-height:100vh;}

.sidebar{
  width:var(--sidebar-width);
  background:#fff;
  border-right:1px solid var(--border-color);
  position:fixed;
  top:0;left:0;bottom:0;
  display:flex;
  flex-direction:column;
  z-index:1000;
  transition:transform .25s ease;
}
.sidebar-brand{
  display:flex;align-items:center;gap:10px;
  padding:26px 24px 18px;
}
.sidebar-brand .logo-box{
  width:38px;height:38px;border-radius:11px;
  background:var(--primary);
  display:flex;align-items:center;justify-content:center;
  color:#fff;font-size:18px;flex-shrink:0;
}
.sidebar-brand .brand-name{font-weight:700;font-size:19px;letter-spacing:-.3px;}

.sidebar-nav{flex:1;overflow-y:auto;padding:6px 14px;}
.sidebar-nav::-webkit-scrollbar{width:4px;}
.sidebar-nav::-webkit-scrollbar-thumb{background:var(--border-color);border-radius:4px;}

.nav-item{margin-bottom:2px;}
.nav-link{
  display:flex;align-items:center;gap:12px;
  padding:11px 14px;border-radius:12px;
  color:var(--text-muted);font-weight:500;font-size:14px;
  transition:background .15s,color .15s;
}
.nav-link i{font-size:17px;width:20px;text-align:center;flex-shrink:0;}
.nav-link:hover{background:var(--primary-light);color:var(--primary);}
.nav-link.active{background:var(--primary-light);color:var(--primary);font-weight:600;}
.nav-link .chev{margin-left:auto;font-size:12px;transition:transform .15s;}
.nav-link.has-children.open .chev{transform:rotate(90deg);}
.nav-submenu{padding-left:34px;display:none;}
.nav-submenu.open{display:block;}
.nav-submenu .nav-link{padding:9px 14px;font-size:13.5px;}

.sidebar-upgrade{
  margin:14px;padding:18px;border-radius:18px;
  background:linear-gradient(145deg,var(--primary),#9b7ef0);
  color:#fff;
}
.sidebar-upgrade .rocket{font-size:26px;margin-bottom:8px;display:block;}
.sidebar-upgrade p{font-size:12.5px;opacity:.92;margin:0 0 12px;line-height:1.4;}
.sidebar-upgrade button{
  width:100%;background:#fff;color:var(--primary);border:none;
  padding:9px 0;border-radius:10px;font-weight:600;font-size:13px;
}

.main-content{
  margin-left:var(--sidebar-width);
  width:calc(100% - var(--sidebar-width));
  min-height:100vh;
  display:flex;flex-direction:column;
}

/* =========================== TOPBAR =========================== */
.topbar{
  height:var(--topbar-height);
  display:flex;align-items:center;justify-content:space-between;
  padding:0 32px;background:var(--bg-page);
  position:sticky;top:0;z-index:900;
}
.topbar-left{display:flex;align-items:center;gap:16px;flex:1;}
.sidebar-toggle{
  display:none;background:#fff;border:1px solid var(--border-color);
  width:40px;height:40px;border-radius:10px;align-items:center;justify-content:center;
  font-size:18px;color:var(--text-dark);
}
.search-pill{
  display:flex;align-items:center;gap:10px;
  background:#fff;border-radius:30px;padding:11px 20px;
  width:100%;max-width:380px;border:1px solid var(--border-color);
}
.search-pill input{border:none;outline:none;background:transparent;width:100%;font-size:13.5px;}
.search-pill i{color:var(--text-soft);}
.search-results{
  position:absolute;top:60px;background:#fff;border-radius:14px;box-shadow:var(--shadow-card);
  width:100%;max-width:380px;max-height:320px;overflow-y:auto;display:none;z-index:1100;border:1px solid var(--border-color);
}
.search-results.show{display:block;}
.search-results a{display:flex;gap:10px;align-items:center;padding:10px 16px;font-size:13px;border-bottom:1px solid var(--border-color);}
.search-results a:hover{background:var(--bg-page);}
.search-results .empty{padding:16px;text-align:center;color:var(--text-muted);font-size:13px;}

.topbar-right{display:flex;align-items:center;gap:18px;}
.icon-btn{
  width:42px;height:42px;border-radius:50%;background:#fff;border:1px solid var(--border-color);
  display:flex;align-items:center;justify-content:center;position:relative;color:var(--text-dark);font-size:16px;
}
.icon-btn .dot{position:absolute;top:9px;right:10px;width:7px;height:7px;border-radius:50%;background:var(--red);}
.user-chip{display:flex;align-items:center;gap:10px;position:relative;cursor:pointer;}
.user-chip img{width:42px;height:42px;border-radius:50%;object-fit:cover;background:var(--primary-light);}
.user-chip .name{font-weight:600;font-size:13.5px;}
.user-chip .role{font-size:12px;color:var(--text-muted);}
.user-dropdown{
  position:absolute;top:54px;right:0;background:#fff;border-radius:14px;box-shadow:var(--shadow-card);
  width:190px;padding:8px;display:none;z-index:1100;border:1px solid var(--border-color);
}
.user-dropdown.show{display:block;}
.user-dropdown a{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:9px;font-size:13.5px;color:var(--text-dark);}
.user-dropdown a:hover{background:var(--bg-page);}

.page-body{padding:0 32px 40px;flex:1;}
.page-header{margin-bottom:24px;}
.page-header h1{font-size:24px;font-weight:700;}
.page-header p{color:var(--text-muted);font-size:13.5px;margin-top:4px;}

/* =========================== CARDS =========================== */
.card{
  background:var(--card-bg);border-radius:var(--radius-lg);
  box-shadow:var(--shadow-card);padding:22px;border:1px solid var(--border-color);
}
.card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;}
.card-header h3{font-size:16px;font-weight:600;}
.card-header .view-all{font-size:12.5px;color:var(--primary);font-weight:600;}

.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:24px;}
.stat-grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:20px;margin-bottom:24px;}
.dashboard-columns{display:grid;grid-template-columns:2fr 1.3fr 1fr;gap:20px;align-items:start;}
.dash-col{display:flex;flex-direction:column;gap:20px;}
.donut-chart{width:170px;height:170px;border-radius:50%;display:flex;align-items:center;justify-content:center;position:relative;}
.donut-chart .donut-center{width:118px;height:118px;border-radius:50%;background:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;}
.donut-chart .donut-center .num{font-size:20px;font-weight:700;}
.donut-chart .donut-center .lbl{font-size:11px;color:var(--text-muted);}
.stat-card{
  background:#fff;border-radius:var(--radius-lg);padding:20px 22px;
  display:flex;align-items:center;justify-content:space-between;
  box-shadow:var(--shadow-card);border:1px solid var(--border-color);
}
.stat-card .label{color:var(--text-muted);font-size:13px;margin-bottom:6px;}
.stat-card .value{font-size:24px;font-weight:700;}
.stat-icon{width:50px;height:50px;border-radius:14px;display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0;}
.stat-icon.purple{background:var(--primary-light);color:var(--primary);}
.stat-icon.blue{background:var(--blue-light);color:var(--blue);}
.stat-icon.orange{background:var(--orange-light);color:var(--orange);}
.stat-icon.green{background:var(--green-light);color:var(--green);}

.grid-3{display:grid;grid-template-columns:2fr 1.3fr 1fr;gap:20px;}
.grid-2{display:grid;grid-template-columns:1.6fr 1fr;gap:20px;}
.dashboard-grid{display:grid;grid-template-columns:2fr 1.4fr 1fr;gap:20px;margin-bottom:20px;}

/* class routine cards */
.routine-card{border-radius:16px;padding:16px;color:#fff;margin-bottom:10px;}
.routine-card.month-purple{background:linear-gradient(135deg,var(--primary),#8b78e8);}
.routine-card.month-dark{background:linear-gradient(135deg,#2B2B42,#15131F);}
.routine-card .month-label{font-size:12px;opacity:.85;margin-bottom:2px;}
.routine-card .month-title{font-weight:700;font-size:15px;margin-bottom:10px;}
.routine-card .btn-download{
  background:rgba(255,255,255,.18);border:none;color:#fff;width:100%;
  padding:9px 0;border-radius:9px;font-size:12.5px;font-weight:600;
}

/* library list */
.list-row{display:flex;align-items:center;gap:12px;padding:11px 0;border-bottom:1px solid var(--border-color);}
.list-row:last-child{border-bottom:none;}
.list-row .file-icon{width:38px;height:38px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:16px;flex-shrink:0;}
.list-row .file-info{flex:1;}
.list-row .file-info .title{font-weight:600;font-size:13.5px;}
.list-row .file-info .meta{font-size:12px;color:var(--text-muted);}
.list-row .action-link{font-size:12px;color:var(--primary);font-weight:600;}

/* donut / course stats */
.donut-wrap{display:flex;flex-direction:column;align-items:center;}
.donut-legend{display:flex;gap:14px;margin-top:14px;flex-wrap:wrap;justify-content:center;}
.donut-legend .legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text-muted);}
.legend-dot{width:9px;height:9px;border-radius:50%;display:inline-block;}

/* table */
.table-wrap{overflow-x:auto;}
table.data-table{width:100%;border-collapse:collapse;}
table.data-table th{
  text-align:left;font-size:12px;color:var(--text-muted);font-weight:600;
  padding:10px 12px;border-bottom:1px solid var(--border-color);white-space:nowrap;
}
table.data-table td{padding:12px;border-bottom:1px solid var(--border-color);font-size:13.5px;white-space:nowrap;}
table.data-table tr.highlight{background:var(--pink-light);}
table.data-table tr:hover{background:var(--bg-page);}
.avatar-sm{width:32px;height:32px;border-radius:50%;object-fit:cover;background:var(--primary-light);}
.avatar-name{display:flex;align-items:center;gap:10px;font-weight:600;}

.badge{display:inline-block;padding:4px 12px;border-radius:30px;font-size:11.5px;font-weight:600;}
.badge.green{background:var(--green-light);color:var(--green);}
.badge.orange{background:var(--orange-light);color:var(--orange);}
.badge.red{background:var(--red-light);color:var(--red);}
.badge.purple{background:var(--primary-light);color:var(--primary);}
.badge.gray{background:var(--bg-page);color:var(--text-muted);}

/* progress bars (best performers) */
.perf-row{display:flex;align-items:center;gap:14px;margin-bottom:16px;}
.perf-row:last-child{margin-bottom:0;}
.perf-row .perf-label{width:60px;font-size:12.5px;color:var(--text-muted);flex-shrink:0;}
.perf-bar-track{flex:1;height:30px;background:var(--bg-page);border-radius:8px;position:relative;overflow:hidden;}
.perf-bar-fill{height:100%;border-radius:8px;display:flex;align-items:center;padding:0 10px;font-size:11.5px;color:#fff;font-weight:600;}

/* promo card */
.promo-card{
  border-radius:18px;padding:20px;color:#fff;
  background:linear-gradient(150deg,#6C5DD3,#4D8CFE);
  display:flex;flex-direction:column;gap:10px;
}
.promo-card h4{color:#fff;font-size:15px;}
.promo-card p{font-size:12px;opacity:.9;margin:0;}
.promo-card button{align-self:flex-start;background:#fff;color:var(--primary);border:none;padding:8px 18px;border-radius:9px;font-weight:600;font-size:12.5px;}

/* notifications */
.notif-row{display:flex;gap:12px;padding:11px 0;border-bottom:1px solid var(--border-color);align-items:flex-start;}
.notif-row:last-child{border-bottom:none;}
.notif-icon{width:36px;height:36px;border-radius:10px;background:var(--orange-light);color:var(--orange);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.notif-info .title{font-weight:600;font-size:13px;}
.notif-info .meta{font-size:11.5px;color:var(--text-muted);}

/* =========================== FORMS / BUTTONS =========================== */
.btn{
  display:inline-flex;align-items:center;gap:8px;justify-content:center;
  padding:10px 20px;border-radius:11px;border:none;font-weight:600;font-size:13.5px;
  cursor:pointer;transition:opacity .15s;
}
.btn:hover{opacity:.9;}
.btn-primary{background:var(--primary);color:#fff;}
.btn-outline{background:#fff;border:1px solid var(--border-color);color:var(--text-dark);}
.btn-danger{background:var(--red);color:#fff;}
.btn-success{background:var(--green);color:#fff;}
.btn-sm{padding:7px 14px;font-size:12.5px;}
.btn-block{width:100%;}

.form-group{margin-bottom:16px;}
.form-group label{display:block;font-size:13px;font-weight:600;margin-bottom:7px;}
.form-control{
  width:100%;padding:11px 14px;border-radius:10px;border:1px solid var(--border-color);
  font-size:13.5px;background:#fff;color:var(--text-dark);outline:none;font-family:inherit;
}
.form-control:focus{border-color:var(--primary);}
select.form-control{appearance:none;}
textarea.form-control{resize:vertical;min-height:90px;}
.form-row{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;}
.form-help{font-size:11.5px;color:var(--text-muted);margin-top:5px;}
.input-error{color:var(--red);font-size:12px;margin-top:5px;}

.alert{padding:14px 18px;border-radius:12px;font-size:13.5px;margin-bottom:18px;display:flex;align-items:center;gap:10px;}
.alert-success{background:var(--green-light);color:#1f9d5e;}
.alert-error{background:var(--red-light);color:#c4373e;}
.alert-info{background:var(--blue-light);color:#2f63cc;}
.alert-warning{background:var(--orange-light);color:#b5680f;}

/* modal */
.modal-backdrop{
  position:fixed;inset:0;background:rgba(15,13,30,.45);display:none;
  align-items:center;justify-content:center;z-index:2000;padding:20px;
}
.modal-backdrop.show{display:flex;}
.modal-box{background:#fff;border-radius:18px;width:100%;max-width:520px;max-height:90vh;overflow-y:auto;padding:26px;}
.modal-box.modal-lg{max-width:760px;}
.modal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px;}
.modal-header h3{font-size:17px;}
.modal-close{background:none;border:none;font-size:20px;color:var(--text-muted);}

/* tabs */
.tabs{display:flex;gap:6px;border-bottom:1px solid var(--border-color);margin-bottom:20px;overflow-x:auto;}
.tab-link{padding:10px 18px;font-size:13.5px;font-weight:600;color:var(--text-muted);border-bottom:2px solid transparent;white-space:nowrap;cursor:pointer;}
.tab-link.active{color:var(--primary);border-color:var(--primary);}

/* calendar */
.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;}
.calendar-day-name{text-align:center;font-size:12px;color:var(--text-muted);font-weight:600;padding:6px 0;}
.calendar-cell{
  min-height:88px;border-radius:12px;border:1px solid var(--border-color);padding:8px;
  font-size:12px;position:relative;background:#fff;
}
.calendar-cell.empty{background:transparent;border:none;}
.calendar-cell .day-num{font-weight:600;font-size:12.5px;margin-bottom:4px;}
.calendar-cell.today{border-color:var(--primary);}
.calendar-cell .evt-pill{
  background:var(--primary-light);color:var(--primary);font-size:10.5px;padding:2px 6px;
  border-radius:6px;margin-bottom:3px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}

/* utility */
.flex{display:flex;}
.flex-between{display:flex;align-items:center;justify-content:space-between;}
.gap-10{gap:10px;}
.mt-10{margin-top:10px;}
.mt-20{margin-top:20px;}
.mb-0{margin-bottom:0;}
.text-muted{color:var(--text-muted);}
.text-center{text-align:center;}
.fw-600{font-weight:600;}
.w-100{width:100%;}

/* =========================== AUTH PAGES =========================== */
.auth-wrapper{
  min-height:100vh;display:flex;align-items:center;justify-content:center;
  background:var(--bg-page);padding:20px;
}
.auth-box{background:#fff;border-radius:22px;box-shadow:var(--shadow-card);padding:40px;width:100%;max-width:420px;}
.auth-box .logo-row{display:flex;align-items:center;gap:10px;justify-content:center;margin-bottom:24px;}
.auth-box h2{text-align:center;font-size:21px;margin-bottom:6px;}
.auth-box p.subtitle{text-align:center;color:var(--text-muted);font-size:13px;margin-bottom:26px;}
.auth-box .demo-creds{background:var(--bg-page);border-radius:12px;padding:14px;font-size:12px;color:var(--text-muted);margin-top:18px;}

/* =========================== RESPONSIVE =========================== */
.sidebar-overlay{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:999;display:none;}
.sidebar-overlay.show{display:block;}

@media (max-width: 1180px){
  .dashboard-grid,.grid-3{grid-template-columns:1fr 1fr;}
  .dashboard-grid > :last-child,.grid-3 > :last-child{grid-column:span 2;}
  .stat-grid-4{grid-template-columns:repeat(2,1fr);}
  .dashboard-columns{grid-template-columns:1fr 1fr;}
  .dashboard-columns > :last-child{grid-column:span 2;}
}

@media (max-width: 992px){
  .sidebar{transform:translateX(-100%);}
  .sidebar.open{transform:translateX(0);}
  .main-content{margin-left:0;width:100%;}
  .sidebar-toggle{display:flex;}
  .stat-grid{grid-template-columns:1fr;}
  .stat-grid-4{grid-template-columns:1fr;}
  .dashboard-grid,.grid-3,.grid-2{grid-template-columns:1fr;}
  .dashboard-grid > :last-child,.grid-3 > :last-child{grid-column:auto;}
  .dashboard-columns{grid-template-columns:1fr;}
  .dashboard-columns > :last-child{grid-column:auto;}
  .search-pill{max-width:220px;}
  .page-body{padding:0 16px 30px;}
  .topbar{padding:0 16px;}
  .form-row{grid-template-columns:1fr;}
}

@media (max-width: 560px){
  .topbar-left .search-pill{display:none;}
  .user-chip .name,.user-chip .role{display:none;}
  .stat-card{flex-direction:row;}
}
