:root {
  --primary: #2a3f54;
  --secondary: #4CAF50;
  --warning: #ff9800;
  --danger: #f44336;
  --text: #333;
  --bg: #f5f6fa;
  --card-bg: white;
  --border: #ddd;
}

[data-theme="dark"] {
  --primary: #3a5576;
  --secondary: #6abf6e;
  --text: #f0f0f0;
  --bg: #1a1a2e;
  --card-bg: #242442;
  --border: #444;
}

body {
  font-family: 'Roboto Mono', monospace;
  margin: 0;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.log-header {
  background: var(--primary);
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
}

/* Switch styles */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--secondary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--secondary);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.toggle-label {
  margin-left: 10px;
  color: white;
}

.log-form {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border: 1px solid var(--border);
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

input, textarea, select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  background-color: var(--card-bg);
  color: var(--text);
}

button {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.3s;
  margin-right: 10px;
  margin-bottom: 10px;
}

button:hover {
  opacity: 0.9;
}

.incident-btn {
  background: var(--warning);
}

.critical-incident {
  background: var(--danger);
}

.preview {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: pre-wrap;
  border: 1px solid var(--border);
}

.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 15px;
}

.control-btn {
  padding: 8px 12px;
  font-size: 0.9em;
  margin: 0;
}

.citation-box {
  display: none;
  margin-top: 20px;
  padding: 15px;
  background-color: rgba(var(--secondary-rgb), 0.1);
  border-radius: 8px;
  border-left: 4px solid var(--secondary);
}

.loading {
  display: none;
  text-align: center;
  padding: 20px;
}

.loading svg {
  animation: spin 1s linear infinite;
}

.incident-section {
  display: none;
  background: #fff3e0;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid var(--warning);
}

.details-section {
  display: none;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid #ddd;
}

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

.tooltip, .tooltip .tooltiptext, .tooltip .tooltiptext::after {
  display: none;
}

.help-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1000;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 1001;
}

.modal-content {
  background-color: var(--card-bg);
  color: var(--text);
  margin: 5% auto;
  padding: 20px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 8px;
  position: relative;
}

.close-btn {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 24px;
  cursor: pointer;
}

.help-section {
  margin-bottom: 30px;
}

.help-section h2 {
  color: var(--primary);
  margin-bottom: 15px;
}

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

.generated-content {
  font-family: 'Courier New', monospace;
  line-height: 1.6;
}

.beta-tag {
  font-size: 0.5em;
  background: var(--warning);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  position: relative;
  top: -10px;
  cursor: help;
  transition: all 0.3s ease;
}

.beta-tag:hover {
  background: var(--danger);
  transform: scale(1.1);
}

.alpha-tag {
  font-size: 0.5em;
  background: var(--warning);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  position: relative;
  top: -10px;
  cursor: help;
  transition: all 0.3s ease;
}

.alpha-tag:hover {
  background: var(--danger);
  transform: scale(1.1);
}

.form-note {
  display: block;
  color: #666;
  font-size: 0.8em;
  margin-top: 3px;
  font-style: italic;
}

[data-theme="dark"] .form-note {
  color: #aaa;
}

.validation-error {
  border: 1px solid var(--danger) !important;
  box-shadow: 0 0 3px var(--danger);
}

.error-message {
  color: var(--danger);
  font-size: 0.8em;
  margin-top: 3px;
}

select#researchStatus {
  border-left: 4px solid var(--primary);
}

select#researchStatus option[value="planning"],
select#researchStatus option[value="beginning"] {
  background-color: #e3f2fd;
}

select#researchStatus option[value="in-progress"],
select#researchStatus option[value="advanced"] {
  background-color: #e8f5e9;
}

select#researchStatus option[value="completed"],
select#researchStatus option[value="under-review"] {
  background-color: #e0f2f1;
}

select#researchStatus option[value="postponed"],
select#researchStatus option[value="abandoned"] {
  background-color: #ffebee;
}

#savedFormsList {
  margin-top: 20px;
}

.saved-form-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.saved-form-item:hover {
  background-color: rgba(var(--primary-rgb), 0.1);
}

.saved-form-actions {
  display: flex;
  gap: 10px;
}

.saved-form-actions button {
  padding: 5px 10px;
  font-size: 0.8em;
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
  margin-right: 5px;
}

.badge-planning { background: #e3f2fd; color: #0d47a1; }
.badge-beginning { background: #e8f5e9; color: #1b5e20; }
.badge-in-progress { background: #fff9c4; color: #f57f17; }
.badge-advanced { background: #ffebee; color: #b71c1c; }
.badge-completed { background: #e0f7fa; color: #006064; }
.badge-postponed { background: #f3e5f5; color: #4a148c; }
.badge-abandoned { background: #efebe9; color: #3e2723; }
.badge-under-review { background: #e8eaf6; color: #1a237e; }

.badge-high { background: #ffebee; color: #b71c1c; }
.badge-medium { background: #fff9c4; color: #f57f17; }
.badge-low { background: #e8f5e9; color: #1b5e20; }