/* ============================================================
   RedDoorz Intern Management System — Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── RESET & ROOT VARIABLES ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red:       #7ca9c4;
  --red-dark:  #25b7b7;
  --red-light: #fef2f2;
  --red-mid:   #fca5a5;

  --sidebar-w: 240px;
  --bg:        #f7f8fa;
  --surface:   #ffffff;
  --border:    #e5e7eb;

  --text:  #111827;
  --text2: #6b7280;
  --text3: #9ca3af;

  --font:   'Sora', sans-serif;
  --mono:   'JetBrains Mono', monospace;
  --radius: 10px;

  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.10);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── AUTH OVERLAY ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #e8f4fb 0%, #f0f9f9 50%, #fef9f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  padding: 32px 36px;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 4px;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text2);
  border: none;
  background: none;
  font-family: var(--font);
  transition: all .15s;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ── LAYOUT ── */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sb-logo {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-box {
  width: 34px;
  height: 34px;
  background: var(--red);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.logo-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.logo-sub {
  font-size: 10px;
  color: var(--text2);
}

.sb-section {
  padding: 14px 12px 4px;
}

.sb-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  user-select: none;
  margin: 0 4px;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--red-light);
  color: var(--red);
}

.nav-sub .nav-item {
  font-size: 12.5px;
  padding: 6px 10px;
}

.sb-footer {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-name {
  font-size: 12.5px;
  font-weight: 600;
}

.user-team {
  font-size: 11px;
  color: var(--text2);
}

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 22px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
}

.page-sub {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-header {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
}

.card-body {
  padding: 20px 22px;
}

/* ── STAT GRID ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  margin-bottom: 6px;
}

.stat-val {
  font-size: 28px;
  font-weight: 700;
}

.stat-hint {
  font-size: 12px;
  color: var(--text2);
}

/* ── WELCOME BANNER ── */
.welcome {
  background: var(--red);
  border-radius: 12px;
  padding: 22px 28px;
  color: #fff;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.welcome::before {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}

.welcome-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 3px;
}

.welcome-sub {
  font-size: 13px;
  opacity: .85;
}

/* ── QUICK ACTIONS ── */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.qa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}

.qa-card:hover {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(124,169,196,.12);
  transform: translateY(-1px);
}

.qa-icon  { font-size: 26px; margin-bottom: 8px; }
.qa-label { font-size: 13px; font-weight: 600; }
.qa-hint  { font-size: 11.5px; color: var(--text2); margin-top: 2px; }

/* ── FORMS ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  background: #fff;
}

input:disabled,
select:disabled {
  opacity: .6;
  cursor: not-allowed;
  background: #f3f4f6;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--red-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text2);
  padding: 6px 10px;
}

.btn-ghost:hover {
  color: var(--red);
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ── TABLE ── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #fafafa;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

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

tr:hover td {
  background: #fafafa;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text2);
}

.empty-icon { font-size: 36px; margin-bottom: 10px; }
.empty-text { font-size: 14px; font-weight: 600; }
.empty-hint { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.b-green { background: #f0fdf4; color: #16a34a; }
.b-amber { background: #fffbeb; color: #d97706; }
.b-red   { background: #fef2f2; color: #dc2626; }
.b-blue  { background: #eff6ff; color: #2563eb; }
.b-gray  { background: #f9fafb; color: #6b7280; border: 1px solid var(--border); }
.b-blue   { background: #eff6ff; color: #2563eb; }
.b-purple { background: #faf5ff; color: #7c3aed; }

/* ── ABSENSI: status toggle (Hadir/Sakit/Izin) ── */
.ab-status-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
  transition: all .15s;
}
.ab-status-btn:hover { background: #f9fafb; }
.ab-status-btn.active[data-status="Hadir"] { background: #f0fdf4; border-color: #16a34a; color: #16a34a; }
.ab-status-btn.active[data-status="Sakit"] { background: #eff6ff; border-color: #2563eb; color: #2563eb; }
.ab-status-btn.active[data-status="Izin"]  { background: #faf5ff; border-color: #7c3aed; color: #7c3aed; }

/* ── ABSENSI: live indicator & campus grouping ── */
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #dc2626;
  margin-right: 6px;
  animation: live-pulse 1.5s infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
  100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}
.campus-group {
  margin-bottom: 20px;
}
.campus-group:last-child { margin-bottom: 0; }
.campus-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2, #374151);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 7px 12px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text2);
  border: none;
  background: none;
  font-family: var(--font);
  transition: all .15s;
}

.tab-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ── DYNAMIC ROWS ── */
.dyn-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.dyn-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.row-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── FILE UPLOAD ── */
.file-drop {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  font-size: 12px;
  color: var(--text2);
}

.file-drop:hover {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}

.file-drop.has-file {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

/* ── TOAST ── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
  color: #fff;
  animation: slideIn .2s ease;
  pointer-events: none;
}

.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.info    { background: var(--text); }

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ── PAGE VISIBILITY ── */
.page        { display: none; }
.page.active { display: block; }

/* ── DOWNLOAD CARDS ── */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.dl-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
}

.dl-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.dl-card-icon  { font-size: 32px; margin-bottom: 10px; }
.dl-card-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.dl-card-hint  { font-size: 12px; color: var(--text2); margin-bottom: 14px; }

/* ── ALERT BOXES ── */
.alert {
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 14px;
}

.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── MENTOR BADGE ── */
.mentor-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #7ca9c4, #25b7b7);
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* ── UTILITIES ── */
.divider         { height: 1px; background: var(--border); margin: 20px 0; }
.flex            { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2           { gap: 8px; }
.gap-3           { gap: 12px; }
.mt-3            { margin-top: 12px; }
.mt-4            { margin-top: 16px; }
.mb-3            { margin-bottom: 12px; }
.text-sm         { font-size: 12px; color: var(--text2); }

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

kbd {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--mono);
}

/* ── ROOM NIGHT ACHIEVEMENT ── */
.rna-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 14px;
}

.rna-filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rna-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rna-select {
  width: 180px;
  background: #fff;
  cursor: pointer;
}

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

.rna-table thead th {
  background: #fafafa;
  border-bottom: 2px solid var(--red);
  padding: 16px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  white-space: nowrap;
}

.rna-table tbody td {
  padding: 16px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  color: var(--text);
}

.rna-table tbody tr:hover td { background: #fafafa; }
.rna-name  { font-weight: 700; }
.rna-email { color: var(--text3); font-style: italic; }
.rna-total { font-weight: 700; color: var(--red); }

.rna-team {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
}

@media (max-width: 768px) {
  .rna-topbar { flex-direction: column; align-items: flex-start; }
  .rna-select { width: 100%; }
  .auth-card  { padding: 24px 20px; }
  .stat-grid  { grid-template-columns: repeat(2, 1fr); }
  .qa-grid    { grid-template-columns: repeat(2, 1fr); }
  .dl-grid    { grid-template-columns: 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
}
