/* ==========================================================================
   Class Management System — "Bright Campus" mobile-app theme
   Palette: Violet #5B4FE9 · Coral #FF6B6B · Mint #1FCB8F · Amber #FFB020
   Type: Poppins (display) + Inter (body)
   ========================================================================== */

:root{
  --violet:        #5B4FE9;
  --violet-dark:    #4338CC;
  --violet-light:   #EEECFE;
  --coral:          #FF6B6B;
  --coral-light:    #FFE9E9;
  --mint:           #1FCB8F;
  --mint-light:     #E3FBF2;
  --amber:          #FFB020;
  --amber-light:    #FFF3DE;
  --sky:            #2FB2E8;
  --sky-light:      #E4F6FD;

  --bg:             #F5F6FC;
  --surface:        #FFFFFF;
  --border:         #ECEDF7;
  --text:           #1E2140;
  --text-muted:     #8A8FB3;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 10px 30px -14px rgba(91, 79, 233, 0.25);
  --shadow-pop:  0 16px 40px -12px rgba(30, 33, 64, 0.28);
}

*{ box-sizing: border-box; }

html,body{
  height: 100%;
}

body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px; /* space for bottom tab bar on mobile */
}

h1,h2,h3,h4,h5,h6, .display{
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

a{ color: var(--violet); text-decoration:none; }

/* ---------------------------------------------------------------------- */
/* App shell                                                              */
/* ---------------------------------------------------------------------- */
.app-topbar{
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(135deg, var(--violet) 0%, #7C6FF2 100%);
  color: #fff;
  padding: 18px 18px 34px;
  border-radius: 0 0 26px 26px;
  box-shadow: var(--shadow-pop);
}
.app-topbar .row-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.app-topbar .brand{
  display:flex;
  align-items:center;
  gap:10px;
}
.app-topbar .brand-logo{
  width:40px; height:40px; border-radius:12px;
  background: rgba(255,255,255,.18);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-family:'Poppins',sans-serif; font-size:16px;
  overflow:hidden;
}
.app-topbar .brand-logo img{ width:100%; height:100%; object-fit:cover; }
.app-topbar .brand-name{ font-family:'Poppins',sans-serif; font-weight:600; font-size:15px; line-height:1.1;}
.app-topbar .brand-sub{ font-size:11.5px; opacity:.8; }
.app-topbar .greeting{
  margin-top:16px;
  font-family:'Poppins',sans-serif;
  font-size:20px;
  font-weight:600;
}
.app-topbar .greeting-sub{
  font-size:12.5px;
  opacity:.85;
  margin-top:2px;
}
.icon-btn{
  width:38px; height:38px; border-radius:12px;
  background: rgba(255,255,255,.18);
  border:none; color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:16px;
  cursor:pointer;
  transition: background .15s ease;
}
.icon-btn:hover{ background: rgba(255,255,255,.3); color:#fff; }

/* Page container */
.app-content{
  max-width: 1180px;
  margin: -18px auto 0;
  padding: 0 16px 30px;
}
.page-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin: 22px 0 16px;
  flex-wrap: wrap;
  gap:10px;
}
.page-head h1{ font-size: 21px; }
.page-head .page-sub{ color:var(--text-muted); font-size:13px; margin-top:2px;}

/* ---------------------------------------------------------------------- */
/* Cards                                                                  */
/* ---------------------------------------------------------------------- */
.card-app{
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.stat-card{
  border-radius: var(--radius-md);
  padding: 16px;
  color:#fff;
  position:relative;
  overflow:hidden;
  min-height: 104px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.stat-card .stat-icon{
  width:34px;height:34px;border-radius:10px;
  background:rgba(255,255,255,.25);
  display:flex;align-items:center;justify-content:center;
  font-size:15px;
}
.stat-card .stat-num{ font-family:'Poppins',sans-serif; font-size:26px; font-weight:700; }
.stat-card .stat-label{ font-size:12px; opacity:.9; }
.bg-violet{ background: linear-gradient(135deg,var(--violet),#7C6FF2); }
.bg-coral{ background: linear-gradient(135deg,var(--coral),#FF9A8B); }
.bg-mint{ background: linear-gradient(135deg,var(--mint),#59E0AE); }
.bg-amber{ background: linear-gradient(135deg,var(--amber),#FFCB66); }
.bg-sky{ background: linear-gradient(135deg,var(--sky),#6FD3F5); }

.list-card{
  background:var(--surface);
  border-radius: var(--radius-md);
  border:1px solid var(--border);
  padding: 14px 16px;
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom: 10px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.list-card:hover{ box-shadow: var(--shadow-card); transform: translateY(-1px); }
.avatar-chip{
  width:44px;height:44px;border-radius:13px;
  display:flex;align-items:center;justify-content:center;
  font-family:'Poppins',sans-serif; font-weight:600; font-size:15px;
  color:#fff; flex-shrink:0;
}
.list-card .title{ font-weight:600; font-size:14.5px; }
.list-card .subtitle{ font-size:12.5px; color:var(--text-muted); }
.list-card .actions{ margin-left:auto; display:flex; gap:6px; }

/* Chips / badges */
.chip{
  display:inline-flex; align-items:center; gap:5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight:600;
}
.chip-violet{ background:var(--violet-light); color:var(--violet-dark); }
.chip-coral{ background:var(--coral-light); color:#D9384A; }
.chip-mint{ background:var(--mint-light); color:#0F9A6B; }
.chip-amber{ background:var(--amber-light); color:#B9740C; }
.chip-sky{ background:var(--sky-light); color:#1A85B8; }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                */
/* ---------------------------------------------------------------------- */
.btn{ border-radius: 12px; font-weight:600; font-size:13.5px; padding:9px 16px; border:none; }
.btn-app-primary{ background: var(--violet); color:#fff; }
.btn-app-primary:hover{ background: var(--violet-dark); color:#fff; }
.btn-app-soft{ background: var(--violet-light); color: var(--violet-dark); }
.btn-app-soft:hover{ background:#e1ddfd; color: var(--violet-dark); }
.btn-app-danger{ background: var(--coral-light); color:#D9384A; }
.btn-app-danger:hover{ background:#ffd9d9; color:#D9384A; }
.btn-app-mint{ background:var(--mint); color:#fff; }
.btn-app-mint:hover{ background:#17b57d; color:#fff; }
.btn-icon-round{
  width:36px;height:36px;border-radius:10px;border:none;
  display:flex;align-items:center;justify-content:center;
}

.fab{
  position: fixed;
  right: 22px;
  bottom: 96px;
  width: 56px; height:56px;
  border-radius: 18px;
  background: linear-gradient(135deg,var(--violet),#7C6FF2);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size: 22px;
  border:none;
  box-shadow: 0 14px 30px -8px rgba(91,79,233,.6);
  z-index: 45;
  cursor:pointer;
}
@media (min-width: 992px){
  .fab{ bottom: 32px; }
}

/* ---------------------------------------------------------------------- */
/* Bottom tab bar (mobile) / Sidebar (desktop)                           */
/* ---------------------------------------------------------------------- */
.tabbar{
  position: fixed;
  bottom: 0; left:0; right:0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display:flex;
  justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -6px 20px rgba(30,33,64,.06);
}
.tabbar a{
  display:flex; flex-direction:column; align-items:center; gap:2px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight:600;
  padding: 4px 6px;
  border-radius: 10px;
  min-width: 56px;
}
.tabbar a i{ font-size: 18px; }
.tabbar a.active{ color: var(--violet); }
.tabbar a.active i{ background: var(--violet-light); border-radius: 10px; padding:4px 10px; }

.sidebar{
  display:none;
}

@media (min-width: 992px){
  body{ padding-bottom: 0; }
  .tabbar{ display:none; }
  .app-shell{ display:flex; }
  .sidebar{
    display:flex;
    flex-direction:column;
    width: 236px;
    min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
    position: sticky;
    top:0;
    flex-shrink:0;
  }
  .sidebar .brand{ display:flex; align-items:center; gap:10px; margin-bottom: 26px; padding: 0 6px;}
  .sidebar .brand-logo{
    width:38px;height:38px;border-radius:11px;background:var(--violet-light);
    display:flex;align-items:center;justify-content:center;color:var(--violet);
    font-family:'Poppins',sans-serif;font-weight:700; overflow:hidden;
  }
  .sidebar .brand-logo img{ width:100%; height:100%; object-fit:cover; }
  .sidebar .brand-name{ font-family:'Poppins',sans-serif; font-weight:600; font-size:14.5px; }
  .sidebar nav a{
    display:flex; align-items:center; gap:12px;
    padding: 10px 12px; border-radius: 12px;
    color: var(--text-muted); font-weight:600; font-size:13.5px;
    margin-bottom: 4px;
  }
  .sidebar nav a i{ width:18px; text-align:center; }
  .sidebar nav a.active{ background: var(--violet); color:#fff; }
  .sidebar nav a:hover:not(.active){ background: var(--violet-light); color: var(--violet-dark); }
  .sidebar .sidebar-foot{ margin-top:auto; }
  .main-col{ flex:1; min-width:0; }
  .app-topbar{ border-radius: 0 0 26px 26px; }
  .app-content{ margin-top: -18px; }
}

/* ---------------------------------------------------------------------- */
/* Forms & modals                                                        */
/* ---------------------------------------------------------------------- */
.form-label{ font-weight:600; font-size:13px; color:var(--text); margin-bottom:5px; }
.form-control, .form-select{
  border-radius: 12px;
  border: 1.5px solid var(--border);
  padding: 9px 12px;
  font-size: 14px;
  background: #FBFBFF;
}
.form-control:focus, .form-select:focus{
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-light);
  background: #fff;
}
.modal-content{
  border-radius: 22px;
  border: none;
  box-shadow: var(--shadow-pop);
}
.modal-header{ border-bottom: 1px solid var(--border); padding: 18px 22px; }
.modal-title{ font-family:'Poppins',sans-serif; font-size:16.5px; font-weight:600; }
.modal-body{ padding: 20px 22px; }
.modal-footer{ border-top: 1px solid var(--border); padding: 14px 22px; }

.form-switch .form-check-input{ width: 2.6em; height:1.4em; }
.form-check-input:checked{ background-color: var(--violet); border-color: var(--violet); }

/* Select2 tweaks to match theme */
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple{
  border-radius: 12px !important;
  border: 1.5px solid var(--border) !important;
  min-height: 42px !important;
  padding: 3px 4px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered{ line-height: 34px !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow{ height: 40px !important; }
.select2-container--default .select2-selection__choice{
  background: var(--violet-light) !important;
  border: none !important;
  color: var(--violet-dark) !important;
  border-radius: 8px !important;
  padding: 2px 8px !important;
}

/* Table */
.table-app{ width:100%; border-collapse: separate; border-spacing: 0 8px; }
.table-app thead th{
  font-size: 11.5px; text-transform: uppercase; letter-spacing:.04em;
  color: var(--text-muted); font-weight:700; padding: 0 14px 6px;
  border:none;
}
.table-app tbody tr{ background:var(--surface); }
.table-app tbody td{
  padding: 12px 14px; border-top:1px solid var(--border); border-bottom:1px solid var(--border);
  font-size: 13.5px; vertical-align: middle;
}
.table-app tbody tr td:first-child{ border-left:1px solid var(--border); border-radius: 12px 0 0 12px; }
.table-app tbody tr td:last-child{ border-right:1px solid var(--border); border-radius: 0 12px 12px 0; }

/* Attendance grid */
.att-student-row{
  display:flex; align-items:center; gap:12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 9px;
}
.att-toggle{ margin-left:auto; display:flex; gap:6px; }
.att-btn{
  border:1.5px solid var(--border);
  background:#fff;
  border-radius: 10px;
  font-size:12px; font-weight:700;
  padding: 7px 14px;
  color: var(--text-muted);
  cursor:pointer;
}
.att-btn.present.active{ background: var(--mint); border-color: var(--mint); color:#fff; }
.att-btn.absent.active{ background: var(--coral); border-color: var(--coral); color:#fff; }

/* Login page */
.login-wrap{
  min-height: 100vh;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(160deg, var(--violet) 0%, #7C6FF2 46%, #9F86FF 100%);
  padding: 24px;
}
.login-card{
  width:100%; max-width: 380px;
  background: #fff;
  border-radius: 26px;
  padding: 34px 28px;
  box-shadow: var(--shadow-pop);
}
.login-logo{
  width:56px;height:56px;border-radius:16px;
  background: var(--violet-light);
  display:flex;align-items:center;justify-content:center;
  color: var(--violet); font-size:24px;
  margin: 0 auto 14px;
}

/* Utility */
.text-muted-app{ color: var(--text-muted); }
.empty-state{ text-align:center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i{ font-size: 40px; color: var(--violet-light); margin-bottom: 12px; display:block; }
.scroll-x{ overflow-x:auto; -webkit-overflow-scrolling: touch; }
.toast-app{ border-radius: 14px; }

::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background: #DCDDF3; border-radius: 10px; }
