/* Clarity Slate Design System — Public Survey & Landing Styling */
:root {
  --bg-canvas: #f8fafc;
  --card-bg: #ffffff;
  --primary-indigo: #3730a3;
  --primary-hover: #2e2a8c;
  --primary-light: #eef2ff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --error-color: #dc2626;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --success-color: #059669;
  --success-bg: #ecfdf5;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --shadow-subtle: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --font-family: 'Inter', 'Noto Sans Sinhala', 'Noto Sans Tamil', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  padding: 32px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  -webkit-font-smoothing: antialiased;
}

/* Layout Containers */
.landing-container,
.survey-container,
.thankyou-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Top Progress Bar */
.top-progress-bar-track {
  width: 100%;
  height: 4px;
  background-color: var(--border-subtle);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.top-progress-bar-fill {
  height: 100%;
  background-color: var(--primary-indigo);
  width: 0%;
  transition: width 0.3s ease;
}

/* Base Card Styling */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Top Header Card */
.header-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.header-accent-bar {
  height: 6px;
  background: var(--primary-indigo);
  width: 100%;
}

.header-accent-bar.success-accent {
  background: var(--success-color);
}

.header-accent-bar.error-accent {
  background: var(--error-color);
}

.header-content {
  padding: 28px 32px;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.institution-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-indigo);
  background-color: var(--primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.survey-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.survey-description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 18px;
}

.survey-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  flex-wrap: wrap;
}

.survey-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.required-notice {
  font-size: 13px;
  color: var(--error-color);
  font-weight: 500;
}

/* Language Switcher Pills */
.lang-switcher-mini {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-canvas);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
}

.lang-switcher-mini a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.lang-switcher-mini a:hover {
  color: var(--text-main);
}

.lang-switcher-mini a.active {
  font-weight: 600;
  background-color: var(--card-bg);
  color: var(--primary-indigo);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* Question Cards */
.question-card {
  padding: 28px 32px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-card.focused {
  border-color: var(--primary-indigo);
  box-shadow: 0 0 0 1px var(--primary-indigo), var(--shadow-card);
}

.question-header {
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.question-number {
  color: var(--primary-indigo);
  font-weight: 700;
  min-width: 24px;
}

.required-star {
  color: var(--error-color);
  margin-left: 2px;
}

/* Options Stack & Tile Styling */
.question-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-label {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--card-bg);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  position: relative;
}

.option-label:hover {
  border-color: var(--border-medium);
  background-color: var(--bg-canvas);
}

.option-label:has(input:checked) {
  border-color: var(--primary-indigo);
  background-color: var(--primary-light);
}

.option-label input[type="radio"],
.option-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-indigo);
  margin-right: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.option-text {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 400;
}

/* Other Option Input Container */
.other-option-container {
  flex-wrap: wrap;
  gap: 12px;
}

.other-checkbox-label {
  display: flex;
  align-items: center;
}

.other-text-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-main);
  background-color: var(--card-bg);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.other-text-input:focus {
  border-color: var(--primary-indigo);
  box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.15);
}

/* Free Text Area Input */
.text-input-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  background-color: var(--card-bg);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea:focus {
  border-color: var(--primary-indigo);
  box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.15);
}

.char-counter {
  align-self: flex-end;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Error Banner */
.error-banner {
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  color: var(--error-color);
  font-size: 14px;
}

.error-banner-header {
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-banner ul {
  padding-left: 20px;
}

/* Form Action Buttons */
.submit-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 10px 0;
}

.btn-submit {
  background-color: var(--primary-indigo);
  color: #ffffff;
  border: none;
  padding: 14px 36px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-submit:hover {
  background-color: var(--primary-hover);
}

.btn-submit:active {
  transform: translateY(1px);
}

.btn-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease;
}

.btn-clear:hover {
  color: var(--text-main);
  text-decoration: underline;
}

/* Landing Page Language Selector */
.lang-select-card {
  text-align: center;
  padding: 40px 32px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.lang-btn:hover {
  border-color: var(--primary-indigo);
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.lang-flag {
  font-size: 32px;
  margin-bottom: 10px;
}

.lang-name {
  font-size: 15px;
  font-weight: 600;
}

.lang-native {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Thank You & Error Screens */
.thankyou-card {
  text-align: center;
  padding: 48px 32px;
}

.success-icon {
  width: 60px;
  height: 60px;
  background-color: var(--success-bg);
  color: var(--success-color);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 20px;
}

.error-badge-icon {
  width: 60px;
  height: 60px;
  background-color: var(--error-bg);
  color: var(--error-color);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
  margin-left: auto;
  margin-right: auto;
}

.thankyou-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}

.thankyou-message {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

.thankyou-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.btn-link {
  color: var(--primary-indigo);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

.divider {
  color: var(--border-subtle);
}

.public-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* Loading Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Breakpoints */
@media (max-width: 640px) {
  body {
    padding: 16px 8px;
  }

  .lang-grid {
    grid-template-columns: 1fr;
  }
  
  .header-content,
  .question-card {
    padding: 20px 20px;
  }
  
  .survey-title {
    font-size: 20px;
  }
}
