:root {
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --text-main: #333;
  --primary: #4caf50;
  --border: #ddd;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

body.dark {
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --text-main: #e0e0e0;
  --border: #333;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

.container {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 20px;
  width: 95%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary);
}

#themeToggle {
  background: none;
  border: 1px solid var(--border);
  padding: 5px 10px;
  width: auto;
  cursor: pointer;
  border-radius: 50%;
}

/* Layout Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
}

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

label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 5px;
  opacity: 0.8;
}

input,
select {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
}

input:focus {
  border-color: var(--primary);
}

/* Display Section */
.display-section {
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 15px;
  margin-bottom: 20px;
}

.bmi-value {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.bmi-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
}

/* Progress Bar */
.progress-container {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 10px;
  margin-top: 15px;
  overflow: hidden;
}

#bmiBar {
  height: 100%;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Buttons */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button.btn-calculator {
  width: 100%;
  padding: 15px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
}

.secondary-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-btns button {
  padding: 10px;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.8rem;
}

button:disabled {
  filter: grayscale(1);
  opacity: 0.5;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
  width: 100%;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
}

.history-section {
  margin-top: 25px;
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

.history-section h3 {
  font-size: 0.9rem;
  margin-bottom: 10px;
  opacity: 0.7;
}

#historyList {
  list-style: none;
  padding: 0;
  max-height: 150px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.history-tag {
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
  font-weight: bold;
  font-size: 0.75rem;
}

#clearHistory {
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 0.7rem;
  cursor: pointer;
  margin-top: 10px;
  padding: 0;
  width: auto;
}
