/* =====================================================
   Student Absence Tracking System — CSS Design (จาก Figma)
   ===================================================== */

/* Local Fonts: Sarabun (self-hosted — ไม่ต้องพึ่ง Google) */
@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/Sarabun-Light.ttf') format('truetype');
}

@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Sarabun-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/Sarabun-Medium.ttf') format('truetype');
}

@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/Sarabun-SemiBold.ttf') format('truetype');
}

@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Sarabun-Bold.ttf') format('truetype');
}

@font-face {
  font-family: 'Sarabun';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/Sarabun-ExtraBold.ttf') format('truetype');
}

/* =====================================================
   CSS Variables / Design Tokens
   ===================================================== */
:root {
  --primary: #1a3a6b;
  --primary-light: #2563eb;
  --primary-lighter: #93c5fd;
  --primary-lightest: #bfdbfe;
  --primary-bg: #eff6ff;

  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-dim: #f0f4f8;
  --surface-border: #e8eef7;
  --border: #dde6f0;
  --border-light: #c5d4e8;

  --text-primary: #0d1b2a;
  --text-secondary: #4a6080;
  --text-muted: #6b82a8;
  --text-on-primary: #ffffff;

  --accent-teal: #0f766e;
  --accent-teal-light: #99f6e4;
  --accent-amber: #b45309;
  --accent-amber-light: #fde68a;
  --accent-amber-bg: #fef3c7;
  --accent-orange: #c2410c;
  --accent-orange-bg: #ffedd5;
  --accent-red: #b91c1c;
  --accent-red-dark: #991b1b;
  --accent-red-bg: #fee2e2;
  --accent-green: #065f46;
  --accent-green-bg: #d1fae5;
  --accent-yellow: #fde68a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  --font: 'Sarabun', sans-serif;
  --transition: all 0.2s ease;
}

/* =====================================================
   Reset & Base
   ===================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--surface-dim);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
}

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

img {
  max-width: 100%;
  height: auto;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: inherit;
}

input,
select,
textarea {
  font-family: var(--font);
  font-size: 14px;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(-45deg, #0a1f45, #1a3a6b, #1e40af, #2563eb, #1a3a6b, #0f2857);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.login-topbar {
  background: #0a1f45;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeSlideDown 0.6s ease-out;
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-topbar svg {
  color: #facc15;
  flex-shrink: 0;
}

.login-topbar span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* ===== Floating Blobs ===== */
.login-blob {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  filter: blur(1px);
  pointer-events: none;
  animation: blobFloat linear infinite;
}

.login-blob-1 {
  width: 300px;
  height: 300px;
  top: -80px;
  left: -60px;
  animation-duration: 20s;
  animation-delay: 0s;
}

.login-blob-2 {
  width: 200px;
  height: 200px;
  bottom: -40px;
  right: -30px;
  background: rgba(37, 99, 235, 0.12);
  animation-duration: 25s;
  animation-delay: -5s;
}

.login-blob-3 {
  width: 150px;
  height: 150px;
  top: 40%;
  left: 10%;
  background: rgba(124, 58, 237, 0.08);
  animation-duration: 18s;
  animation-delay: -8s;
}

.login-blob-4 {
  width: 100px;
  height: 100px;
  top: 20%;
  right: 15%;
  background: rgba(250, 204, 21, 0.06);
  animation-duration: 22s;
  animation-delay: -3s;
}

@keyframes blobFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(30px, -40px) scale(1.1);
  }

  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }

  75% {
    transform: translate(40px, 30px) scale(1.05);
  }

  100% {
    transform: translate(0, 0) scale(1);
  }
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
  animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Login Header / Emblem */
.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 16px;
  backdrop-filter: blur(4px);
  animation: emblemPulse 3s ease-in-out infinite;
}

@keyframes emblemPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15);
  }

  50% {
    box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.08);
  }
}

.login-emblem svg {
  color: #fff;
}

.login-header h1 {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.login-header p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  margin-top: 4px;
}

.login-header-line {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px 32px 0;
}

