@import url('https://fonts.googleapis.com/css2?family=Kantumruy+Pro:ital,wght@0,400..700;1,400..700&family=Plus+Jakarta+Sans:ital,wght@0,400..800;1,400..800&display=swap');
@import url('student-mobile.css');

:root {
  /* Typography */
  --font-en: 'Plus Jakarta Sans', sans-serif;
  --font-km: 'Kantumruy Pro', sans-serif;
  --font-primary: 'Plus Jakarta Sans', 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --primary: #6C5CE7;
  --primary-gradient: linear-gradient(135deg, #7C5CFC 0%, #6C5CE7 100%);
  --primary-light: #F0EDFF;
  --primary-dark: #5647C9;
  --bg: #F6F7FB;
  --card: #FFFFFF;
  --text: #1E202B;
  --text-muted: #7E84A3;
  --border: #E8EBF2;
  
  /* Status & Accent Colors */
  --green: #10B981;
  --green-bg: #E6F8F1;
  --red: #EF4444;
  --red-bg: #FEE2E2;
  --amber: #F59E0B;
  --amber-bg: #FEF3C7;
  --blue: #3B82F6;
  --blue-bg: #EFF6FF;
  --pink: #FF8EA4;
  --pink-bg: #FFF0F3;
  
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 4px 12px rgba(108, 92, 231, 0.04);
  --shadow-card: 0 10px 30px rgba(108, 92, 231, 0.06);
  --shadow-lg: 0 20px 40px rgba(30, 32, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-primary);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Font Helper Utility Classes */
.font-khmer, .khmer, [lang="km"] {
  font-family: var(--font-km);
}

.font-english, .english, [lang="en"] {
  font-family: var(--font-en);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
}

/* ==========================================
   PAGE CONTAINER & LAYOUT
   ========================================== */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

body.auth-body {
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
}

body.auth-body .page {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* ==========================================
   CARDS & CONTAINERS
   ========================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-narrow {
  max-width: 440px;
  margin: 2.5rem auto;
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 1.25rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.85rem;
  letter-spacing: -0.01em;
}

/* ==========================================
   FORMS & INPUTS
   ========================================== */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
input[type=time],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  background: #FDFDFE;
  color: var(--text);
  transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary-gradient);
  color: #FFFFFF;
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(108, 92, 231, 0.28);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.38);
  color: #FFFFFF;
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
  box-shadow: none;
}

.btn-danger {
  background: var(--red);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: #DC2626;
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.35);
  color: #FFFFFF;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.alert-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(108, 92, 231, 0.2);
}

/* ==========================================
   TABLES & BADGES
   ========================================== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
}

th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}

td {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--bg);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

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

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

/* ==========================================
   BASE RESPONSIVE RESET & UTILITIES
   ========================================== */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

button, input, select, textarea, a {
  -webkit-tap-highlight-color: transparent;
}

.table-responsive,
.card > table,
.card-table-wrap {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
}

.form-row,
.grid-2,
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

@media (max-width: 768px) {
  input[type=text],
  input[type=email],
  input[type=password],
  input[type=number],
  input[type=date],
  input[type=time],
  select,
  textarea {
    font-size: 16px !important;
    padding: 0.8rem 0.9rem;
  }

  .page {
    padding: 1.25rem 0.85rem 3.5rem;
  }

  .page-header {
    margin-bottom: 1.25rem;
  }

  .page-header h1 {
    font-size: 1.45rem;
  }

  .page-header p {
    font-size: 0.88rem;
  }

  .card {
    padding: 1.25rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-md);
  }

  .card-narrow {
    max-width: 100%;
    margin: 1rem 0;
    padding: 1.25rem 1rem;
  }

  .card-narrow .btn,
  .form-group + .btn,
  .btn-mobile-block {
    width: 100%;
    padding: 0.85rem 1rem;
  }

  th, td {
    padding: 0.75rem 0.85rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 480px) {
  .page-header h1 {
    font-size: 1.3rem;
  }

  .card {
    padding: 1rem 0.85rem;
  }

  .badge {
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
  }
}
