/* Theme variables */
:root {
  --bg-body: #f5f7fa;
  --bg-card: #fff;
  --bg-surface: #f8f9fa;
  --bg-input: #fff;
  --bg-hover: #f5f7fa;
  --text-primary: #333;
  --text-heading: #2c3e50;
  --text-heading-alt: #34495e;
  --text-muted: #7f8c8d;
  --border-color: #ddd;
  --border-light: #eee;
  --navbar-bg: #2c3e50;
  --navbar-link: #bdc3c7;
  --shadow-color: rgba(0,0,0,0.08);
  --progress-bg: #ecf0f1;
  --modal-overlay: rgba(0,0,0,0.5);
  --dropdown-bg: #fff;
  --dropdown-text: #2c3e50;
  --explanation-bg: #faf8f5;
  --explanation-border: #e0d6cc;
  --remediation-bg: #fdf6f0;
  --remediation-outcome-bg: #e8f6e8;
  --remediation-outcome-text: #1e7e34;
  --error-bg: #fee;
  --error-text: #c0392b;
  --success-bg: #e8f6e8;
  --success-text: #1e7e34;
  --internal-name-bg: #ecf0f1;
  --row-disabled-bg: #f5f5f5;
}

[data-theme="dark"] {
  --bg-body: #1a1d23;
  --bg-card: #242830;
  --bg-surface: #2d3139;
  --bg-input: #2d3139;
  --bg-hover: #2d3139;
  --text-primary: #e0e0e0;
  --text-heading: #e8eaed;
  --text-heading-alt: #cbd0d6;
  --text-muted: #9ca3af;
  --border-color: #374151;
  --border-light: #2d3139;
  --navbar-bg: #111318;
  --navbar-link: #9ca3af;
  --shadow-color: rgba(0,0,0,0.3);
  --progress-bg: #374151;
  --modal-overlay: rgba(0,0,0,0.7);
  --dropdown-bg: #242830;
  --dropdown-text: #e0e0e0;
  --explanation-bg: #2d3139;
  --explanation-border: #374151;
  --remediation-bg: #2d2520;
  --remediation-outcome-bg: #1a2e1a;
  --remediation-outcome-text: #6ee76e;
  --error-bg: #2e1a1a;
  --error-text: #f08080;
  --success-bg: #1a2e1a;
  --success-text: #6ee76e;
  --internal-name-bg: #374151;
  --row-disabled-bg: #2d3139;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
}

.navbar {
  background: var(--navbar-bg);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  color: #fff;
  font-size: 1.25rem;
  font-weight: bold;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
}

.nav-links a {
  color: var(--navbar-link);
  text-decoration: none;
  margin-left: 1.5rem;
}

.nav-links a:hover {
  color: #fff;
}

.container {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1 {
  margin-bottom: 1rem;
  color: var(--text-heading);
}

h2 {
  margin-bottom: 0.75rem;
  color: var(--text-heading-alt);
  font-size: 1.1rem;
}

.card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.card-warning {
  border-left: 4px solid #e74c3c;
}

.form-inline {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

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

.label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.95rem;
  background: var(--bg-input);
  color: var(--text-primary);
}

.input-sm {
  width: 80px;
}

textarea.input {
  resize: vertical;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: #3498db;
  color: #fff;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
  color: #fff;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-warning {
  background: #f39c12;
  color: #fff;
}

.btn-warning:hover {
  background: #e67e22;
}

.btn-violet {
  background: #7c3aed;
  color: #fff;
}
.btn-violet:hover {
  background: #6d28d9;
}

.list {
  list-style: none;
}

.list li {
  border-bottom: 1px solid var(--border-light);
}

.list li:last-child {
  border-bottom: none;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  text-decoration: none;
  color: var(--text-heading);
}

.list-item:hover {
  color: #3498db;
}

.list-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-item-row .list-item {
  flex: 1;
}

.war-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  align-items: center;
}

.war-actions form {
  margin: 0;
  line-height: 0;
}

.war-actions .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  line-height: 1.2;
}

.rename-form {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
}

.rename-form .form-inline {
  padding-left: 0.5rem;
}

