/* journey_coster.css */

/* Define color variables for light mode (default) */
:root {
  --bg-color: #f8f9fa;
  --container-bg-color: #ffffff;
  --text-color: #212529;
  --heading-color: #0056b3;
  --border-color: #dee2e6;
  --input-border-color: #ced4da;
  --input-bg-color: #ffffff;
  --button-bg-color: #007bff;
  --button-hover-bg-color: #0056b3;
  --results-bg-color: #e9ecef;
  --results-border-color: #ced4da;
  --results-text-color: #0056b3; /* Color for the result values */
  --shadow-color: rgba(0, 0, 0, 0.1);
  --toggle-hover-bg: rgba(0, 0, 0, 0.1); /* Hover bg for toggle */
  --label-color: #495057;
}

/* Define color variables for dark mode using data-theme attribute */
html[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --container-bg-color: #2c2c2c;
  --text-color: #e0e0e0;
  --heading-color: #64b5f6; /* Lighter blue for dark mode */
  --border-color: #444;
  --input-border-color: #555;
  --input-bg-color: #3a3a3a;
  --button-bg-color: #1976d2; /* Slightly different blue */
  --button-hover-bg-color: #1565c0;
  --results-bg-color: #3a3a3a;
  --results-border-color: #555;
  --results-text-color: #64b5f6; /* Lighter blue for dark results */
  --shadow-color: rgba(255, 255, 255, 0.1);
  --toggle-hover-bg: rgba(255, 255, 255, 0.15); /* Dark mode hover bg for toggle */
  --label-color: #adb5bd;
}

/* Apply base styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.6;
}

.container {
  max-width: 600px; /* Adjusted max-width */
  margin: 30px auto;
  padding: 25px 30px;
  background-color: var(--container-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow-color);
  position: relative; /* Needed for absolute positioning of toggle */
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Theme Toggle Button Styles (Using Emoji) */
.theme-toggle-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px; /* Adjust padding */
  border-radius: 50%;
  font-size: 1.6rem; /* Adjust emoji size */
  line-height: 1; /* Helps vertical alignment */
  color: var(--text-color);
  transition: background-color 0.2s, color 0.3s ease;
  z-index: 10;
  width: 40px; /* Fixed width */
  height: 40px; /* Fixed height */
  display: flex; /* Use flexbox for centering */
  align-items: center; /* Center vertically */
  justify-content: center; /* Center horizontally */
}

.theme-toggle-button:hover {
  background-color: var(--toggle-hover-bg);
}

h1 {
  text-align: center;
  color: var(--heading-color);
  margin-bottom: 30px;
  margin-top: 20px; /* Adjust if toggle button overlaps */
  font-size: 1.8em;
  font-weight: 600;
}

label {
  display: block;
  margin-top: 18px;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--label-color);
  font-size: 0.95em;
}

input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 15px; /* Increased margin */
  border: 1px solid var(--input-border-color);
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1em;
  background-color: var(--input-bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--heading-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); /* Use heading color with alpha */
}

html[data-theme="dark"] input[type="number"]:focus {
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.3); /* Lighter blue focus */
}

button[type="submit"] {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: var(--button-bg-color);
  color: white; /* Assuming button text is always white */
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 500;
  margin-top: 25px; /* Increased margin */
  transition: background-color 0.3s ease;
}

button[type="submit"]:hover {
  background-color: var(--button-hover-bg-color);
}

#results {
  margin-top: 30px;
  padding: 20px;
  background-color: var(--results-bg-color);
  border: 1px solid var(--results-border-color);
  border-radius: 4px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

#results h2 {
    color: var(--heading-color);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em; /* Slightly larger results heading */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

#results p {
  margin: 12px 0; /* Increased spacing */
  font-size: 1.1em;
  color: var(--text-color);
}

#results span {
  font-weight: bold;
  color: var(--results-text-color); /* Use specific results text color */
  margin-left: 5px; /* Space between label and value */
}

/* --- Responsive Design --- */
@media (max-width: 640px) { /* Adjusted breakpoint */
  .container {
      margin: 15px;
      padding: 20px;
  }

  h1 {
      font-size: 1.6em;
      margin-top: 40px; /* More space below toggle */
  }

  .theme-toggle-button {
      top: 10px;
      right: 10px;
      font-size: 1.4rem;
      width: 36px;
      height: 36px;
      padding: 6px;
  }

  label {
      margin-top: 15px;
  }

  input[type="number"] {
      padding: 12px;
  }

  button[type="submit"] {
      padding: 14px;
      font-size: 1em;
  }

  #results h2 {
      font-size: 1.2em;
  }

  #results p {
      font-size: 1em;
  }
}
