/* ===== EVALY SKIN QUIZ - Design System ===== */
:root {
  --primary: #1a1a1a;
  --primary-light: #333;
  --accent: #e63946;
  --accent-hover: #c1121f;
  --accent-soft: #ffccd5;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-dark: #111111;
  --text: #1a1a1a;
  --text-light: #666;
  --text-white: #fff;
  --border: #e0e0e0;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

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

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

/* ===== Router ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== Quiz Layout ===== */
.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.quiz-hero {
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.quiz-hero img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.9;
}
.quiz-hero .brand-overlay {
  position: absolute; bottom: 40px; left: 40px;
  display: flex; align-items: center; gap: 16px;
}
.quiz-hero .brand-overlay .brand-name {
  font-family: var(--font-serif);
  font-size: 28px; font-weight: 700;
  color: var(--text-white); letter-spacing: 2px;
}
.quiz-content {
  padding: 60px 48px;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  position: relative;
}
.quiz-close {
  position: absolute; top: 20px; right: 24px;
  width: 40px; height: 40px; border: none;
  background: transparent; cursor: pointer;
  font-size: 24px; color: var(--text-light);
  border-radius: 50%; transition: var(--transition);
}
.quiz-close:hover { background: #f0f0f0; color: var(--text); }

/* ===== Quiz Steps ===== */
.quiz-step { display: none; width: 100%; max-width: 520px; animation: fadeSlideUp 0.5s ease; }
.quiz-step.active { display: block; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes progressBar {
  from { width: 0; }
}

/* ===== Typography ===== */
.quiz-title {
  font-family: var(--font-serif);
  font-size: 32px; font-weight: 700;
  margin-bottom: 16px; line-height: 1.3;
}
.quiz-subtitle {
  font-size: 15px; color: var(--text-light);
  margin-bottom: 32px; line-height: 1.7;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 16px 32px;
  border: none; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; text-transform: uppercase;
  letter-spacing: 1px; width: 100%;
}
.btn-primary {
  background: var(--accent); color: white;
  box-shadow: 0 4px 16px rgba(230, 57, 70, 0.3);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(230, 57, 70, 0.4);
  transform: translateY(-2px);
}
.btn-outline {
  background: transparent; color: var(--text);
  border: 2px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--text); background: #f5f5f5;
}
.btn-sm { padding: 10px 20px; font-size: 13px; width: auto; }
.btn-buy {
  background: var(--accent); color: white;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 14px; font-size: 14px;
}
.btn-buy:hover { background: var(--accent-hover); }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 24px; }
.form-label {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
  font-weight: 500; font-size: 15px;
}
.form-label .icon {
  width: 32px; height: 32px;
  border: 2px solid var(--text); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

/* ===== Age Picker ===== */
.age-picker {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 40px 0;
}
.age-picker input {
  width: 80px; text-align: center;
  font-size: 48px; font-weight: 300;
  border: none; border-bottom: 2px solid var(--border);
  background: transparent; color: var(--text);
  font-family: var(--font-sans);
  outline: none; transition: var(--transition);
}
.age-picker input:focus { border-color: var(--accent); }
.age-picker span { font-size: 20px; color: var(--text-light); }

/* ===== Skin Type Cards ===== */
.skin-type-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-top: 24px;
}
.skin-type-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px; text-align: center;
  cursor: pointer; transition: var(--transition);
}
.skin-type-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.skin-type-card.selected {
  border-color: var(--accent);
  background: rgba(230, 57, 70, 0.05);
}
.skin-type-card .icon-wrap {
  width: 64px; height: 64px; margin: 0 auto 12px;
  border-radius: 50%; background: #f5f5f5;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.skin-type-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.skin-type-card p { font-size: 12px; color: var(--text-light); line-height: 1.5; }
.skin-type-card .btn { margin-top: 12px; }

/* ===== Concern Cards ===== */
.concern-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-top: 20px;
}
.concern-card {
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-align: center; cursor: pointer;
  transition: var(--transition);
}
.concern-card:hover { border-color: var(--accent); }
.concern-card.selected { border-color: var(--accent); background: rgba(230,57,70,0.05); }
.concern-card .emoji { font-size: 28px; margin-bottom: 8px; }
.concern-card span { font-size: 13px; font-weight: 500; }

/* ===== Tag Badge ===== */
.tag-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: white;
  padding: 8px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  float: right; margin-top: 8px;
}
.tag-badge .edit-btn {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4);
  color: white; padding: 4px 12px; border-radius: 12px;
  font-size: 11px; cursor: pointer; transition: var(--transition);
}
.tag-badge .edit-btn:hover { background: rgba(255,255,255,0.3); }

