/* ====================================
   CLEAN MODERN UI — LIGHT + DARK
   ==================================== */

/* ---------- VARIABLES ---------- */
:root {
  --bg: #f6f7f9;
  --card-bg: #ffffff;
  --text: #1b1f27;
  --muted: #6f7a88;
  --border: #d6dee8;

  --input-bg: #f3f5f7;
  --input-border: #cfd6dd;

  --radius: 12px;

  --primary: #1e73f8;
  /* Light Mode Primary */
  --primary-hover: #0f62e8;

  --primary-dark: #4d8dff;
  /* Dark Mode Primary */
  --primary-dark-hover: #3c7dee;

  --transition: 0.2s ease;
}

/* ---------- DARK THEME ---------- */
body.dark-theme {
  --bg: #0d1624;
  --card-bg: #111c2c;
  --text: #e8eef7;
  --muted: #9aa5b5;
  --border: #1d2a3b;
  --input-bg: #151f2e;
  --input-border: #243447;
}

/* ---------- BASE ---------- */
body {
  margin: 0;
  padding: 32px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, sans-serif;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ---------- TOP BAR ---------- */
.topbar {
  max-width: 780px;
  margin: 0 auto 24px;
  position: relative;
  text-align: center;
}

.brand h1,
.brand p {
  text-align: center !important;
  width: 100%;
}

.topbar .switch {
  position: absolute;
  right: 20px;
  top: 5px;
}

/* ---------- THEME SWITCH ---------- */
.switch {
  width: 60px;
  height: 30px;
  transform: scale(0.95);
  position: relative;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  inset: 0;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
}

.slider::after {
  content: "";
  width: 26px;
  height: 26px;
  background: var(--card-bg);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: var(--transition);
}

.switch input:checked+.slider::after {
  transform: translateX(30px);
}

/* Theme icons */
.mode-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  opacity: .4;
  pointer-events: none;
}

.moon {
  left: 8px;
}

.sun {
  right: 8px;
}

.switch input:not(:checked)+.slider .moon {
  opacity: 1;
}

.switch input:checked+.slider .sun {
  opacity: 1;
}

/* ---------- CARD ---------- */
.container {
  display: flex;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 780px;
  background: var(--card-bg);
  padding: 32px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  text-align: center;
}

/* ---------- INPUT GRID ---------- */
.section-title {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 14px;
  text-align: center !important;
}

.inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 12px;
  justify-items: center;
  width: 100%;
}

.input-block {
  width: 100%;
  text-align: left;
}

.icon-input {
  position: relative;
}

.icon-input .icon {
  position: absolute;
  left: 14px;
  top: 70%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted);
}

input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  box-sizing: border-box;
}

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

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30, 115, 248, 0.25);
  outline: none;
}

/* ---------- TIMESTAMP ---------- */
.timestamp-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

.timestamp-row .input-block {
  width: 100%;
}

.timestamp-row .icon-input input {
  padding-right: 48px !important;
}

.note {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- BUTTONS ---------- */
.actions-vertical {
  /* display: flex; */
  /* flex-direction: column; */
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  text-align: center;
}

.big-btn {
  width: 65%;
  max-width: 280px;
  height: 48px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

/* Predict Button */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
}

body.dark-theme .btn-primary {
  background: var(--primary-dark);
}

/* Hover */
.btn-primary:hover {
  background: var(--primary-hover);
}

body.dark-theme .btn-primary:hover {
  background: var(--primary-dark-hover);
}

/* Clear Button */
.btn-secondary {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
}

body.dark-theme .btn-secondary {
  background: #1b2b40;
  border: 1px solid #2e4158;
  color: #e8eef7;
}

/* ---------- RESULT CARD ---------- */
.result {
  margin-top: 28px;
  padding: 22px;
  background: var(--input-bg);
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  text-align: left;
}

.result-grid {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 22px !important;
  width: 100%;
}

.icon-l {
  font-size: 16px;
  margin-right: 6px;
  opacity: 0.75;
}

.highlighted {
  padding: 6px 12px;
  background: rgba(30, 115, 248, 0.08);
  border-radius: 8px;
  color: var(--primary);
  display: inline-block;
  margin-top: 4px;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* ---------- SUCCESS CHECK ---------- */
.success-check {
  padding: 8px 14px;
  background: rgba(50, 200, 90, 0.18);
  border: 1px solid rgba(50, 200, 90, 0.28);
  color: #3de174;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  width: fit-content;
  justify-content: center;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 14px;
  animation: fadeIn .25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- HISTORY TABLE ---------- */
.table-wrap {
  margin-top: 8px;
  max-height: 210px;
  overflow-y: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-left: auto;
  margin-right: auto;
}

thead th {
  text-align: left;
  padding: 10px 6px;
  font-size: 14px;
  color: var(--muted);
}

tbody td {
  padding: 10px 6px;
  font-size: 15px;
  border-top: 1px solid var(--border);
}

/* ---------- HISTORY BUTTONS ---------- */
.history-actions {
  text-align: center;
  margin-top: 10px;
}

.stack-btn {
  width: 200px;
  height: 46px;
  border-radius: 16px;
  font-size: 15px;
  margin-left: auto;
  margin-right: auto;
}

/* BLUE Export CSV Button */
#exportBtn {
  background: var(--primary) !important;
  color: white !important;
  border: none !important;
}

#exportBtn:hover {
  background: var(--primary-hover) !important;
}

body.dark-theme #exportBtn {
  background: var(--primary-dark) !important;
}

body.dark-theme #exportBtn:hover {
  background: var(--primary-dark-hover) !important;
}


#resultCard {
  text-align: center !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.result-panel {
  text-align: center !important;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}


.meta {
  text-align: center !important;
  width: 100%;
}

/* Icons also centered */
.label {
  text-align: center !important;
}

#predictionValue {
  display: inline-block;
  margin-right: 6px;
}

/* Add kWh after the value automatically */
#predictionValue::after {
  content: " kWh";
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  margin-left: 4px;
}

/* ---------- API URL ---------- */
.api-url-line {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* ---------- RESPONSIVE ---------- */
@media(max-width: 780px) {
  .inputs-grid {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .big-btn {
    width: 100%;
  }
}