/* Login Card */
.login-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.login-card-header {
  background: var(--primary);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-card-header svg {
  color: var(--accent-yellow);
}

.login-card-header span {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

.login-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  /* reserve space for left icon and right toggle */
  padding: 10px 44px 10px 44px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.input-wrapper input[type="password"],
.input-wrapper input.has-toggle {
  padding-right: 48px;
}

.input-wrapper input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.password-toggle:hover {
  background: rgba(37, 99, 235, 0.06);
}

.password-toggle:hover {
  color: var(--primary);
}

/* Error message */
.login-error {
  background: var(--accent-red-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-error-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  flex-shrink: 0;
}

.login-error span {
  font-size: 13px;
  color: var(--accent-red);
}

/* Submit button */
.btn-login {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-login:hover {
  background: #15325c;
}

.btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* =====================================================
   NAVIGATION BAR
   ===================================================== */
.navbar {
  background: var(--primary);
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 40;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-logo svg {
  color: var(--accent-yellow);
}

.navbar-title {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.navbar-subtitle {
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
}

/* Desktop nav tabs */
.navbar-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 400;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
}

.nav-tab.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
  border-bottom-color: var(--primary-lighter);
}

.nav-tab svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* User area */
.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.navbar-user-info {
  text-align: right;
  min-width: 0;
  max-width: 180px;
}

.navbar-user-name {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-user-detail {
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  padding: 6px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile menu */
.mobile-menu {
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 0;
}

.mobile-menu-user {
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.mobile-menu-user span {
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.mobile-menu-user small {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
}

.mobile-logout {
  color: #fca5a5 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 4px;
  padding-top: 12px !important;
}

.mobile-nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  text-decoration: none;
  transition: var(--transition);
}

.mobile-nav-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mobile-nav-tab.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Breadcrumb */
.breadcrumb-bar {
  background: var(--surface-border);
  border-bottom: 1px solid var(--border-light);
  padding: 6px 16px;
}

.breadcrumb-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-item {
  font-size: 11px;
  color: var(--text-secondary);
}

.breadcrumb-sep {
  font-size: 11px;
  color: var(--border-light);
}

.breadcrumb-current {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
  border-top: 1px solid var(--border-light);
  background: var(--surface-border);
  margin-top: 32px;
  padding: 12px 16px;
  text-align: center;
}

.site-footer p {
  font-size: 11px;
  color: var(--text-secondary);
}

/* =====================================================
   WELCOME BAR
   ===================================================== */
.welcome-bar {
  background: var(--primary);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.welcome-bar h2 {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

.welcome-bar p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  margin-top: 2px;
}

/* Period filter buttons */
.period-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.period-btn {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.period-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.period-btn.active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* =====================================================
   STATS CARDS
   ===================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-header svg {
  width: 18px;
  height: 18px;
}

.stat-card-unit {
  font-size: 10px;
  opacity: 0.8;
}

.stat-card-value {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-card-label {
  font-size: 12px;
  margin-top: 4px;
}

/* =====================================================
   CARDS / PANELS
   ===================================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  padding: 12px 16px;
  background: var(--surface-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 {
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}

.card-header svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.card-header-dark {
  background: var(--primary);
  border-bottom: none;
}

.card-header-dark h3,
.card-header-dark span {
  color: #fff;
}

.card-header-dark svg {
  color: var(--primary-lighter);
}

.card-header-between {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.card-header-dark input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.card-header-dark select option {
  background: #fff;
  color: #333;
}

.card-body {
  padding: 16px;
}

.card-body.no-padding {
  padding: 0;
}

/* Badge / pill */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  gap: 4px;
}

.badge-blue {
  background: var(--surface-border);
  color: var(--primary);
}

.badge-red {
  background: var(--accent-red-bg);
  color: var(--accent-red-dark);
}

.badge-green {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

.badge-amber {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
}

/* =====================================================
   GRID LAYOUTS
   ===================================================== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* =====================================================
   TABLES
   ===================================================== */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
}

.data-table thead tr {
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 8px 16px;
  text-align: left;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--surface-dim);
  transition: var(--transition);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-alt);
}

.data-table td {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-primary);
}

.data-table td.secondary {
  color: var(--text-secondary);
}

.data-table td.muted {
  color: var(--border-light);
}

/* =====================================================
   SUBJECT REPORT SUMMARY
   ===================================================== */
.subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-dim);
}

.subject-row:last-child {
  border-bottom: none;
}

.subject-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

.subject-detail {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
}

.subject-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.subject-count.empty {
  color: var(--border-light);
}

.subject-count-unit {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 2px;
}

.subject-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
}

.subject-total-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.subject-total-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

/* =====================================================
   TOP STUDENTS (PROGRESS BARS)
   ===================================================== */
.top-student-item {
  margin-bottom: 8px;
}

.top-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.top-student-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--text-secondary);
}

.rank-circle.top {
  background: var(--accent-red);
}

.top-student-name {
  font-size: 13px;
  color: var(--text-primary);
}

.top-student-count {
  font-size: 14px;
  font-weight: 700;
}

.progress-bar {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-dim);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* =====================================================
   TEACHER TAB — FORM SELECTORS
   ===================================================== */


.selector-panel {
  margin-bottom: 16px;
}

.period-selector {
  padding: 16px;
  padding-bottom: 8px;
}

.period-selector-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.selector-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.selector-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.selector-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.selector-select:disabled {
  opacity: 0.4;
}

/* =====================================================
   TEACHER TAB — ABSENCE INPUT TABLE
   ===================================================== */
.absence-header {
  padding: 12px 16px;
  background: var(--surface-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.absence-header-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}

.absence-period-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-border);
  color: var(--primary-light);
  font-size: 12px;
}

