/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #8b5cf6;
  --purple-dark: #7c3aed;
  --purple-light: #ede9fe;
  --blue: #3b82f6;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --orange: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #f0f0ff 0%, #f0f7ff 50%, #f0fdf4 100%);
  color: var(--gray-700);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 580px;
  padding: 32px 16px 48px;
  flex: 1;
}

.hidden { display: none !important; }

/* ===== Card ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

/* ===== Skeleton Loading ===== */
.skeleton-header {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.skeleton-line {
  height: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-header .skeleton-title { width: 180px; height: 22px; }
.skeleton-header .skeleton-desc { width: 260px; height: 14px; }

#loading .card {
  border-radius: 0 0 var(--radius) var(--radius);
}
.skeleton-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: 10px;
  margin-bottom: 24px;
}
.skeleton-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--gray-200);
  animation: shimmer 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
.skeleton-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.skeleton-info .skeleton-line { background: var(--gray-200); }
.skeleton-field { margin-bottom: 24px; }
.skeleton-field .skeleton-line { background: var(--gray-200); margin-bottom: 10px; }
.skeleton-options { display: flex; gap: 10px; }
.skeleton-option {
  width: 80px; height: 40px;
  border-radius: 8px;
  background: var(--gray-100);
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-input {
  width: 100% !important;
  height: 42px !important;
  background: var(--gray-100) !important;
}
.skeleton-btn {
  width: 100%; height: 48px;
  border-radius: 10px;
  background: var(--gray-200);
  margin-top: 8px;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Error ===== */
.error-card { text-align: center; padding: 48px 24px; }
.error-icon {
  width: 64px; height: 64px;
  background: var(--red-light);
  color: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.error-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--gray-800); }
.error-msg { color: var(--gray-500); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }

/* ===== Progress Bar ===== */
.progress-wrap {
  height: 4px;
  background: var(--gray-200);
  border-radius: 4px;
  margin-bottom: 20px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ===== Form Header ===== */
.form-header {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: white;
  padding: 32px 24px 28px;
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
}
.header-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  backdrop-filter: blur(8px);
}
.form-header h1 { font-size: 22px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.3px; }
.form-header p { font-size: 14px; opacity: 0.88; line-height: 1.5; max-width: 420px; margin: 0 auto; }

.form-body {
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: none;
}

/* ===== Employee Info Badge ===== */
.info-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #faf5ff, #eff6ff);
  border: 1px solid #e9e0ff;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 28px;
}
.info-avatar {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(139,92,246,0.3);
}
.info-details { flex: 1; min-width: 0; }
.info-name { font-weight: 700; font-size: 15px; color: var(--gray-800); }
.info-meta { font-size: 13px; color: var(--gray-500); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ===== Form Fields ===== */
.field-group {
  margin-bottom: 24px;
  animation: fadeInUp 0.35s ease both;
}
.field-group:nth-child(1) { animation-delay: 0.05s; }
.field-group:nth-child(2) { animation-delay: 0.1s; }
.field-group:nth-child(3) { animation-delay: 0.15s; }
.field-group:nth-child(4) { animation-delay: 0.2s; }
.field-group:nth-child(5) { animation-delay: 0.25s; }

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

.field-group.field-hidden {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
  animation: none;
  transition: all 0.3s ease;
}
.field-group.field-visible {
  animation: fadeInUp 0.35s ease both;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-800);
  margin-bottom: 6px;
  line-height: 1.4;
}
.field-label .required-star { color: var(--red); margin-left: 2px; }
.field-description {
  font-size: 13px;
  color: var(--gray-400);
  margin-bottom: 10px;
  line-height: 1.4;
}

/* Text / Email / Number / Date */
.field-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--gray-700);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.field-input:hover { border-color: var(--gray-300); }
.field-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}
.field-input::placeholder { color: var(--gray-300); }

/* Textarea */
textarea.field-input {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}
.textarea-wrap { position: relative; }
.char-count {
  position: absolute;
  bottom: 10px; right: 12px;
  font-size: 11px;
  color: var(--gray-400);
  pointer-events: none;
}

/* Radio & Checkbox groups */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.option-item { position: relative; }
.option-item input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.option-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.option-label:hover {
  border-color: #c4b5fd;
  background: #faf5ff;
}
.option-item input:checked + .option-label {
  border-color: var(--purple);
  background: var(--purple-light);
  color: var(--purple-dark);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}

