/* SWAT UI Design System */

/* CSS Variables for Light/Dark Mode */
:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --muted-color: #666666;
  --border-color: #dddddd;
  --card-bg: #f9f9f9;
  --btn-bg: #007bff;
  --btn-text: #ffffff;
  --input-bg: #ffffff;
  --input-border: #cccccc;
  --code-bg: #f4f4f4;
  --stdout-color: #000000;
  --stderr-color: #cc0000;
  --danger-bg: #dc3545;
  --danger-text: #ffffff;
  --warn-bg: #ffc107;
  --warn-text: #000000;
  --info-bg: #17a2b8;
  --info-text: #ffffff;
  --success-bg: #28a745;
  --success-text: #ffffff;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --muted-color: #aaaaaa;
  --border-color: #444444;
  --card-bg: #2a2a2a;
  --btn-bg: #0056b3;
  --btn-text: #ffffff;
  --input-bg: #333333;
  --input-border: #555555;
  --code-bg: #2a2a2a;
  --stdout-color: #e0e0e0;
  --stderr-color: #ff6666;
  --danger-bg: #e74c3c;
  --danger-text: #ffffff;
  --warn-bg: #f39c12;
  --warn-text: #ffffff;
  --info-bg: #3498db;
  --info-text: #ffffff;
  --success-bg: #27ae60;
  --success-text: #ffffff;
}

/* Helpers */
.theme-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
}

.theme-toggle:hover {
  opacity: 0.8;
}

/* Base Styles */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: -10px;
}

.col {
  flex: 1;
  padding: 10px;
}

/* Components */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  min-width: 120px;
  min-height: 40px;
  box-sizing: border-box;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10), 0 1px 0 rgba(255,255,255,0.25) inset;
  transition: box-shadow 0.2s, transform 0.2s;
}
.btn:active {
  box-shadow: 0 1px 1px rgba(0,0,0,0.15) inset;
  transform: translateY(1px);
}

.btn:hover {
  opacity: 0.9;
}

.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.info {
  background: var(--info-bg);
  color: var(--info-text);
}

.success {
  background: var(--success-bg);
  color: var(--success-text);
}

/* Form Grouping */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  padding: 32px;
}

.input {
  background: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  padding: 8px;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}

/* Custom Checkbox and Radio Styles */
input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--btn-bg);
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 4px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  box-sizing: border-box;
}

input[type="checkbox"] {
  border-radius: 4px;
}

input[type="radio"] {
  border-radius: 50%;
}

.input:focus {
  outline: none;
  border-color: var(--btn-bg);
}

.code {
  background: var(--code-bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.muted {
  color: var(--muted-color);
}

/* Utility Classes */

/* Spacing */
.m-0 { margin: 0; }
.m-1 { margin: 4px; }
.m-2 { margin: 8px; }
.m-3 { margin: 16px; }
.m-4 { margin: 24px; }
.m-5 { margin: 48px; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.p-5 { padding: 48px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 48px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 48px; }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }

/* Flexbox */
.justify-content-start { justify-content: flex-start; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }

.align-items-start { align-items: flex-start; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }

.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

/* Text */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-uppercase { text-transform: uppercase; }
.text-lowercase { text-transform: lowercase; }
.text-capitalize { text-transform: capitalize; }

.font-weight-light { font-weight: 300; }
.font-weight-normal { font-weight: 400; }
.font-weight-bold { font-weight: 700; }

/* Width/Height */
.w-25 { width: 25%; }
.w-50 { width: 50%; }
.w-75 { width: 75%; }
.w-100 { width: 100%; }

.h-25 { height: 25%; }
.h-50 { height: 50%; }
.h-75 { height: 75%; }
.h-100 { height: 100%; }

/* Borders */
.border { border: 1px solid var(--border-color); }
.border-0 { border: 0; }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.border-left { border-left: 1px solid var(--border-color); }
.border-right { border-right: 1px solid var(--border-color); }

.border-radius-0 { border-radius: 0; }
.border-radius-sm { border-radius: 2px; }
.border-radius { border-radius: 4px; }
.border-radius-lg { border-radius: 8px; }

/* Position */
.position-static { position: static; }
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }

/* Visibility */
.invisible { visibility: hidden; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: bold;
  background: var(--card-bg);
}

/* Terminal Specific */
.stdout {
  color: var(--stdout-color);
}

.stderr {
  color: var(--stderr-color);
}

.prompt {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

#term {
  height: 60vh;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

#cmd {
  width: 100%;
  padding: 8px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-color);
  border-radius: 4px;
}

/* Headings */
h1 { font-size: 2em; font-weight: bold; margin-bottom: 0.5em; }
h2 { font-size: 1.5em; font-weight: bold; margin-bottom: 0.5em; }
h3 { font-size: 1.25em; font-weight: bold; margin-bottom: 0.5em; }
h4 { font-size: 1.125em; font-weight: bold; margin-bottom: 0.5em; }
h5 { font-size: 1.000em; font-weight: bold; margin-bottom: 0.5em; }
h6 { font-size: .875em; font-weight: bold; margin-bottom: 0.5em; }