/* ─── Variables ─────────────────────────────────────── */
:root {
  --navy:       #0d2b5e;
  --navy-dark:  #091d42;
  --navy-light: #1a3f7a;
  --blue:       #1d6fa4;
  --blue-light: #e8f1f9;
  --accent:     #c8922a;
  --sidebar-w:  260px;
  --text:       #1a1a2e;
  --muted:      #6c757d;
  --border:     #dee2e6;
  --bg:         #f4f6fa;
}

/* ─── Base ──────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

/* ─── Layout ─────────────────────────────────────────── */
#wrapper {
  min-height: 100vh;
}

#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

#content-wrapper {
  min-height: 100vh;
  background: var(--bg);
}

.content-body {
  padding: 2rem;
}

/* ─── Topbar / Notifications ────────────────────────────── */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.75rem 2rem 0;
}

.notification-bell {
  position: relative;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--navy);
  cursor: pointer;
  padding: 0.4rem;
  line-height: 1;
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}

.notification-dropdown {
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  padding: 0;
}

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}

.notification-empty {
  padding: 1.25rem 1rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.notification-item-form {
  margin: 0;
}

.notification-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  cursor: pointer;
}

.notification-item:hover {
  background: var(--blue-light);
}

.notification-item.unread {
  background: rgba(200, 146, 42, 0.08);
}

.notification-message {
  font-size: 0.875rem;
  color: var(--text);
}

.notification-time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-name {
  color: white;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}