/* ===== Completion ===== */
.completion-icon {
  width: 100px; height: 100px; margin: 32px auto;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: white;
  box-shadow: 0 8px 32px rgba(230, 57, 70, 0.3);
  animation: pulse 2s infinite;
}
.completion-text {
  text-align: center; font-size: 15px;
  color: var(--text-light); margin-bottom: 32px;
}

/* ===== Analysis Loading ===== */
.analysis-loading {
  text-align: center; padding: 40px 0;
}
.analysis-loading .spinner {
  width: 60px; height: 60px; margin: 0 auto 24px;
  border: 3px solid #f0f0f0;
  border-top: 3px solid var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite;
}
.analysis-loading .progress-bar {
  width: 100%; height: 4px; background: #f0f0f0;
  border-radius: 2px; margin-top: 16px; overflow: hidden;
}
.analysis-loading .progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; animation: progressBar 3s ease forwards;
}

/* ===== Results ===== */
.results-header {
  text-align: center; padding: 20px 0;
  border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.results-header .brand-text {
  font-family: var(--font-serif); font-size: 28px;
  font-weight: 700; letter-spacing: 2px;
}
.profile-card {
  position: relative; border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 32px;
  background: var(--bg-dark); color: white;
}
.profile-card img {
  width: 100%; height: 280px; object-fit: cover;
  opacity: 0.7;
}
.profile-card .overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.profile-card .overlay h3 {
  font-family: var(--font-serif); font-size: 22px;
  margin-bottom: 6px;
}
.profile-card .overlay p { font-size: 13px; opacity: 0.8; }

.score-bars { margin-bottom: 32px; }
.score-item {
  margin-bottom: 8px; animation: fadeIn 0.5s ease;
}
.score-bar {
  display: flex; align-items: center;
  padding: 10px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: white;
  position: relative; overflow: hidden;
  transition: var(--transition); cursor: pointer;
}
.score-bar:hover { transform: translateX(4px); }
.score-bar-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  border-radius: 8px; transition: width 1s ease;
}
.score-bar span { position: relative; z-index: 1; }
.score-low .score-bar-fill { background: linear-gradient(90deg, #e63946, #ff6b6b); }
.score-mid .score-bar-fill { background: linear-gradient(90deg, #f4a261, #e9c46a); }
.score-high .score-bar-fill { background: linear-gradient(90deg, #2d6a4f, #40916c); }

/* ===== Product Section ===== */
.section-title {
  font-family: var(--font-serif);
  font-size: 24px; font-weight: 700;
  margin-bottom: 8px;
}
.section-desc {
  font-size: 14px; color: var(--text-light);
  margin-bottom: 24px;
}
.category-selector {
  display: flex; margin-bottom: 24px;
  background: #f0f0f0; border-radius: 8px; overflow: hidden;
}
.category-selector button {
  flex: 1; padding: 12px 16px; border: none;
  font-family: var(--font-sans); font-size: 14px;
  font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-light);
  transition: var(--transition);
}
.category-selector button.active {
  background: var(--accent); color: white;
  box-shadow: 0 2px 8px rgba(230,57,70,0.3);
}

.product-highlight {
  border: 2px solid var(--accent); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 24px;
  position: relative;
}
.product-highlight .badge {
  position: absolute; top: 0; left: 0;
  background: var(--accent); color: white;
  padding: 6px 16px; font-size: 12px;
  font-weight: 600; border-radius: 0 0 8px 0;
}
.product-highlight .product-info {
  padding: 24px; display: flex; gap: 16px; align-items: center;
}
.product-highlight .product-info img {
  width: 100px; height: 140px; object-fit: contain;
}
.product-highlight .product-info h4 {
  font-size: 15px; font-weight: 700; margin-bottom: 8px;
}
.product-highlight .product-info p {
  font-size: 13px; color: var(--text-light); line-height: 1.6;
}

/* ===== Routine Steps ===== */
.routine-step {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
  transition: var(--transition);
}
.routine-step:hover { box-shadow: var(--shadow); }
.routine-step .step-label {
  font-family: var(--font-serif);
  font-size: 20px; font-weight: 700;
  padding: 16px 24px 0;
}
.routine-step .step-content {
  padding: 16px 24px;
  display: flex; gap: 16px; align-items: center;
}
.routine-step .step-content img {
  width: 80px; height: 100px; object-fit: contain;
  flex-shrink: 0;
}
.routine-step .step-content h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.routine-step .step-content p { font-size: 12px; color: var(--text-light); line-height: 1.5; }

/* ===== Intro Content Sections ===== */
.intro-section {
  text-align: left;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.intro-section:first-of-type { margin-top: 24px; }
.intro-section h3 {
  font-family: var(--font-serif);
  font-size: 20px; font-weight: 700;
  margin-bottom: 12px; line-height: 1.4;
}
.intro-section p {
  font-size: 13px; color: var(--text-light);
  line-height: 1.8;
}
.intro-section-img {
  width: 100%; max-height: 200px;
  object-fit: cover; border-radius: var(--radius);
  margin-bottom: 16px;
}

/* ===== LINE CTA Button ===== */
.line-cta {
  text-align: center;
  padding: 24px 0;
  margin-bottom: 32px;
}
.line-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #06C755;
  color: white;
  padding: 16px 40px;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(6, 199, 85, 0.3);
  letter-spacing: 0.5px;
}
.line-btn:hover {
  background: #05b34d;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(6, 199, 85, 0.4);
}
.line-btn svg { flex-shrink: 0; }
.line-sub {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 12px;
}

/* ===== Upload Area ===== */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px; text-align: center; cursor: pointer;
  transition: var(--transition); margin-bottom: 16px;
}
.upload-area:hover { border-color: var(--accent); background: rgba(230,57,70,0.02); }
.upload-area .upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-area p { font-size: 14px; color: var(--text-light); }
.upload-preview {
  width: 100%; max-height: 300px; object-fit: contain;
  border-radius: var(--radius); margin-bottom: 16px;
}

/* ===== ADMIN PAGE ===== */
.admin-layout {
  display: flex; min-height: 100vh;
}
.admin-sidebar {
  width: 260px; background: var(--bg-dark); color: white;
  padding: 32px 0; flex-shrink: 0;
  display: flex; flex-direction: column;
}
.admin-sidebar .brand {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 700;
  padding: 0 24px 32px; letter-spacing: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar .brand small {
  display: block; font-family: var(--font-sans);
  font-size: 11px; font-weight: 400;
  opacity: 0.5; letter-spacing: 0; margin-top: 4px;
}
.admin-nav { padding: 16px 0; flex: 1; }
.admin-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; color: rgba(255,255,255,0.6);
  text-decoration: none; font-size: 14px;
  transition: var(--transition); border-left: 3px solid transparent;
}
.admin-nav a:hover, .admin-nav a.active {
  color: white; background: rgba(255,255,255,0.05);
  border-left-color: var(--accent);
}
.admin-nav a .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.admin-logout {
  padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.1);
}
.admin-logout a {
  color: rgba(255,255,255,0.4); text-decoration: none;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.admin-logout a:hover { color: var(--accent); }

.admin-main {
  flex: 1; padding: 32px 40px; background: #f5f5f7;
  overflow-y: auto;
}
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px;
}
.admin-header h1 {
  font-family: var(--font-serif); font-size: 28px;
}
.admin-header .preview-link {
  color: var(--accent); text-decoration: none;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}

/* ===== Admin Cards ===== */
.admin-card {
  background: white; border-radius: var(--radius);
  padding: 28px; margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.admin-card h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 4px;
}
.admin-card .card-desc {
  font-size: 13px; color: var(--text-light); margin-bottom: 20px;
}

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.admin-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== Admin Form ===== */
.admin-form-group { margin-bottom: 20px; }
.admin-form-group label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 14px;
  transition: var(--transition); outline: none;
}
.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.1);
}
.admin-form-group textarea { min-height: 80px; resize: vertical; }

.admin-img-preview {
  width: 120px; height: 120px;
  border-radius: var(--radius-sm);
  object-fit: cover; border: 1px solid var(--border);
}
.admin-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); background: transparent;
  cursor: pointer; font-size: 13px; color: var(--text-light);
  transition: var(--transition);
}
.admin-upload-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
}
.login-box {
  background: white; border-radius: var(--radius-lg);
  padding: 48px 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-box .brand {
  font-family: var(--font-serif);
  font-size: 32px; font-weight: 700;
  text-align: center; margin-bottom: 8px;
}
.login-box .brand-sub {
  text-align: center; font-size: 13px;
  color: var(--text-light); margin-bottom: 32px;
}
.login-box .admin-form-group { margin-bottom: 16px; }
.login-box .btn { margin-top: 8px; }
.login-error {
  background: #fff0f0; color: var(--accent);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px; display: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-hero { height: 40vh; position: relative; }
  .quiz-content { padding: 32px 20px; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-grid-3 { grid-template-columns: 1fr; }
  .skin-type-grid { grid-template-columns: 1fr; }
}
