/* === Base === */
body {
  background-color: #121212;
  color: #f1f1f1;
  font-family: sans-serif;
  padding: 2rem;
  margin: 0;
}

body.light-mode {
  background-color: #f7f7f7;
  color: #121212;
}

/* === Container === */
.container {
  max-width: 1000px;
  margin: auto;
  background: #1e1e1e;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

body.light-mode .container {
  background: #fdf6eb;
}

/* === Logo === */
#logo_dark, #logo_light {
  display: none;
  max-width: 250px;
  width: 100%;
  height: auto;
  margin: 0 auto 2rem auto;
  transition: all 0.3s ease-in-out;
}
body:not(.light-mode) #logo_dark {
  display: block;
}
body.light-mode #logo_light {
  display: block;
}

/* === Form === */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem auto;
  max-width: 500px;
  width: 100%;
  text-align: left;
}
form input,
form select,
form textarea,
form button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  background-color: #2a2a2a;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  box-sizing: border-box;
}
form textarea {
  resize: vertical;
  min-height: 80px;
}
form button[type="submit"] {
  background-color: #0d6efd;
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
form button[type="submit"]:hover {
  background-color: #0b5ed7;
}

/* === Light Mode Form === */
body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background-color: #fff;
  color: #000;
  border: 1px solid #ccc;
}

/* === Table === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #555;
}
th:hover {
  background-color: #2a2a2a;
}
body.light-mode th:hover {
  background-color: #eee;
}
table th {
  cursor: pointer;
}

/* === Charts === */
canvas {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  margin: 2rem auto;
}

/* === Buttons === */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.button-group button,
#mode-toggle {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 4px;
  background: #444;
  color: #fff;
  border: 1px solid #666;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}
.button-group button:hover,
#mode-toggle:hover {
  background-color: #555;
}
body.light-mode .button-group button,
body.light-mode #mode-toggle {
  background-color: #ddd;
  color: #222;
  border-color: #aaa;
}
body.light-mode .button-group button:hover,
body.light-mode #mode-toggle:hover {
  background-color: #eee;
}

/* === Inputs + Selects === */
input[type="date"],
select {
  background-color: #2a2a2a;
  color: #f1f1f1;
  border: 1px solid #555;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s ease-in-out;
}
input[type="date"]:focus,
select:focus {
  border-color: #888;
  outline: none;
  background-color: #333;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg fill='%23f1f1f1' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2rem;
  cursor: pointer;
}
body.light-mode select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg fill='%23000' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* === Link === */
#history-link,
.back-link {
  display: inline-block;
  margin-top: 1rem;
  text-decoration: none;
  font-weight: bold;
  color: #0dcaf0;
  transition: color 0.2s;
}
#history-link:hover,
.back-link:hover {
  color: #0bbbe6;
}
.back-link {
  padding: 0.5rem 1rem;
  border: 1px solid #666;
  border-radius: 4px;
  background-color: #444;
}
body.light-mode .back-link {
  background-color: #ddd;
  color: #222;
  border-color: #aaa;
}
body.light-mode .back-link:hover {
  background-color: #eee;
}
.button-link {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.4rem 1rem;
  font-size: 0.95rem;
  background-color: #333;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s ease-in-out, color 0.2s;
}

.button-link:hover {
  background-color: #444;
  color: #fff;
}

body.light-mode .button-link {
  background-color: #e0e0e0;
  color: #222;
  border-color: #bbb;
}

body.light-mode .button-link:hover {
  background-color: #d4d4d4;
  color: #000;
}
.chart-type-wrapper {
  text-align: center;
  margin-top: 1rem;
}

.chart-type-wrapper label {
  margin-right: 0.5rem;
  font-weight: bold;
}

.chart-type-wrapper select {
  font-size: 1rem;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #555;
  background-color: #2a2a2a;
  color: #f1f1f1;
  transition: background-color 0.2s ease;
}

body.light-mode .chart-type-wrapper select {
  background-color: #fff;
  color: #121212;
  border-color: #ccc;
}
.top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 2rem;
}

.top-controls .button-link,
.top-controls #mode-toggle {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid #666;
  background-color: #444;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s;
}

.top-controls .button-link:hover,
.top-controls #mode-toggle:hover {
  background-color: #555;
}

body.light-mode .top-controls .button-link,
body.light-mode .top-controls #mode-toggle {
  background-color: #ddd;
  color: #222;
  border-color: #aaa;
}

body.light-mode .top-controls .button-link:hover,
body.light-mode .top-controls #mode-toggle:hover {
  background-color: #eee;
}