.search-input-sm {
  position: relative;
}

.search-input-sm svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 13px;
  height: 13px;
}

.search-input-sm input {
  padding: 6px 12px 6px 28px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  width: 130px;
  outline: none;
  transition: var(--transition);
}

.search-input-sm input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Hint bar */
.hint-bar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--surface-dim);
  background: #fffbeb;
  font-size: 11px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Absence input */
.absence-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.absence-input {
  width: 96px;
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.absence-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.absence-unit {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Status badge */
.status-badge {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* Save footer */
.save-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.save-footer .hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.save-success {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #15803d;
  font-size: 13px;
}

.btn-save {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-save:hover {
  opacity: 0.9;
}

.btn-save:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Modal action buttons: allow wrapping and prevent overflow on small screens */
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-actions button { min-width: 0; }
.modal-actions .btn-save { padding: 8px 16px; }

/* Assignment row: allow long subject names to wrap and prevent horizontal overflow */
.assignment-row { display:flex; gap:8px; align-items:center; min-width:0; }
.assignment-row .assignment-label { flex:1; min-width:0; word-break:break-word; white-space:normal; overflow-wrap:anywhere; }
.assignment-row button { flex:0 0 auto; }

/* Make modal content scrollable when too tall for viewport */
.modal-panel {
  max-height: 86vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
.modal-panel > * { box-sizing: border-box; }

/* Subject overview cards */
.subject-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.subject-overview-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px;
}

.subject-overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.subject-overview-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}

.subject-overview-detail {
  font-size: 12px;
  color: var(--text-secondary);
}

.class-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.class-tag {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
  background: transparent;
}

.class-tag:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
}

.class-tag.selected {
  border-color: var(--primary-light);
  color: var(--primary-light);
  background: var(--primary-bg);
}

.class-tag-check {
  margin-left: 2px;
  color: var(--primary);
  font-weight: 600;
}

/* =====================================================
   ADVISOR TAB
   ===================================================== */
.alert-panel {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.alert-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.alert-panel-header svg {
  color: #dc2626;
}

.alert-panel-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-red-dark);
}

.alert-students {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alert-student-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  border: 1px solid #fca5a5;
  background: #fff;
}

.alert-student-name {
  font-size: 12px;
  color: var(--accent-red-dark);
  font-weight: 600;
}

.alert-student-count {
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--accent-red);
  color: #fff;
  font-size: 11px;
}

.btn-evidence-sm {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  border: 1px solid var(--border-light);
  color: var(--primary);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  cursor: pointer;
}

.btn-evidence-sm:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Search bar */
.search-bar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-bar-input {
  position: relative;
  flex: 1;
  min-width: 140px;
}

.search-bar-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 13px;
  height: 13px;
}

.search-bar-input input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-bar-input input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.search-bar-count {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Student list */
.student-list-item {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  border-bottom: 1px solid var(--surface-dim);
}

.student-list-item:last-child {
  border-bottom: none;
}

.student-list-item:hover {
  background: var(--surface-alt);
}

.student-list-item.alert-bg {
  background: #fff7f7;
}

.student-list-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.student-no-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--primary);
}

.student-no-circle.alert {
  background: #c8102e;
}

.student-info {
  min-width: 0;
}

.student-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.student-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

