/* style.css */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
  font-family: 'DM Sans', sans-serif; 
  background: #d1d5db;
  min-height: 100vh; 
  color: #1f2937;
  overflow-x: hidden;
  width: 100%;
}

input, select, textarea, button { font-family: inherit; }

:root {
  --purple:       #7c3aed;
  --purple-dark:  #5b21b6;
  --purple-light: #ede9fe;
  --purple-mid:   #c4b5fd;
  --teal:         #0d9488;
  --teal-light:   #99f6e4;
  --orange:       #f97316;
  --green:        #059669;
  --red:          #dc2626;
  --text:         #1f2937;
  --text-muted:   #6b7280;
  --border:       #d1d5db;
  --card:         #faf5ff;
  --white:        #ffffff;
}

/* ─── PAGE WRAPPERS ─────────────────────────────────────── */

.page-wrap { 
  width: 100%;
  max-width: 100%; 
  margin: 0 auto; 
  min-height: 100vh; 
  background: #f3f4f6; 
  box-shadow: 0 0 25px rgba(0,0,0,0.15); 
}

.page-wrap-wide { 
  width: 100%;
  max-width: 1000px; 
  margin: 0 auto; 
  min-height: 100vh; 
  background: #f3f4f6; 
  padding: 20px;
  box-shadow: 0 0 25px rgba(0,0,0,0.15);
}

/* ─── ANIMATIONS ────────────────────────────────────────── */

.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─── TOP HEADER ────────────────────────────────────────── */

.top-header { 
  background: var(--purple);
  padding: 16px 18px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  position: sticky; 
  top: 0; 
  z-index: 10; 
}
.top-header h1 { color: white; font-size: 17px; font-weight: 700; }
.logout-btn { 
  background: rgba(255,255,255,0.15); 
  border: none; 
  color: white; 
  cursor: pointer; 
  font-size: 18px; 
  width: 34px;
  height: 34px; 
  border-radius: 8px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

/* ─── CARDS ─────────────────────────────────────────────── */

.card { 
  background: white;
  border-radius: 14px; 
  padding: 18px; 
  margin-bottom: 20px; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); 
}
.card-purple { 
  background: var(--card); 
  border-radius: 14px;
  padding: 18px; 
  margin-bottom: 20px; 
  border: 1px solid var(--purple-light);
}
.page-content { 
  padding: 14px; 
  display: flex; 
  flex-direction: column; 
  gap: 8px;
}

/* ─── INPUTS ─────────────────────────────────────────────── */

.input-wrap { position: relative; margin-bottom: 12px; }
.input-icon { 
  position: absolute; 
  left: 14px; 
  top: 50%;
  transform: translateY(-50%); 
  font-size: 16px; 
  pointer-events: none; 
  color: var(--text-muted);
}
.text-input { 
  width: 100%; 
  padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--border); 
  border-radius: 10px; 
  font-size: 16px; 
  outline: none; 
  background: white; 
  color: var(--text); 
  transition: border-color 0.2s;
}
.text-input:focus { border-color: var(--purple); }
.plain-input { 
  width: 100%; 
  padding: 10px 12px; 
  border: 1.5px solid var(--border); 
  border-radius: 9px;
  font-size: 16px; 
  outline: none; 
  background: white; 
  color: var(--text); 
  margin-bottom: 8px; 
}

/* ─── BUTTONS ────────────────────────────────────────────── */

