/* CSS Variables for Theme Switching */
:root {
  /* Light Theme (Default) */
  --bg-primary: #f4f4f4;
  --bg-secondary: #ffffff;
  --bg-header: #2c3e50;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-header: #ffffff;
  --accent-primary: #3498db;
  --accent-hover: #2980b9;
  --border-color: #dddddd;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
  /* Dark Theme - Your Navy & Gold */
  --bg-primary: #181c40;
  --bg-secondary: #1f2447;
  --bg-header: #141631;
  --text-primary: #ffffff;
  --text-secondary: #b9c7d9;
  --text-header: #d8bd7d;
  --accent-primary: #d8bd7d;
  --accent-hover: #c5a86a;
  --border-color: #2a3052;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
  position: absolute;
  top: 100%;
  right: 20px;
  transform: translateY(-50%);
  background: var(--accent-primary);
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--bg-primary);
  font-weight: bold;
  z-index: 1000;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--accent-hover);
  transform: translateY(-50%) scale(1.05);
}

.theme-toggle .icon {
  font-size: 1.2rem;
}

/* Header */
.site-header {
  position: relative; /* CRITICAL - enables absolute positioning for toggle */
  background: var(--bg-header);
  color: var(--text-header);
  padding: 2rem 2rem; /* Added horizontal padding for breathing room */
  margin-bottom: 2rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header h1 {
  color: var(--text-header);
  margin: 0;
}

.site-header nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.site-header nav a {
  color: var(--text-header);
  text-decoration: none;
  transition: opacity 0.3s;
}

.site-header nav a:hover {
  opacity: 0.8;
}

/* Export buttons */
.export-buttons {
  display: flex;
  gap: 8px;
  margin-right: 12px;
}

.export-btn {
  padding: 8px 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.export-btn:hover {
  background: #2563eb;
}

.export-btn:active {
  transform: scale(0.98);
}


/* Calculator Container */
.calculator-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.calc-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.calc-section h3 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Form Elements */
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: var(--text-primary);
}

input, select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.3s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* CTA Button */
.cta-button {
  background: var(--accent-primary);
  color: var(--bg-primary);
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  margin-top: 1rem;
  transition: all 0.3s ease;
}

.cta-button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

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

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

/* Dark theme specific table adjustments */
[data-theme="dark"] table th {
  background: #141631;
}

/* Footer */
.site-footer {
  background: var(--bg-header);
  color: var(--text-header);
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  transition: all 0.3s ease;
}

/* Charts - Dark theme adjustments */
[data-theme="dark"] canvas {
  filter: brightness(0.9);
}

/* Accessibility Focus States */
*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}