@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-gradient: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  --surface-color: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --border-color: #d1d5db;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #6366f1;
    --primary-hover: #818cf8;
    --bg-gradient: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    --surface-color: rgba(31, 41, 55, 0.85);
    --surface-solid: #1f2937;
    --text-main: #f9fafb;
    --text-muted: #d1d5db;
    --border-color: #374151;
  }
}

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

body {
  font-family: 'Kanit', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.dashboard-container {
  max-width: 1200px;
}

.card {
  background: var(--surface-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

h1, h2, h3 {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-main);
}

h1 {
  font-size: 1.75rem;
  line-height: 1.3;
}

h2 {
  font-size: 1.25rem;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
  display: inline-block;
  margin-bottom: 1.5rem;
}

.instruction {
  background: var(--surface-solid);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary-color);
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

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

.form-group label.question {
  display: block;
  font-weight: 500;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.radio-option, .checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  transition: all 0.2s;
}

.radio-option:hover, .checkbox-option:hover {
  border-color: var(--primary-color);
  background: rgba(79, 70, 229, 0.05);
}

input[type="radio"], input[type="checkbox"] {
  margin-top: 0.25rem;
  accent-color: var(--primary-color);
  width: 1.1rem;
  height: 1.1rem;
}

input[type="text"], input[type="email"], input[type="tel"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.other-input-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.other-input-container input[type="text"] {
  flex: 1;
  min-width: 150px;
}

.btn-submit {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}

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

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

/* Dashboard Specific Styles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface-solid);
  padding: 1.5rem;
  border-radius: var(--radius);
  border-left: 5px solid var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.stat-card h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

.chart-container {
  position: relative;
  height: 350px;
  width: 100%;
  margin-top: 1rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.nav-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

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

.footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Filter and Table Styles */
.filter-form {
  background: var(--surface-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.filter-form:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

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

.filter-group label {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.filter-group select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.filter-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-filter, .btn-reset, .btn-export {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-filter {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-filter:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-reset {
  background: #f3f4f6;
  color: #4b5563;
  text-decoration: none;
  border: 1px solid #d1d5db;
}

.btn-reset:hover {
  background: #e5e7eb;
}

.btn-export {
  background: #10b981;
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-export:hover {
  background: #059669;
  transform: translateY(-1px);
}

.data-table-container {
  overflow-x: auto;
  margin-top: 1rem;
  background: var(--surface-solid);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th, .data-table td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: rgba(79, 70, 229, 0.05);
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.01);
}

.data-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.03);
}