/* ============================================
   Tamizajes Beck BDI-II — Mobile-First Styles
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-glass: rgba(255,255,255,0.05);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --accent-dark: #d97706;
  --border: rgba(148,163,184,0.15);
  --success: #22c55e;
  --warning: #f97316;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 0%, rgba(245,158,11,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 100%, rgba(59,130,246,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---- App Container ---- */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.app-header {
  text-align: center;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 8px rgba(245,158,11,0.3));
  border-radius: 10px;
}
.app-header .logo-text {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.app-header h1 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.app-header .subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Progress Bar ---- */
.progress-wrapper {
  margin-bottom: 20px;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

/* ---- Screen (Wizard Step) ---- */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  animation: fadeSlideIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-30px); }
}

/* ---- Cards / Glass Panels ---- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title .icon { font-size: 1.3rem; }

/* ---- Form Fields ---- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}
.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}
.error-msg {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.error-msg.visible { display: block; }

/* ---- Radio Options (Questions) ---- */
.question-number {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.question-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-item {
  position: relative;
}
.option-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.option-label {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}
.option-label:active {
  transform: scale(0.98);
}
.option-item input[type="radio"]:checked + .option-label {
  border-color: var(--accent);
  background: rgba(245,158,11,0.08);
  box-shadow: 0 0 0 1px var(--accent);
}
.option-radio {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: var(--transition);
}
.option-item input[type="radio"]:checked + .option-label .option-radio {
  border-color: var(--accent);
  background: var(--accent);
}
.option-item input[type="radio"]:checked + .option-label .option-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-primary);
}
.option-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
}
.option-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 20px;
  text-align: center;
  margin-top: 4px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 28px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--bg-primary);
  box-shadow: 0 4px 16px rgba(245,158,11,0.25);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(245,158,11,0.35);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-block { width: 100%; }

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}
.btn-row .btn { flex: 1; }

/* ---- Results ---- */
.result-score {
  text-align: center;
  padding: 30px 20px;
}
.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  border: 4px solid;
  background: var(--bg-secondary);
}
.score-number {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}
.score-max {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.score-label {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.score-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto;
}

.result-detail {
  margin-top: 16px;
}
.result-detail h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-detail p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Alert box */
.alert-box {
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.alert-box.alert-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
}
.alert-box.alert-warning {
  background: rgba(249,115,22,0.1);
  border: 1px solid rgba(249,115,22,0.3);
  color: #fed7aa;
}
.alert-box.alert-info {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  color: #93c5fd;
}
.alert-icon { font-size: 1.3rem; min-width: 24px; }

/* ---- Signature Section ---- */
.signature-section { margin-bottom: 20px; }
.signature-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}
.signature-canvas-wrap {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  position: relative;
}
.signature-canvas-wrap canvas {
  width: 100%;
  height: 180px;
  display: block;
}
.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn-clear-sig {
  font-size: 0.8rem;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-clear-sig:hover { color: var(--danger); border-color: var(--danger); }

/* ---- Legal Notice ---- */
.legal-notice {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
  line-height: 1.5;
}

/* ---- Scale Bar Visualization ---- */
.scale-bar {
  display: flex;
  height: 12px;
  border-radius: 99px;
  overflow: hidden;
  margin: 16px 0;
}
.scale-segment { height: 100%; position: relative; }
.scale-marker {
  position: absolute;
  top: -8px;
  width: 4px;
  height: 28px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  transform: translateX(-50%);
  z-index: 2;
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Item Breakdown ---- */
.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 0.8rem;
}
.breakdown-item .item-name {
  color: var(--text-secondary);
  flex: 1;
}
.breakdown-item .item-score {
  font-weight: 700;
  min-width: 24px;
  text-align: center;
  border-radius: 4px;
  padding: 2px 6px;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .app-container { padding: 24px; }
  .app-header { padding: 20px 0 16px; }
  .header-logo { width: 60px; height: 60px; }
  .app-header .logo-text { font-size: 0.9rem; }
  .app-header h1 { font-size: 1.6rem; }
  .app-header .subtitle { font-size: 0.85rem; }
  .question-title { font-size: 1.5rem; }
  .card { padding: 30px; }
  .signature-canvas-wrap canvas { height: 220px; }
}

@media (max-width: 380px) {
  .app-container { padding: 12px; }
  .card { padding: 18px; }
  .option-label { padding: 12px; }
  .btn { padding: 14px 20px; min-height: 48px; }
}

/* ---- Print ---- */
@media print {
  body { background: #fff; color: #000; }
  .btn, .btn-row, .progress-wrapper, .app-header { display: none !important; }
  .card { background: #fff; border: 1px solid #ccc; box-shadow: none; }
}
