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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #1f2937;
  --dark-light: #374151;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --white: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 50%, #fce7f3 100%);
  background-attachment: fixed;
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.navbar-inner {
  width: 100%;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.45rem 0.75rem;
  border-radius: 9999px;
  color: var(--dark);
  font-weight: 700;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.6);
}

.navbar h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links span {
  font-size: 0.9rem;
  color: var(--gray);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--white);
  color: var(--dark);
  border: 2px solid var(--gray-light);
}

.btn-secondary:hover {
  background: var(--gray-light);
  border-color: var(--gray);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Content Area */
.content {
  margin: 3rem auto;
  flex: 1;
  animation: fadeIn 0.6s ease-out;
}

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

/* Hero Section */
.hero {
  background: var(--white);
  padding: 4rem 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--dark);
  font-weight: 800;
  letter-spacing: -1px;
}

.hero p {
  font-size: 1.2rem;
  color: var(--gray);
  margin: 0 auto 2.5rem;
  max-width: 600px;
}

/* Form Section */
.form-section {
  background: var(--white);
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  margin: 0 auto;
}

.form-section h2 {
  color: var(--dark);
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  position: relative;
  padding-bottom: 1rem;
}

.form-section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

.form-group {
  margin-bottom: 1.75rem;
}

/* Wizard */
.wizard-top {
  margin-bottom: 1.5rem;
}

.wizard-progress {
  width: 100%;
  height: 10px;
  background: var(--gray-light);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.wizard-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: var(--transition);
}

.wizard-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  color: var(--gray);
  font-weight: 600;
}

.wizard-title {
  margin: 1.25rem 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
}

.wizard-step-panel {
  display: none;
}

.wizard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.wizard-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: var(--dark);
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.wizard-nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.wizard-nav-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  border-color: rgba(0, 0, 0, 0);
}

.wizard-nav-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Response step grouping */
.response-step {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.response-step-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.625rem;
  font-weight: 600;
  color: var(--dark);
  font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1.125rem;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: #d1d5db;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.form-group input[readonly] {
  background: #f9fafb;
  cursor: not-allowed;
  color: var(--gray);
}

.form-group input[type="checkbox"] {
  margin-right: 0.625rem;
  cursor: pointer;
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--primary);
}

.form-group label input[type="checkbox"] {
  display: inline;
  margin: 0;
  margin-right: 0.625rem;
  width: 1.125rem;
  height: 1.125rem;
}

.status-message {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.status-message.success {
  background-color: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--secondary);
}

.status-message.success::before {
  content: "✓";
  font-size: 1.25rem;
}

.status-message.error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--danger);
}

.status-message.error::before {
  content: "✕";
  font-size: 1.25rem;
}

/* Admin Section */
.admin-section {
  background: var(--white);
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.admin-section h2 {
  color: var(--dark);
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.responses-list {
  display: grid;
  gap: 1.5rem;
}

.response-card {
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  background: var(--white);
}

.response-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

.response-header {
  background: linear-gradient(135deg, var(--gray-light), #e5e7eb);
  padding: 1.5rem;
  border-bottom: 2px solid var(--gray-light);
}

.no-data a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
}

.no-data a:hover {
  text-decoration: underline;
}

.response-header h3 {
  color: var(--dark);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.status {
  padding: 0.4rem 0.875rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status.submitted {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
}

.status.draft {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
}

.response-content {
  padding: 1.5rem;
}

.response-field {
  margin-bottom: 1.2rem;
}

.response-field:last-child {
  margin-bottom: 0;
}

.response-field strong {
  display: block;
  color: var(--dark);
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.response-field p {
  color: var(--gray);
  word-break: break-word;
}

/* Footer */
footer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: var(--gray);
  text-align: center;
  padding: 2rem 0;
  margin-top: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: 1rem;
  }

  .navbar h1 {
    font-size: 1.5rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .hero {
    padding: 2.5rem 1.5rem;
  }

  .hero h2 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .form-section,
  .admin-section {
    padding: 2rem 1.5rem;
  }

  .response-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
  }

  .content {
    margin: 1.5rem auto;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero h2 {
    font-size: 1.75rem;
  }

  .form-section,
  .admin-section {
    padding: 1.5rem 1rem;
  }

  .btn {
    width: 100%;
  }

  .nav-links {
    flex-direction: column;
    width: 100%;
  }
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 2px solid #e5e7eb;
}

.form-actions button[type="submit"] {
  flex: 1;
  min-width: 200px;
}

.autosave-status {
  display: block;
  margin-top: 1.5rem;
  color: var(--gray);
  font-style: normal;
  text-align: center;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #d1d5db;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Admin Badge */
.admin-badge {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: var(--dark);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.14);
}

.badge-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--gray-light);
  overflow-x: auto;
}

.admin-tab {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gray);
  transition: var(--transition);
  white-space: nowrap;
}

.admin-tab.active,
.admin-tab:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table thead tr {
  background: linear-gradient(135deg, var(--gray-light), #e5e7eb);
}

table th {
  padding: 1rem;
  text-align: left;
  font-weight: 700;
  color: var(--dark);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table tbody tr {
  border-bottom: 1px solid var(--gray-light);
  transition: var(--transition);
}

table tbody tr:hover {
  background: rgba(99, 102, 241, 0.03);
}

table td {
  padding: 1rem;
  color: var(--dark);
}

table tbody tr:last-child {
  border-bottom: none;
}

/* Admin: user link + modal */
.user-link {
  color: var(--dark);
  text-decoration: none;
}

.user-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid var(--gray-light);
  background: linear-gradient(135deg, var(--gray-light), #e5e7eb);
}

.modal-title {
  margin: 0;
  color: var(--dark);
  font-size: 1.1rem;
  font-weight: 800;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow: auto;
  max-height: calc(100vh - 160px);
}

.modal-loading {
  color: var(--gray);
  font-weight: 600;
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.loading-spinner {
  border: 4px solid var(--gray-light);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
