/* RBI Form - Government Project - Light Professional Theme */
:root {
  --color-bg: #f0f7ff;
  --color-surface: #ffffff;
  --color-accent: #1d4ed8;
  --color-accent-light: #2563eb;
  --color-success: #047857;
  --color-text: #1e293b;
  --color-text-muted: #475569;
  --color-border: #cbd5e1;
  --color-header-bg: #1e3a8a;
  --font-display: 'Hind', 'Outfit', system-ui, sans-serif;
  --font-body: 'Hind', system-ui, sans-serif;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--color-bg);
  font-family: var(--font-body);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header - Government style */
.form-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  padding: 2rem 1.5rem;
  text-align: center;
  color: #ffffff;
  box-shadow: var(--shadow-lg);
}

.form-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.form-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.form-header .header-logo {
  height: 56px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.form-header .header-text {
  text-align: center;
}

.form-header h1 {
  margin: 0;
}

.form-header p {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  opacity: 0.95;
  font-weight: 500;
}

/* Main Layout - Form Left, Sidebar Right */
.main-layout {
  display: flex;
  gap: 2rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  align-items: flex-start;
}

.form-column {
  flex: 1;
  min-width: 0;
}

/* Sidebar */
.form-sidebar {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
}

.sidebar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-header-bg);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-accent);
}

.question-counter {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 600;
}

.question-counter #filledCount {
  color: var(--color-success);
}

.question-counter #remainingCount {
  color: var(--color-accent);
}

.counter-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.counter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-success));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.guide-content {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.guide-text {
  margin: 0;
}

/* Profile Card */
.profile-content {
  font-size: 0.9rem;
}

.profile-placeholder {
  margin: 0;
  color: var(--color-text-muted);
  font-style: italic;
}

.profile-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.profile-item:last-child {
  border-bottom: none;
}

.profile-label {
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 90px;
}

.profile-value {
  color: var(--color-text);
}

/* Container - fallback */
.form-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Progress Bar */
.progress-wrapper {
  margin-bottom: 2rem;
}

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.progress-step {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
  transition: all 0.3s ease;
}

.progress-step.active {
  background: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.2);
  transform: scale(1.2);
}

.progress-step.done {
  background: var(--color-success);
}

.progress-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-success));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Form Section Card */
.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  animation: cardIn 0.5s ease;
}

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

.section-header {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-header-bg);
  margin: 0 0 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--color-accent);
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.form-grid > div {
  display: flex;
  flex-direction: column;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

/* Labels */
.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.form-group:focus-within .form-label {
  color: var(--color-accent);
}

/* Inputs */
.form-control,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:hover,
.form-select:hover {
  border-color: #94a3b8;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.form-control:disabled,
.form-select:disabled {
  background: #f1f5f9;
  opacity: 0.8;
  cursor: not-allowed;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

select.form-select option {
  background: #ffffff;
  color: var(--color-text);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Error messages */
.text-red-500 {
  color: #dc2626;
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.text-gray-700 {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

/* Checkbox Groups */
.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  max-height: 220px;
  overflow-y: auto;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
  padding: 0.3rem 0;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* Buttons */
.btn-primary,
.btn-success,
.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary,
.btn-success {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: white;
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.btn-primary:disabled,
.btn-success:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-back {
  background: #ffffff;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-back:hover {
  background: #f8fafc;
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Button Row */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Consent Box */
.consent-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.consent-box label {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text);
}

.consent-box input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--color-accent);
  margin-top: 0.15rem;
  flex-shrink: 0;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.4s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: #f1f5f9;
  color: var(--color-text-muted);
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--color-accent);
  color: white;
}

.stage-logic {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  white-space: pre-line;
  background: #f8fafc;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .main-layout {
    flex-direction: column;
  }
  
  .form-sidebar {
    width: 100%;
    position: static;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
  }
  
  .form-sidebar .sidebar-card {
    flex: 1;
    min-width: 280px;
  }
}

@media (max-width: 640px) {
  .form-section {
    padding: 1.5rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .checkbox-group {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions .btn-primary,
  .form-actions .btn-success {
    width: 100%;
  }
  
  .form-sidebar {
    flex-direction: column;
  }
  
  .form-sidebar .sidebar-card {
    min-width: 100%;
  }
}
