/* ============================================
   PDS Questionnaire - Clinical Luxe Theme
   Deep navy + warm gold + elegant serifs
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Outfit:wght@300;400;500;600&display=swap');

:root {
  --bg-deep: #0a192f;
  --bg-surface: #112240;
  --bg-elevated: #1a2a4a;
  --bg-hover: #1e3350;
  --border: #1e3a5a;
  --border-light: #2a4a6a;
  --gold: #d4a855;
  --gold-light: #e8c878;
  --gold-dim: #a07a3a;
  --teal: #4ecdc4;
  --text-primary: #e8dcc8;
  --text-secondary: #8aa0b8;
  --text-muted: #4a6a80;
  --error: #e85d5d;
  --error-bg: rgba(232, 93, 93, 0.1);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  font-weight: 300;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(45, 90, 90, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(212, 168, 85, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Layout ---- */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
  position: relative;
  z-index: 1;
}

/* ---- Typography ---- */

h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 36px;
  font-size: 0.95rem;
  font-weight: 300;
}

.page-badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(212, 168, 85, 0.1);
  border: 1px solid rgba(212, 168, 85, 0.2);
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.divider {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
  margin: 16px 0 24px;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  transition: var(--transition);
}

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

.form-group input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(212, 168, 85, 0.1);
  background: var(--bg-elevated);
}

/* ---- Buttons ---- */

.btn {
  display: inline-block;
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: 0.5s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(212, 168, 85, 0.3);
}

.btn:hover::after {
  left: 100%;
}

.btn:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled::after {
  display: none;
}

/* ---- Error Messages ---- */

.error-msg {
  color: var(--error);
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--error-bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--error);
  display: none;
}

.error-msg.visible {
  display: block;
  animation: slideDown 0.3s ease;
}

/* ---- Question Items ---- */

.question-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 16px;
  transition: var(--transition);
  animation: fadeInUp 0.4s ease backwards;
}

.question-item:hover {
  border-color: var(--border-light);
  background: var(--bg-elevated);
}

.question-item .q-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
  margin-right: 10px;
}

.question-item .q-text {
  font-size: 1rem;
  font-weight: 300;
  margin-bottom: 18px;
  line-height: 1.7;
  color: var(--text-primary);
}

.question-item:nth-child(1) { animation-delay: 0.02s; }
.question-item:nth-child(2) { animation-delay: 0.04s; }
.question-item:nth-child(3) { animation-delay: 0.06s; }
.question-item:nth-child(4) { animation-delay: 0.08s; }
.question-item:nth-child(5) { animation-delay: 0.10s; }
.question-item:nth-child(n+6) { animation-delay: 0.12s; }

/* ---- Rating Scale ---- */

.rating-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rating-group .rating-label-text {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  min-width: 65px;
}

.rating-group .rating-label-text.right {
  text-align: right;
}

.rating-group label {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.rating-group label:hover {
  background: var(--bg-hover);
}

.rating-group label span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.rating-group input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: transparent;
}

.rating-group input[type="radio"]:hover {
  border-color: var(--gold-dim);
}

.rating-group input[type="radio"]:checked {
  border-color: var(--gold);
  background: transparent;
}

.rating-group input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  animation: radioFill 0.2s ease;
}

.rating-group label:has(input:checked) span {
  color: var(--gold);
}

/* ---- Admin Sections ---- */

.admin-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.admin-section h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---- Tables ---- */

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th,
.results-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.results-table th {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
}

.results-table td {
  font-weight: 300;
  color: var(--text-primary);
}

.results-table tbody tr {
  transition: var(--transition);
}

.results-table tbody tr:hover {
  background: var(--bg-hover);
}

/* ---- Code List ---- */

.code-list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
  line-height: 2;
  color: var(--gold-light);
  letter-spacing: 2px;
}

/* ---- Stats Row ---- */

.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
}

.stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  text-align: center;
  flex: 1;
  transition: var(--transition);
}

.stat-box:hover {
  border-color: var(--gold-dim);
}

.stat-box .stat-number {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}

.stat-box .stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---- Thank You Card ---- */

.thankyou-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 64px 48px;
  text-align: center;
  margin-top: 80px;
  position: relative;
  overflow: hidden;
}

.thankyou-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.thankyou-card h1 {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 2.8rem;
  margin-bottom: 16px;
}

.thankyou-card p {
  color: var(--text-secondary);
  font-weight: 300;
}

/* ---- Password Overlay ---- */

.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.password-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(45, 90, 90, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(212, 168, 85, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.password-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  width: 420px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.5s ease;
}

.password-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.password-box h2 {
  margin-bottom: 8px;
}

/* ---- Landing Hero ---- */

.hero-header {
  text-align: center;
  padding: 32px 0 40px;
}

.hero-header h1 {
  font-size: 3rem;
  margin-bottom: 4px;
}

.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.form-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ---- Questionnaire Header ---- */

.questionnaire-header {
  text-align: center;
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.questionnaire-header .subtitle {
  margin-bottom: 0;
}

.questionnaire-header strong {
  color: var(--gold);
  font-weight: 500;
}

/* ---- Progress Bar ---- */

.progress-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 25, 47, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin: 0 -24px;
  padding: 14px 24px;
}

.progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- Detail Modal ---- */

.detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 10, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  overflow-y: auto;
  display: none;
}

.detail-overlay.visible {
  display: block;
}

.detail-modal {
  max-width: 860px;
  margin: 40px auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease;
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.detail-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ---- View Link ---- */

a.view-link {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition);
}

a.view-link:hover {
  color: var(--gold-light);
}

/* ---- Animations ---- */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes radioFill {
  from { transform: translate(-50%, -50%) scale(0); }
  to { transform: translate(-50%, -50%) scale(1); }
}

.fade-in {
  animation: fadeInUp 0.6s ease backwards;
}

.fade-in-1 { animation-delay: 0.1s; }
.fade-in-2 { animation-delay: 0.2s; }
.fade-in-3 { animation-delay: 0.3s; }
.fade-in-4 { animation-delay: 0.4s; }

/* ---- Responsive ---- */

@media (max-width: 600px) {
  .container { padding: 32px 16px; }
  h1 { font-size: 1.8rem; }
  .hero-header h1 { font-size: 2.2rem; }
  .rating-group { gap: 4px; }
  .rating-group label { padding: 6px 8px; }
  .rating-group .rating-label-text { min-width: 45px; font-size: 0.6rem; }
  .stats-row { flex-direction: column; }
  .form-card { padding: 24px; }
  .password-box { width: 90%; padding: 32px 24px; }
}
