/* ============================================================
   Rapor HRD - Moir Salon
   Global Styles
   ============================================================ */

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

:root {
  --gold: #c9a96e;
  --gold-dark: #a8853a;
  --gold-light: #e8d5a8;
  --gold-bg: #fdf8f0;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red: #ef4444;
  --red-light: #fee2e2;
  --green: #22c55e;
  --green-light: #dcfce7;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  /* Softer shadows */
  --shadow-sm: 0 1px 2px rgba(17,24,39,0.05);
  --shadow: 0 6px 20px rgba(17,24,39,0.06);
  --shadow-md: 0 10px 28px rgba(17,24,39,0.08);
  --shadow-lg: 0 16px 40px rgba(17,24,39,0.10);

  /* Radius */
  --radius: 12px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: #f6f7f9; /* off-white / soft gray */
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- Typography ---- */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
p { color: var(--gray-600); }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* ---- Navbar ---- */
.navbar {
  background: var(--white);
  border-bottom: 2px solid var(--gold);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.navbar-brand .logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
}
.navbar-brand .logo-sub {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
  margin-top: -2px;
}
.navbar-logo {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
}
.user-badge .role-badge {
  background: var(--gold-bg);
  color: var(--gold-dark);
  border: 1px solid var(--gold-light);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.btn-logout {
  background: none;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}
.btn-logout:hover { background: var(--red-light); border-color: var(--red); color: var(--red); }

/* ---- Main Content ---- */
.main-content {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-200);
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--gold);
}
.stat-label { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-800); }
.stat-sub { font-size: 0.8rem; color: var(--gray-400); margin-top: 0.25rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--gold);
  color: white;
}
.btn-primary:hover { background: var(--gold-dark); }
.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); }
.btn-success {
  background: var(--green);
  color: white;
}
.btn-success:hover { background: #16a34a; }
.btn-danger {
  background: var(--red);
  color: white;
}
.btn-danger:hover { background: #dc2626; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-dark);
}
.btn-outline:hover { background: var(--gold-bg); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-800);
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--white);
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.15);
}
.form-control:disabled { background: var(--gray-100); color: var(--gray-500); }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--gray-200);
  white-space: normal;
  line-height: 1.15;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ---- Grade Badges ---- */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
}
.grade-A { background: var(--green-light); color: #15803d; }
.grade-B { background: var(--blue-light); color: #1d4ed8; }
.grade-C { background: #fef9c3; color: #854d0e; }
.grade-D { background: #fed7aa; color: #c2410c; }
.grade-E { background: var(--red-light); color: #b91c1c; }

/* ---- Status badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-success { background: var(--green-light); color: #15803d; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger  { background: var(--red-light); color: #b91c1c; }
.badge-gray    { background: var(--gray-100); color: var(--gray-500); }
.badge-gold    { background: var(--gold-bg); color: var(--gold-dark); }

/* Status semantic aliases (as requested) */
.badge-selesai { background: var(--green-light); color: #15803d; }
.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-terlambat { background: var(--red-light); color: #b91c1c; }
.badge-draft { background: var(--gray-100); color: var(--gray-500); }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.5rem;
  gap: 0;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s;
}
.tab-btn.active {
  color: var(--gold-dark);
  border-bottom-color: var(--gold);
}
.tab-btn:hover { color: var(--gray-700); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.alert-error   { background: var(--red-light); color: #b91c1c; border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light); color: #15803d; border: 1px solid #86efac; }
.alert-info    { background: var(--blue-light); color: #1d4ed8; border: 1px solid #93c5fd; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--gray-400);
  line-height: 1;
}
.modal-close:hover { color: var(--gray-700); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}
.hidden { display: none !important; }

/* ---- Loading ---- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold-light);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.filter-bar .form-control { min-width: 120px; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state-text { font-size: 0.9rem; }

/* ---- Rapor Form ---- */
.question-category {
  background: var(--gold-bg);
  border: 1px solid var(--gold-light);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.category-header {
  background: var(--gold);
  color: white;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.category-body { padding: 1rem 1.25rem; }
.question-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gold-light);
}
.question-row:last-child { border-bottom: none; }
.question-num {
  min-width: 28px;
  height: 28px;
  background: var(--gold);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}
.question-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--gray-700);
  padding-top: 3px;
}
.score-options {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}
.score-btn {
  width: 40px;
  height: 34px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  transition: all 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.score-btn:hover { border-color: var(--gold); color: var(--gold-dark); }
.score-btn.selected {
  background: var(--gold);
  border-color: var(--gold);
  color: white;
}
.score-btn .score-label { font-size: 0.6rem; }

/* Score progress */
.score-progress-wrap {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 2px solid var(--gold);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  z-index: 50;
}
.progress-bar-wrap {
  flex: 1;
  background: var(--gray-200);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 20px;
  transition: width 0.3s;
}
.progress-score-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold-dark);
  white-space: nowrap;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .card { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .score-options { gap: 0.25rem; }
  .score-btn { width: 36px; height: 32px; font-size: 0.7rem; }
  .question-row { flex-wrap: wrap; gap: 0.5rem; }
  .question-text { flex: 100%; }
  .score-options { margin-left: 36px; }
  thead th { font-size: 0.75rem; padding: 8px 10px; }
  tbody td { padding: 8px 10px; font-size: 0.8rem; }
  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.125rem; }
  .navbar { padding: 0 1rem; }
  .navbar-brand .logo-text { font-size: 0.9rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .score-btn { width: 34px; height: 30px; }
}