.student-status {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.student-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.student-status-text {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Student right side */
.student-list-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 8px;
}

.student-total-count {
  font-size: 20px;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.btn-evidence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--primary);
  transition: var(--transition);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.btn-evidence:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.chevron-icon {
  color: var(--text-secondary);
  width: 14px;
  height: 14px;
}

/* Expanded detail */
.student-detail {
  border-top: 1px solid var(--surface-dim);
  background: #fafbfc;
  padding: 12px 16px;
}

.student-detail-title {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}

.student-detail-table {
  width: 100%;
  min-width: 400px;
}

.student-detail-table th {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.student-detail-table td {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--surface-dim);
}

.student-detail-table tr:last-child td {
  border-bottom: none;
}

/* Evidence summary */
.evidence-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.evidence-summary-icon {
  color: #059669;
  flex-shrink: 0;
  margin-top: 2px;
}

.evidence-summary-content {
  flex: 1;
  min-width: 0;
}

.evidence-summary-title {
  font-size: 12px;
  color: var(--accent-green);
  font-weight: 600;
}

.evidence-summary-detail {
  font-size: 11px;
  color: var(--text-secondary);
}

.evidence-summary-note {
  font-size: 12px;
  color: #374151;
  margin-top: 4px;
}

.btn-edit-evidence {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid #a7f3d0;
  color: #059669;
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-edit-evidence:hover {
  background: #d1fae5;
}

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  background: var(--primary);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header-left svg {
  color: var(--primary-lighter);
}

.modal-header-left span {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

.modal-close {
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  padding: 4px;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-student-info {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-student-info svg {
  color: var(--primary);
}

.modal-student-info span {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-area:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}

.upload-area.has-file {
  border-color: var(--primary-light);
}

.upload-area svg {
  color: var(--border-light);
  margin: 0 auto 4px;
}

.upload-area p {
  font-size: 13px;
  color: var(--text-secondary);
}

.upload-area .file-hint {
  font-size: 11px;
  color: var(--border-light);
}

.upload-file-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.upload-file-info svg {
  color: var(--primary-light);
  margin: 0;
}

.upload-file-info .name {
  font-size: 13px;
  color: var(--primary);
}

.upload-file-info .size {
  font-size: 11px;
  color: var(--text-secondary);
}

.preview-image {
  margin-top: 8px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-image img {
  width: 100%;
  max-height: 192px;
  object-fit: contain;
  background: var(--surface-dim);
}

/* Modal footer */
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-cancel {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  transition: var(--transition);
  background: transparent;
  cursor: pointer;
}

.btn-cancel:hover {
  background: var(--surface-dim);
}

.btn-evidence-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-evidence-save:hover {
  opacity: 0.9;
}

.btn-evidence-save:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
  text-align: center;
  padding: 32px 16px;
}

.empty-state svg {
  color: var(--border-light);
  margin: 0 auto 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* =====================================================
   ADMIN / CSV IMPORT
   ===================================================== */
.import-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.import-format {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.import-format code {
  background: var(--surface-dim);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--primary);
}

.import-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--primary-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
}

.import-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface-alt);
}

.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}

.dropzone-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 8px;
}

.dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Preview */
.import-preview {
  margin-top: 16px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--primary-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--primary);
}

.preview-table {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border: 1px solid var(--surface-border);
  border-top: none;
}

.btn-confirm-import {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--accent-green);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-confirm-import:hover {
  opacity: 0.9;
}

.btn-confirm-import:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-cancel-import {
  padding: 6px 14px;
  background: var(--surface-dim);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.btn-cancel-import:hover {
  background: var(--border);
}

.btn-download-template {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--surface-alt);
  color: var(--primary-light);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.btn-download-template:hover {
  background: var(--primary-bg);
  border-color: var(--primary-light);
}

/* Result messages */
.import-result {
  margin-top: 12px;
}

.import-success {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--accent-green-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  color: var(--accent-green);
  font-size: 14px;
}

.import-fail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--accent-red-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-lg);
  color: var(--accent-red);
  font-size: 14px;
}

.import-error {
  padding: 12px;
  background: var(--accent-red-bg);
  border-radius: var(--radius-md);
  color: var(--accent-red);
  font-size: 13px;
}

.import-error-list {
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent-amber);
}

