:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --success-color: #27ae60;
  --error-color: #e74c3c;
  --bg-color: #f4f7f6;
  --card-bg: #ffffff;
  --text-color: #333;
  --border-radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  margin: 0;
  padding: 20px;
}

.container {
  max-width: 800px; /* Reduced for better focus */
  margin: 0 auto;
}

h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 30px;
}

/* Ensure all sections have the same width */
section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  box-sizing: border-box;
}

h2 {
  margin-top: 0;
  font-size: 1.25rem;
  border-bottom: 2px solid var(--bg-color);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

/* Calculator Ratios Styling */
.calculator-section {
  border-left: 5px solid var(--secondary-color);
}

.ratios-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.ratios-header h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.inline-form {
  flex-grow: 1;
  display: flex;
  justify-content: flex-end;
}

.inline-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.inline-group input {
  width: 100px;
}

.top-results {
  background-color: #e8f4fd;
  border-radius: 4px;
  padding: 15px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  text-align: center;
}

/* Forms Container - Stacked by default for uniform width */
.forms-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.full-width {
  grid-column: span 2;
}

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

input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1rem;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 4px;
  background-color: var(--secondary-color);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 10px;
}

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

.actual-preview {
  margin: 15px 0;
  padding: 10px;
  background-color: #fcf3cf;
  border-radius: 4px;
  text-align: center;
  font-weight: bold;
  border: 1px solid #f9e79f;
}

.result-value {
  font-weight: bold;
  color: var(--secondary-color);
}

.history-item {
  padding: 15px;
  border-bottom: 1px solid #eee;
}

.history-item:last-child {
  border-bottom: none;
}

.history-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.history-header {
  font-size: 0.9rem;
  color: #666;
}

.history-actual {
  margin-top: 5px;
  padding: 5px 10px;
  background-color: #f9f9f9;
  border-left: 3px solid var(--success-color);
  font-size: 0.95rem;
}

.error-display {
  background-color: #fdeaea;
  color: var(--error-color);
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
  text-align: center;
}