.btn-primary { 
  width: 100%;
  padding: 14px; 
  border: none; 
  border-radius: 10px; 
  background: var(--purple); 
  color: white; 
  font-weight: 700; 
  cursor: pointer; 
  font-size: 15px; 
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-outline { 
  width: 100%; 
  padding: 14px; 
  border: 1.5px solid var(--border); 
  border-radius: 10px; 
  background: white;
  color: var(--purple); 
  font-weight: 700; 
  cursor: pointer; 
  font-size: 15px; 
  transition: background 0.2s; 
}
.btn-register-cta { 
  width: 100%; 
  padding: 14px;
  border: none; 
  border-radius: 10px; 
  background: var(--purple-mid); 
  color: var(--purple-dark); 
  font-weight: 700; 
  cursor: pointer; 
  font-size: 14px; 
  margin-top: 10px;
}

/* ─── PROGRESS & BADGES ──────────────────────────────────── */

.progress-track { height: 12px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-top: 8px;}
.progress-fill { height: 100%; background: var(--orange); border-radius: 99px; transition: width 0.6s ease; }
.badge-submitted { background: #10b981; color: white; border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-pending { color: var(--text-muted); border: 1.5px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ─── TEXT HELPERS ───────────────────────────────────────── */

.error-text { color: var(--red); font-size: 13px; text-align: center; margin-bottom: 8px; font-weight: 500;}
.info-text { color: var(--text-muted); font-size: 12px; margin-bottom: 6px; }
.section-title { font-weight: 700; font-size: 15px; color: var(--purple); margin-bottom: 12px; text-align: center; }

/* ─── MARKS ──────────────────────────────────────────────── */

.marks-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.marks-row:last-child { border-bottom: none; }
.marks-value { font-weight: 700; font-family: 'Space Mono', monospace; font-size: 15px; }
.marks-total-box { display: flex; justify-content: space-between; align-items: center; padding: 14px; background: #eff6ff; border-radius: 10px; margin-top: 12px; border: 1px solid #bfdbfe;}
.marks-total-label, .marks-total-value { color: #1d4ed8; font-weight: 700; font-size: 16px; }

/* ─── ATTENDANCE BUTTONS ─────────────────────────────────── */

.btn-disabled { 
  background: #e5e7eb; 
  color: #6b7280; 
  cursor: not-allowed; 
  width: 100%; 
  padding: 16px;
  border: 1px solid var(--border); 
  border-radius: 12px; 
  font-weight: 700; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  gap: 8px; 
  font-size: 15px; 
  letter-spacing: 0.5px;
}
.btn-active-attendance { 
  background: var(--purple); 
  color: white; 
  cursor: pointer; 
  width: 100%; 
  padding: 16px; 
  border: none; 
  border-radius: 12px; 
  font-weight: 700;
  display: flex; 
  justify-content: center; 
  align-items: center; 
  gap: 8px; 
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35); 
  transition: transform 0.1s;
  font-size: 15px; 
  letter-spacing: 0.5px;
}
.btn-active-attendance:active { transform: scale(0.98); }

/* ─── GLOBAL SETTINGS CARD ───────────────────────────────── */

.global-settings-card { 
  background: #fffbeb;
  border-left: 5px solid var(--orange); 
  padding: 18px; 
  border-radius: 8px; 
  margin-bottom: 24px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* ─── EDIT INPUTS ────────────────────────────────────────── */

.edit-input { padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 13px; }

/* ─── DETAILS / ATTENDANCE TABLE ─────────────────────────── */

.details-card { padding: 0 !important; overflow: hidden; border: 1px solid var(--border); }
.details-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: #faf5ff; cursor: pointer; }
.details-header-left { display: flex; align-items: center; gap: 12px; }
.details-header-text h3 { font-size: 16px; color: var(--purple); margin: 0 0 2px 0; }
.details-header-text p { font-size: 12px; color: var(--text-muted); margin: 0; }
.attendance-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: center; }
.attendance-table th, .attendance-table td { padding: 12px 10px; border: 1px solid var(--border); text-align: center;}
.attendance-table th { background: #f9fafb; color: var(--text); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px;}


/* ════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ════════════════════════════════════════════════════════════ */

/* ─── MOBILE  (≤ 480px) ──────────────────────────────────── */
@media (max-width: 480px) {
  body {
    background: #f3f4f6;
  }

  .page-wrap,
  .page-wrap-wide {
    max-width: 100%;
    box-shadow: none;
    padding: 0;
  }

  .page-wrap-wide {
    padding: 12px;
  }

  .top-header {
    padding: 14px 14px;
  }
  .top-header h1 { font-size: 15px; }

  .page-content {
    padding: 10px;
    gap: 6px;
  }

  .card,
  .card-purple {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 14px;
  }

  .btn-primary,
  .btn-outline,
  .btn-register-cta {
    padding: 13px;
    font-size: 14px;
  }

  .btn-disabled,
  .btn-active-attendance {
    padding: 14px;
    font-size: 14px;
  }

  .text-input, .plain-input {
    font-size: 16px; /* explicitly preventing auto-zoom */
    padding: 11px 12px 11px 40px;
  }

  .marks-total-label,
  .marks-total-value { font-size: 14px; }

  .attendance-table th,
  .attendance-table td {
    padding: 9px 6px;
    font-size: 12px;
  }

  .global-settings-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
  }

  .details-header {
    padding: 12px 14px;
  }
  .details-header-text h3 { font-size: 14px; }
  .section-title { font-size: 14px; }
}

/* ─── SMALL MOBILE  (≤ 360px) ───────────────────────────── */
@media (max-width: 360px) {
  .top-header h1 { font-size: 14px; }

  .btn-primary,
  .btn-outline,
  .btn-register-cta,
  .btn-disabled,
  .btn-active-attendance {
    font-size: 13px;
    padding: 12px;
  }

  .attendance-table th,
  .attendance-table td {
    padding: 7px 4px;
    font-size: 11px;
  }

  .marks-value { font-size: 13px; }
}

/* ─── TABLET  (481px – 768px) ────────────────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
  body {
    background: #d1d5db;
  }

  .page-wrap {
    max-width: 100%;
  }

  .page-wrap-wide {
    max-width: 100%;
    padding: 16px;
  }

  .top-header {
    padding: 16px 20px;
  }

  .page-content {
    padding: 14px;
    gap: 8px;
  }

  .card,
  .card-purple {
    padding: 18px;
    border-radius: 12px;
  }

  .attendance-table th,
  .attendance-table td {
    padding: 11px 10px;
    font-size: 13px;
  }

  .global-settings-card {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* ─── LARGE TABLET / SMALL LAPTOP  (769px – 1024px) ─────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .page-wrap {
    max-width: 100%;
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    border-radius: 16px;
  }

  .page-wrap-wide {
    max-width: 100%;
    margin: 24px auto;
    border-radius: 16px;
    padding: 24px;
  }

  .page-content {
    padding: 18px;
    gap: 10px;
  }

  .card,
  .card-purple {
    padding: 20px;
  }

  .top-header {
    border-radius: 0;
  }

  .attendance-table th,
  .attendance-table td {
    padding: 12px 14px;
  }
}

/* ─── DESKTOP  (≥ 1025px) ───────────────────────────────── */
@media (min-width: 1025px) {
  .page-wrap {
    max-width: 100%;
    margin: 32px auto;
    min-height: calc(100vh - 64px);
    border-radius: 20px;
  }

  .page-wrap-wide {
    max-width: 100%;
    margin: 32px auto;
    border-radius: 20px;
    padding: 28px;
  }

  .page-content {
    padding: 18px;
    gap: 10px;
  }

  .card,
  .card-purple {
    padding: 22px;
  }

  .btn-primary:hover { opacity: 0.88; }

  .attendance-table th,
  .attendance-table td {
    padding: 13px 16px;
  }

  .details-header-text h3 { font-size: 17px; }
}

/* ─── LARGE DESKTOP  (≥ 1440px) ─────────────────────────── */
@media (min-width: 1440px) {
  .page-wrap { margin: 40px auto; }
  .page-wrap-wide { max-width: 100%; margin: 40px auto; padding: 32px; }
}