/* Radio dot */
.option-dot {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.option-dot::after {
  content: '';
  width: 10px; height: 10px;
  background: var(--purple);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.option-item input:checked + .option-label .option-dot { border-color: var(--purple); }
.option-item input:checked + .option-label .option-dot::after { transform: scale(1); }

/* Checkbox */
.option-check {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.option-check::after {
  content: '\2713';
  font-size: 13px;
  color: white;
  font-weight: 700;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.option-item input:checked + .option-label .option-check {
  border-color: var(--purple);
  background: var(--purple);
}
.option-item input:checked + .option-label .option-check::after { transform: scale(1); }

/* Select */
.field-select {
  width: 100%;
  padding: 11px 14px;
  padding-right: 40px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--gray-700);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-select:hover { border-color: var(--gray-300); }
.field-select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}

/* Star Rating */
.rating-group {
  display: flex;
  gap: 4px;
  direction: rtl;
  justify-content: flex-end;
}
.rating-group input { display: none; }
.rating-star {
  font-size: 36px;
  cursor: pointer;
  color: var(--gray-200);
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}
.rating-star:hover,
.rating-group input:checked ~ .rating-star {
  color: var(--orange);
}
.rating-star:hover { transform: scale(1.2); }

/* Scale 1-10 */
.scale-group { display: flex; gap: 6px; }
.scale-btn {
  flex: 1;
  height: 42px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  font-size: 14px; font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.scale-btn:hover { border-color: #c4b5fd; background: #faf5ff; color: var(--purple); }
.scale-btn.active {
  border-color: var(--purple);
  background: var(--purple);
  color: white;
  box-shadow: 0 2px 8px rgba(139,92,246,0.3);
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 6px;
  padding: 0 2px;
}

/* Heading */
.field-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  padding-top: 16px;
  margin-bottom: 4px;
  border-top: 1px solid var(--gray-100);
}
.field-group:first-child .field-heading { border-top: none; padding-top: 0; }

/* Info block */
.field-info {
  background: #f0f9ff;
  border-left: 3px solid var(--blue);
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.6;
}

/* Validation error */
.field-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 6px;
  display: none;
  align-items: center;
  gap: 4px;
}
.field-group.has-error .field-error { display: flex; }
.field-group.has-error .field-input,
.field-group.has-error .field-select {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.08);
}
.field-group.has-error .option-label { border-color: #fca5a5; }

/* ===== Draft Notice ===== */
.draft-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-400);
  padding: 8px 0;
}
.draft-clear {
  background: none;
  border: none;
  color: var(--purple);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 4px;
  font-family: inherit;
}
.draft-clear:hover { text-decoration: underline; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: white;
  box-shadow: 0 2px 12px rgba(139,92,246,0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(139,92,246,0.4);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(139,92,246,0.3); }
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

.btn-secondary {
  background: var(--purple-light);
  color: var(--purple-dark);
  border: 1.5px solid #ddd6fe;
}
.btn-secondary:hover { background: #e4d9fd; }

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  border: 1.5px solid var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-300); }

.form-actions { margin-top: 32px; }
.btn-submit { width: 100%; padding: 14px; font-size: 16px; border-radius: 12px; }
.btn-spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Thank You ===== */
.thankyou-container {
  text-align: center;
  padding-top: 40px;
}

/* Animated checkmark */
.thankyou-check { margin-bottom: 20px; }
.checkmark {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: block;
  margin: 0 auto;
  stroke: var(--green);
  stroke-width: 2;
  animation: scaleIn 0.4s ease both;
}
.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: strokeCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.1s forwards;
}
.checkmark-path {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: strokeCheck 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}
@keyframes scaleIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
@keyframes strokeCircle {
  to { stroke-dashoffset: 0; }
}
@keyframes strokeCheck {
  to { stroke-dashoffset: 0; }
}

.thankyou-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.thankyou-subtitle {
  font-size: 15px;
  color: var(--gray-500);
  margin-bottom: 28px;
}
.thankyou-card { text-align: center; }
.thankyou-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 10px;
}
.thankyou-date-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--gray-500);
  background: var(--gray-50);
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 24px;
}
.thankyou-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--gray-400);
}
.footer strong { font-weight: 600; color: var(--gray-500); }

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .container { padding: 16px 10px 36px; }
  .card { padding: 22px 16px; }
  .form-header { padding: 26px 16px 22px; }
  .form-header h1 { font-size: 19px; }

  .option-group { gap: 8px; }
  .option-label { padding: 11px 16px; width: 100%; }

  .scale-group { gap: 3px; }
  .scale-btn { height: 38px; font-size: 13px; border-radius: 6px; }

  .rating-star { font-size: 30px; }

  .info-badge { padding: 14px; }
  .info-meta { font-size: 12px; }

  .thankyou-actions { flex-direction: column; }
  .thankyou-actions .btn { width: 100%; }

  .field-input, .field-select { font-size: 16px; /* prevents iOS zoom */ }
}

@media (max-width: 360px) {
  .scale-btn { height: 34px; font-size: 12px; }
  .form-header h1 { font-size: 17px; }
}