.brand-sub {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav .nav-link {
  color: rgba(255,255,255,0.75);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
  color: white;
  background: rgba(255,255,255,0.08);
}

.sidebar-nav .nav-link.active {
  color: white;
  background: rgba(255,255,255,0.12);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-nav .nav-link i {
  font-size: 16px;
  width: 20px;
  flex-shrink: 0;
}

.nav-section {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 20px 4px;
  list-style: none;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-name {
  color: white;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: rgba(255,255,255,0.45);
  font-size: 11px;
}

.logout-btn {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 18px;
  transition: color 0.15s;
}

.logout-btn:hover {
  color: white;
}

/* ─── Page Header ────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 2px 0 0;
}

/* ─── Cards ──────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-hover {
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}
.card-hover:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--navy-light);
}

.card-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  border-radius: 10px 10px 0 0 !important;
}

/* Stat Cards */
.stat-card {
  background: white;
  border-radius: 10px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 0.75rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: #15803d; }
.stat-icon.amber  { background: #fef3c7; color: #b45309; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

/* ─── Status Badges ──────────────────────────────────── */
.badge-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.status-not_started   { background: #f1f3f5; color: #495057; }
.status-in_progress   { background: #dbeafe; color: #1d4ed8; }
.status-submitted     { background: #fef3c7; color: #b45309; }
.status-manager_review{ background: #fed7aa; color: #9a3412; }
.status-completed     { background: #dcfce7; color: #15803d; }
.status-needs_ack     { background: #fee2e2; color: #b91c1c; }

/* ─── Score Badges ───────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
}

.score-4 { background: #dcfce7; color: #15803d; }
.score-3 { background: #dbeafe; color: #1d4ed8; }
.score-2 { background: #fef3c7; color: #b45309; }
.score-1 { background: #fee2e2; color: #dc2626; }

/* Total score ranges */
.total-exceptional { color: #15803d; font-weight: 700; }
.total-meets       { color: #1d4ed8; font-weight: 700; }
.total-improvement { color: #b45309; font-weight: 700; }
.total-unsat       { color: #dc2626; font-weight: 700; }

/* ─── Forms ──────────────────────────────────────────── */
.form-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--blue-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title .section-num {
  width: 26px;
  height: 26px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.question-text {
  font-size: 0.875rem;
  color: #374151;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

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

/* ─── Review Info Header ─────────────────────────────── */
.review-header {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.review-header-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.review-header-field span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

/* ─── Scoring Table ──────────────────────────────────── */
.score-table {
  width: 100%;
  border-collapse: collapse;
}

.score-table th {
  background: var(--navy);
  color: white;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
}

.score-table th:last-child {
  text-align: center;
  width: 100px;
}

.score-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.875rem;
}

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

.score-table tbody tr:nth-child(odd) {
  background: #fafbfc;
}

.score-table .category-name {
  font-weight: 600;
  color: var(--navy);
}

.score-table .score-cell {
  text-align: center;
}

.score-radio-group {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.score-radio {
  display: none;
}

.score-radio + label {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--muted);
}

.score-radio:checked + label,
.score-radio + label:hover {
  border-color: transparent;
}

.score-radio[value="4"]:checked + label { background: #dcfce7; color: #15803d; border-color: #86efac; }
.score-radio[value="3"]:checked + label { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.score-radio[value="2"]:checked + label { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.score-radio[value="1"]:checked + label { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.score-radio[value="4"] + label:hover { background: #dcfce7; color: #15803d; }
.score-radio[value="3"] + label:hover { background: #dbeafe; color: #1d4ed8; }
.score-radio[value="2"] + label:hover { background: #fef3c7; color: #b45309; }
.score-radio[value="1"] + label:hover { background: #fee2e2; color: #dc2626; }

/* ─── Tables ─────────────────────────────────────────── */
.table-card {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.table {
  margin: 0;
}

.table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}

.table td {
  padding: 12px 14px;
  vertical-align: middle;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f3f5;
}

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

.table tbody tr:hover {
  background: #fafbfc;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
}

.sortable-th:hover {
  color: var(--text);
}

.sort-icon {
  font-size: 0.7rem;
}

/* ─── Buttons ────────────────────────────────────────── */
.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
}

.btn-primary:hover {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
}

.btn-outline-primary {
  color: var(--navy);
  border-color: var(--navy);
}

.btn-outline-primary:hover {
  background: var(--navy);
  border-color: var(--navy);
}

/* ─── Login ──────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--blue) 100%);
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 auto 1.25rem;
}

.login-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.login-sub {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

/* ─── Progress Steps ─────────────────────────────────── */
.review-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.5rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  overflow-x: auto;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.progress-step .step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--muted);
  background: white;
}

.progress-step.done .step-dot {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.progress-step.active .step-dot {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.progress-step .step-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.progress-step.active .step-label {
  color: var(--navy);
  font-weight: 600;
}

.progress-connector {
  flex: 1;
  min-width: 30px;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
}

.progress-connector.done {
  background: #86efac;
}

/* ─── Rating Selector ─────────────────────────────────── */
.rating-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.rating-option input[type="radio"] {
  display: none;
}

.rating-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.rating-label {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

.rating-range {
  font-size: 0.7rem;
  color: var(--muted);
}

.rating-option input[value="exceeds"]:checked + label      { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.rating-option input[value="meets"]:checked + label        { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.rating-option input[value="needs_improvement"]:checked + label { border-color: #fcd34d; background: #fffbeb; color: #b45309; }
.rating-option input[value="underperforming"]:checked + label   { border-color: #fca5a5; background: #fff1f2; color: #dc2626; }

.rating-option label.score-suggested { outline: 2px dashed currentColor; outline-offset: 2px; }
.rating-option label.score-suggested .rating-range::after { content: ' · suggested'; font-weight: 700; }

.rating-option label:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

/* ─── Misc ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state i {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.cycle-badge-annual     { background: #ede9fe; color: #7c3aed; }
.cycle-badge-semi       { background: #e0f2fe; color: #0369a1; }

.cycle-status-draft     { background: #f1f3f5; color: #6c757d; }
.cycle-status-active    { background: #dcfce7; color: #15803d; }
.cycle-status-closed    { background: #fee2e2; color: #9a3412; }

.scoring-rubric {
  background: var(--blue-light);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.scoring-rubric h6 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.rubric-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* ─── Extra button variants ─────────────────────────── */
.btn-outline-purple {
  color: #7c3aed;
  border-color: #7c3aed;
  background: transparent;
}
.btn-outline-purple:hover {
  background: #7c3aed;
  color: white;
}

/* ─── Impersonation Banner ───────────────────────────── */
.impersonation-bar {
  background: #7c3aed;
  color: white;
  padding: 8px 1.5rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  margin: -2rem -2rem 1.5rem;
}

.impersonation-bar .btn-light {
  font-size: 0.8rem;
  padding: 3px 10px;
  color: #7c3aed;
  font-weight: 600;
}

@media (max-width: 768px) {
  #sidebar { display: none; }
  .content-body { padding: 1rem; }
  .topbar { padding: 0.75rem 1rem 0; }
}

/* ─── Inline auto-save feedback ──────────────────────── */
.question-edit-form .form-control,
.question-edit-form .form-select {
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.question-edit-form.question-saved .form-control,
.question-edit-form.question-saved .form-select {
  border-color: #28a745;
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.question-edit-form.question-save-error .form-control,
.question-edit-form.question-save-error .form-select {
  border-color: #dc3545;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

/* ─── Public survey — section nav ───────────────────── */
.survey-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 0.825rem;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
}

.survey-nav-item:hover {
  background: var(--blue-light);
}

.survey-nav-item.active {
  color: var(--navy);
  font-weight: 600;
}

.survey-nav-item.done {
  color: var(--text);
}

.survey-nav-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background: #e9ecef;
  color: var(--muted);
  flex-shrink: 0;
}

.survey-nav-item.active .survey-nav-num {
  background: var(--navy);
  color: #fff;
}

.survey-nav-item.done .survey-nav-num {
  background: #28a745;
  color: #fff;
}

@media print {
  #sidebar, .topbar, .impersonation-bar, .no-print, .alert, .btn-close {
    display: none !important;
  }
  #content-wrapper { margin: 0 !important; }
  .content-body { padding: 0 !important; }
  body { background: #fff; }
  .card, .form-section, .review-header {
    break-inside: avoid;
  }
}
