:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --dark: #0f172a;
  --gray-700: #334155;
  --gray-500: #64748b;
  --gray-300: #cbd5e1;
  --gray-100: #f1f5f9;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  --card-bg: rgba(255, 255, 255, 0.96);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--dark);
  padding: 16px;
}

.app-container {
  max-width: 1050px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 16px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  color: white;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 12px;
}

.header-brand h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.82rem;
  opacity: 0.85;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: 12px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Main Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}

/* Geolocation & Map Card */
.geo-card {
  border-left: 6px solid var(--primary);
}

.geo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.geo-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
}

.geo-header p {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.gps-status-box {
  margin-top: 16px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: 12px;
  border: 1px solid rgba(79, 70, 229, 0.15);
}

.geo-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-item .label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  font-weight: 600;
}

.info-item .val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  width: fit-content;
}

.badge-zoi {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-success {
  background: var(--success-bg);
  color: #065f46;
}

/* Map Styling */
.map-container-wrapper {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(79, 70, 229, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.map-header-bar {
  background: var(--dark);
  color: white;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
}

.interactive-map {
  width: 100%;
  height: 340px;
  z-index: 10;
}

/* Stepper Bar */
.stepper-card {
  padding: 16px 24px;
}

.progress-bar-bg {
  height: 8px;
  background: var(--gray-100);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #818cf8 100%);
  transition: width 0.3s ease;
}

.stepper-steps {
  display: flex;
  justify-content: space-between;
  overflow-x: auto;
  gap: 6px;
}

.step-node {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.step-node.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* Form Styles */
.form-step-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.req {
  color: var(--danger);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.92rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 10px;
  background: white;
  color: var(--dark);
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--gray-100);
  padding: 12px;
  border-radius: 10px;
}

.perspective-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--gray-100);
  padding: 14px;
  border-radius: 12px;
}

.p-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.p-item span {
  font-size: 0.9rem;
  font-weight: 600;
}

.form-select.small {
  width: auto;
  min-width: 180px;
  padding: 8px 10px;
}

.highlight-select {
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger-outline:hover {
  background: #fef2f2;
}

.full-btn {
  width: 100%;
}

.form-nav-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.step-indicator {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
}

/* Admin Question Builder Styles */
.question-builder-card {
  border-top: 5px solid #0284c7;
}

.builder-section-box {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.builder-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--gray-300);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.builder-section-header h4 {
  font-size: 1.05rem;
  color: var(--dark);
  font-weight: 700;
}

.question-item-card {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.question-item-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.q-badge-code {
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  width: fit-content;
}

.q-title-text {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--dark);
}

.q-type-sub {
  font-size: 0.78rem;
  color: var(--gray-500);
}

.question-item-actions {
  display: flex;
  gap: 6px;
}

/* Admin Login Card */
.login-card {
  max-width: 440px;
  margin: 40px auto;
  text-align: center;
}

.login-header {
  margin-bottom: 24px;
}

.lock-icon {
  font-size: 3rem;
  display: inline-block;
  margin-bottom: 12px;
}

.login-header h2 {
  font-size: 1.3rem;
  color: var(--dark);
}

.login-header p {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.login-form {
  text-align: left;
}

.admin-header-card {
  padding: 14px 20px;
  margin-bottom: 16px;
}

.admin-user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

/* Admin Project Selector */
.project-management-card {
  border-top: 5px solid var(--primary);
}

.project-selector-box {
  background: var(--primary-light);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(79, 70, 229, 0.15);
}

.select-project-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.select-project-row select {
  flex: 1;
}

/* Admin Tab & Stats */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.stat-icon {
  font-size: 2.2rem;
  background: var(--primary-light);
  padding: 12px;
  border-radius: 14px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--gray-500);
}

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

/* File Dropzone */
.upload-dropzone {
  position: relative;
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  background: var(--primary-light);
  margin: 16px 0;
}

.upload-dropzone input[type="file"] {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
}

.cloud-icon {
  font-size: 2.4rem;
}

.upload-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-label {
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.export-btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-export-gis {
  background: #0284c7;
  color: white;
}

.btn-export-spss {
  background: #0d9488;
  color: white;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: white;
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-300);
}

.modal-header h3 {
  font-size: 1.1rem;
  color: var(--dark);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--gray-500);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.88rem;
}

.data-table th {
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 700;
}

/* Tab display toggles */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.hidden {
  display: none !important;
}

.margin-top-sm { margin-top: 10px; }
.margin-top-md { margin-top: 16px; }
.margin-top-lg { margin-top: 24px; }

.pulse {
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(79, 70, 229, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.alert-box {
  padding: 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-top: 12px;
}

.alert-success {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: white;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 2000;
}
