/* filename: app/static/css/theme.css */
:root {
  --background: #f7f8fb;
  --foreground: #0f172a;
  --muted: #475569;
  --border: #e3e8ef;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --primary: #1f3a5f;
  --primary-foreground: #eef2ff;
  --secondary: #22d3ee;
  --secondary-foreground: #0b1220;
  --accent: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

.dark {
  --background: #0b1220;
  --foreground: #e5e7eb;
  --muted: #cbd5e1;
  --border: #1f2937;
  --card: #111827;
  --card-foreground: #e5e7eb;
  --primary: #3b6ca8;
  --primary-foreground: #0b1220;
  --secondary: #10b981;
  --secondary-foreground: #0b1220;
  --accent: #fbbf24;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
  --radius: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.page-shell {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(31, 58, 95, 0.08), transparent 28%),
              radial-gradient(circle at 80% 0%, rgba(13, 148, 136, 0.08), transparent 24%),
              var(--background);
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--foreground);
}

.card-body {
  padding: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--secondary));
  color: var(--primary-foreground);
  border-color: transparent;
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.06);
  color: var(--foreground);
  border-color: var(--border);
}

.btn-success { background: var(--success); color: #0b1220; }
.btn-danger { background: var(--danger); color: #0b1220; }

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
  color: var(--foreground);
}

.form-control,
.form-select,
.form-input {
  width: 100%;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--foreground);
  padding: 0.65rem 0.85rem;
  font-size: 0.98rem;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.form-control:focus,
.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  background: #fff;
}

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

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.col-md-4 { flex: 1 1 300px; max-width: 100%; }
.col-md-6 { flex: 1 1 320px; max-width: 100%; }

.fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.7);
}

.legend {
  font-weight: 800;
  padding: 0 0.5rem;
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
  color: var(--foreground);
}

.alert-success { border-color: rgba(16, 185, 129, 0.2); background: rgba(16,185,129,0.08); color: #065f46; }
.alert-danger { border-color: rgba(239, 68, 68, 0.2); background: rgba(239,68,68,0.08); color: #991b1b; }
.alert-warning { border-color: rgba(245, 158, 11, 0.2); background: rgba(245,158,11,0.08); color: #92400e; }

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

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

.table-striped tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.03);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  z-index: 50;
  padding: 1.5rem;
}

.modal.active { display: flex; }

.modal-content {
  width: min(500px, 100%);
  background: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header,
.modal-footer {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-footer { border-top: 1px solid var(--border); border-bottom: 0; display: flex; gap: 0.5rem; justify-content: flex-end; }
.modal-title { font-size: 1.1rem; font-weight: 800; }
.modal-body { padding: 1.25rem; }

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-weight: 700;
}

.shadow-soft { box-shadow: var(--shadow); }
.bordered { border: 1px solid var(--border); border-radius: var(--radius); }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.headline {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.12));
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  cursor: pointer;
}

.loader {
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: transparent;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