.list-item-warning {
  padding: 0.75rem 0;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.progress-bar {
  width: 100%;
  height: 24px;
  background: var(--progress-bg);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar-sm {
  height: 12px;
  display: inline-block;
  width: 100px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.progress-fill {
  height: 100%;
  background: #27ae60;
  border-radius: 12px;
  transition: width 0.3s;
}

.progress-text {
  font-weight: 600;
  margin-bottom: 1rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: #3498db;
  color: #fff;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

.badge-secondary {
  background: #95a5a6;
}

.badge-k8s {
  background: #3498db;
  color: #fff;
}

.badge-war {
  background: #27ae60;
  color: #fff;
}

.badge-info {
  background: #8e44ad;
}

.question-header {
  margin-bottom: 1rem;
}

.question-form .card {
  margin-bottom: 1rem;
}

.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-label {
  cursor: pointer;
}

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

.radio-btn {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  font-weight: 600;
}

.radio-label input:checked + .radio-yes {
  background: #27ae60;
  border-color: #27ae60;
  color: #fff;
}

.radio-label input:checked + .radio-partial {
  background: #f39c12;
  border-color: #f39c12;
  color: #fff;
}

.radio-label input:checked + .radio-no {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.question-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
}

.domain-group {
  margin-bottom: 1rem;
}

.domain-group h4 {
  margin-bottom: 0.5rem;
  color: var(--text-heading);
}

.jump-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.jump-list a {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.jump-list a.active {
  background: #3498db;
  color: #fff;
  border-color: #3498db;
}

.jump-list a.answered-yes {
  border-color: #27ae60;
  color: #27ae60;
}

.jump-list a.answered-partial {
  border-color: #f39c12;
  color: #f39c12;
}

.jump-list a.answered-no {
  border-color: #e74c3c;
  color: #e74c3c;
}

.page-header {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin-bottom: 0;
  line-height: 1.2;
}

.page-header .btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-bottom: 0.15rem;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

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

.sortable:hover {
  color: #3498db;
}

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

.text-warning {
  color: #e67e22;
  font-weight: bold;
}

.resp-yes {
  color: #27ae60;
  font-weight: bold;
}

.resp-partial {
  color: #f1c40f;
  font-weight: bold;
}

.resp-no {
  color: #e74c3c;
  font-weight: bold;
}

.ap-controls {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.btn-outline {
  border: 1px solid #e74c3c;
  color: #e74c3c;
  background: transparent;
  text-decoration: none;
}

.btn-outline:hover {
  background: #e74c3c;
  color: #fff;
}

.ap-ctrl {
  text-decoration: none;
}

.ap-ctrl-unanswered {
  border: 1px solid #95a5a6;
  color: #95a5a6;
  background: transparent;
}

.ap-ctrl-unanswered:hover {
  background: #95a5a6;
  color: #fff;
}

.ap-ctrl-no {
  border: 1px solid #e74c3c;
  color: #e74c3c;
  background: transparent;
}

.ap-ctrl-no:hover {
  background: #e74c3c;
  color: #fff;
}

.ap-ctrl-partial {
  border: 1px solid #f39c12;
  color: #f39c12;
  background: transparent;
}

.ap-ctrl-partial:hover {
  background: #f39c12;
  color: #fff;
}

.ap-ctrl-yes {
  border: 1px solid #27ae60;
  color: #27ae60;
  background: transparent;
}

.ap-ctrl-yes:hover {
  background: #27ae60;
  color: #fff;
}

.ap-remediation {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--remediation-bg);
  border-left: 3px solid #f39c12;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* Explanation Panel Styles */
.explanation-panel {
  margin-top: 0.75rem;
  border: 1px solid var(--explanation-border);
  border-radius: 4px;
  background: var(--explanation-bg);
}

.explanation-panel summary {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  color: var(--text-heading);
  user-select: none;
}

.explanation-panel summary:hover {
  color: #3498db;
}

.explanation-panel[open] summary {
  border-bottom: 1px solid var(--explanation-border);
  margin-bottom: 0;
}

.explanation-content {
  padding: 0.75rem;
  color: var(--text-heading-alt);
  line-height: 1.6;
  font-size: 0.92rem;
}

/* Remediation Playbook Styles */
.playbook-details {
  margin-top: 0.75rem;
}

.playbook-details summary {
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.playbook-details[open] summary {
  margin-bottom: 0.75rem;
}

.playbook-steps {
  margin: 0;
  padding-left: 1.25rem;
  list-style: decimal;
}

.playbook-step {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--explanation-border);
}

.playbook-step:last-child {
  border-bottom: none;
}

.playbook-step p {
  margin-bottom: 0.25rem;
}

.playbook-step p:first-child {
  font-weight: 500;
  color: var(--text-heading);
}

.text-sm {
  font-size: 0.8rem;
}

.remediation-outcome {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--remediation-outcome-bg);
  border-left: 3px solid #27ae60;
  border-radius: 3px;
  color: var(--remediation-outcome-text);
  font-size: 0.85rem;
}

.badge-remediation {
  background: #e67e22;
  color: #fff;
  font-weight: 600;
}

.internal-name {
  background: var(--internal-name-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.total-score {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-surface);
  border-radius: 6px;
}

.total-score-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.total-score-label {
  font-weight: 600;
  color: var(--text-heading);
}

.total-score-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #3498db;
}

.total-score-percent {
  font-size: 1rem;
  color: var(--text-muted);
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #3498db;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-container-lg {
  height: 400px;
}

/* Login page styles */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
}

.login-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card h1 {
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.login-card h2 {
  color: var(--text-muted);
  font-weight: normal;
  margin-bottom: 1.5rem;
}

.error-message {
  background: var(--error-bg);
  border: 1px solid #e74c3c;
  color: var(--error-text);
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.success-message {
  background: var(--success-bg);
  border: 1px solid #27ae60;
  color: var(--success-text);
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.row-disabled {
  opacity: 0.6;
  background: var(--row-disabled-bg);
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
}

.nav-user {
  color: var(--navbar-link);
  margin-left: 1.5rem;
}

/* Navbar dropdown menu */
.nav-dropdown {
  position: relative;
  margin-left: 1.5rem;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: var(--navbar-link);
  font-size: inherit;
  cursor: pointer;
  padding: 0.25rem 0;
  font-family: inherit;
}

.nav-dropdown-toggle:hover {
  color: #fff;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: var(--dropdown-bg);
  border-radius: 4px;
  box-shadow: 0 4px 12px var(--shadow-color);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a,
.nav-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  text-align: left;
  color: var(--dropdown-text);
  text-decoration: none;
  border: none;
  background: none;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  margin: 0;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu button:hover {
  background: var(--bg-hover);
  color: #3498db;
}

.nav-dropdown-menu form {
  margin: 0;
}

/* Applicability & Auto-answer styles */

.badge-na {
  background: #7f8c8d;
  color: #fff;
}

.badge-auto {
  background: #2980b9;
  color: #fff;
  cursor: help;
}

.card-na {
  border-left: 4px solid #7f8c8d;
  background: var(--row-disabled-bg);
}

.card-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.na-banner {
  padding: 0.5rem 0;
}

.na-banner h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text-muted);
}

.card-na-action {
  margin-top: 1rem;
  border: 1px dashed var(--border-color);
}

.card-na-action summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
}

.na-form {
  margin-top: 0.75rem;
}

.na-cascade-warning {
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

/* Toast notification */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: opacity 0.3s ease;
  max-width: 400px;
}

.toast-info {
  background: #2c3e50;
  color: #fff;
}

/* Jump modal: N/A and auto-answered controls */
.control-na {
  opacity: 0.5;
  text-decoration: line-through;
}

.answered-auto {
  font-style: italic;
}

/* Completion breakdown bar */
.completion-breakdown {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.completion-breakdown .cb-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.completion-breakdown .cb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.cb-dot-answered { background: #27ae60; }
.cb-dot-auto { background: #2980b9; }
.cb-dot-na { background: #7f8c8d; }
.cb-dot-remaining { background: #ecf0f1; border: 1px solid #bdc3c7; }