.import-error-item {
  padding: 2px 0;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Admin Action Buttons */
.btn-admin-edit,
.btn-admin-delete {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin: 0 2px;
}

.btn-admin-edit:hover {
  background: var(--primary-bg);
  border-color: var(--primary-light);
  color: var(--primary);
}

.btn-admin-edit:hover svg {
  stroke: var(--primary-light);
}

.btn-admin-delete:hover {
  background: var(--accent-red-bg);
  border-color: var(--accent-red);
}

.btn-admin-delete:hover svg {
  stroke: var(--accent-red);
}

/* =====================================================
   NAVBAR-COMPACT — JS auto-detect overflow → hamburger
   ===================================================== */
.navbar-compact .navbar-tabs {
  display: none !important;
}

.navbar-compact .navbar-user-info {
  display: none !important;
}

.navbar-compact .navbar-title-text {
  display: none !important;
}

.navbar-compact .mobile-menu-toggle {
  display: block !important;
}

.navbar-compact .btn-logout {
  display: none !important;
}

/* =====================================================
   RESPONSIVE — All Devices
   ===================================================== */
body {
  overflow-x: hidden;
}

@media (max-width: 1200px) {
  .navbar-inner,
  .breadcrumb-inner,
  .main-content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .welcome-bar {
    padding: 14px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .navbar-tabs {
    display: none;
  }

  .navbar-user-info {
    display: none;
  }

  .navbar-title-text {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .btn-logout {
    display: none;
  }

  .navbar-inner {
    min-height: 56px;
    height: auto;
    padding: 8px 12px;
    gap: 8px;
  }

  .main-content {
    padding: 12px;
  }

  .breadcrumb-bar {
    padding: 8px 12px;
  }

  .welcome-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid {
    gap: 8px;
  }

  .card {
    border-radius: 8px;
  }

  .card-header {
    padding: 12px 14px;
  }

  .card-body {
    padding: 12px 14px;
  }

  .grid-2,
  .import-sections,
  .subject-overview-grid {
    grid-template-columns: 1fr;
  }

  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 640px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  .student-list-right .btn-evidence span {
    display: none;
  }

  .admin-tabs {
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-tabs button {
    font-size: 12px !important;
    padding: 8px 10px !important;
    min-width: max-content;
  }

  [id$="Modal"]>div {
    width: 95vw !important;
    max-height: 90vh;
    overflow-y: auto;
    padding: 16px !important;
  }

  #panel-students .card-header-between {
    flex-direction: column;
    gap: 8px;
    align-items: stretch !important;
  }

  #panel-students .card-header-between>div:last-child {
    flex-wrap: wrap;
  }

  #panel-students #studentSearchInput {
    width: 100% !important;
  }

  .report-filters {
    flex-direction: column;
  }

  .report-filters select {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .navbar-brand {
    gap: 8px;
    min-width: 0;
  }

  .navbar-title {
    max-width: 140px;
    font-size: 12px;
  }

  .welcome-bar h2 {
    font-size: 15px;
  }

  .welcome-bar p {
    font-size: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .card-header-between,
  
  .card-header-between > div {
    width: 100%;
  }

  .card-header-between input,
  .card-header-between select {
    width: 100%;
  }

  .btn-save,
  .btn-admin-edit,
  .btn-admin-delete,
  .btn-action {
    min-height: 36px;
  }

  .data-table {
    min-width: 560px;
  }

  .subject-overview-card {
    padding: 14px;
  }

  .subject-overview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .class-tags {
    gap: 8px;
  }

  .class-tag {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .main-content {
    padding: 10px;
  }

  .navbar-inner {
    padding: 6px 10px;
    gap: 6px;
  }

  .navbar-logo {
    width: 28px;
    height: 28px;
  }

  .navbar-subtitle {
    display: none;
  }

  .welcome-bar {
    padding: 12px 14px;
  }

  .card-header,
  .card-body {
    padding: 12px 14px;
  }

  .data-table th,
  .data-table td {
    padding: 6px 8px;
    font-size: 11px;
  }

  .data-table {
    min-width: 500px;
  }

  .period-filters {
    width: 100%;
  }

  .period-btn {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .modal-content {
    max-width: 100%;
    border-radius: 10px;
  }

  [id$="Modal"]>div {
    width: 100% !important;
    padding: 12px !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stat-card {
    padding: 10px 12px;
  }

  .stat-card-value {
    font-size: 22px;
  }

  
  .login-wrapper {
    padding: 0 8px;
  }

  .card-header-between {
    flex-direction: column;
    gap: 8px;
  }

  .data-table th,
  .data-table td {
    padding: 6px 8px;
    font-size: 11px;
  }

  .data-table {
    min-width: 480px;
  }

  [id$="Modal"]>div {
    padding: 14px !important;
  }

  [id$="Modal"] h4 {
    font-size: 14px !important;
  }
}

  /* Login page */
  .login-header h1 {
    font-size: 17px;
  }

  .login-topbar span {
    font-size: 11px;
  }

  .login-container {
    padding: 16px 8px;
  }

  /* Mobile menu full width */
  .mobile-menu a {
    padding: 12px 16px;
    font-size: 14px;
  }