/* Global Reset & Base Styling */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-600: #475569;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --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);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--neutral-50);
  color: var(--neutral-800);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 2rem;
}

/* Container */
.app-header {
  background: white;
  border-bottom: 1px solid var(--neutral-200);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--neutral-900);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-amber { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-purple { background: #f3e8ff; color: #7e22ce; }

.main-container {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* Card */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--neutral-200);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neutral-900);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* PIN Screen */
.pin-wrapper {
  max-width: 400px;
  margin: 4rem auto;
  text-align: center;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.pin-digit {
  width: 50px;
  height: 60px;
  border: 2px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}

.pin-digit.filled {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 300px;
  margin: 0 auto;
}

.key-btn {
  background: white;
  border: 1px solid var(--neutral-200);
  border-radius: 12px;
  padding: 1rem;
  font-size: 1.35rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
}

.key-btn:active {
  background: var(--neutral-100);
  transform: scale(0.96);
}

/* Forms & Rating Buttons */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--neutral-900);
}

.form-desc {
  font-size: 0.85rem;
  color: var(--neutral-600);
  margin-bottom: 0.75rem;
}

.score-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.score-btn {
  flex: 1;
  min-width: 60px;
  padding: 0.6rem 0.4rem;
  border: 1.5px solid var(--neutral-300);
  border-radius: 8px;
  background: white;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.score-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

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

.score-btn.selected-na {
  background: var(--neutral-600);
  color: white;
  border-color: var(--neutral-600);
}

textarea, input[type="text"], select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

textarea:focus, input[type="text"]:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-secondary { background: var(--neutral-200); color: var(--neutral-800); }
.btn-secondary:hover { background: var(--neutral-300); }
.btn-outline { background: transparent; border: 1px solid var(--neutral-300); color: var(--neutral-800); }
.btn-outline:hover { background: var(--neutral-100); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* Status Cards & Progress */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.status-item {
  padding: 1rem;
  border-radius: 8px;
  background: var(--neutral-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-role {
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

/* Score comparison table */
.comp-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.comp-table th, .comp-table td {
  padding: 0.75rem;
  border: 1px solid var(--neutral-200);
  text-align: left;
  vertical-align: top;
}

.comp-table th {
  background: var(--neutral-100);
  font-weight: 600;
}

/* Utilities */
.text-muted { color: var(--neutral-600); }
.text-sm { font-size: 0.85rem; }
.text-lg { font-size: 1.15rem; font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Responsive adjustments */
@media (max-width: 640px) {
  .app-header { padding: 0.75rem 1rem; }
  .card { padding: 1rem; }
  .score-btn { min-width: 45px; padding: 0.5rem 0.2rem; font-size: 0.8rem; }
}
