/* ============================================================
   ELECTRICITY MONITOR – style.css
   Palette: Cream bg · Sky-blue accents · Industrial clarity
   ============================================================ */

/* ── Google Fonts loaded in index.php ── */

:root {
  --bg:          #fdf8f0;         /* light cream */
  --surface:     #ffffff;
  --surface2:    #f0f7ff;        /* pale sky tint */
  --border:      #c8ddf0;
  --accent:      #1a7fc1;        /* sky blue */
  --accent-dark: #135e91;
  --accent-soft: #e0f0fb;
  --gold:        #e8a020;
  --green:       #2a9d5c;
  --red:         #d94040;
  --text:        #1e2a36;
  --text-muted:  #607080;
  --hint:        #2e86c1;
  --shadow:      0 2px 12px rgba(26,127,193,.12);
  --radius:      10px;
  --font-head:   'Rajdhani', sans-serif;
  --font-body:   'Source Sans 3', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ── HEADER ── */
.app-header {
  background: linear-gradient(135deg, #0d5c8a 0%, #1a7fc1 60%, #2aa8e0 100%);
  color: #fff;
  padding: 18px 20px 16px;
  box-shadow: 0 3px 16px rgba(13,92,138,.35);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
}
.header-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255,220,0,.6));
}
.app-title {
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.1;
}
.app-sub {
  font-size: .82rem;
  opacity: .85;
  margin-top: 2px;
}

/* ── CONTAINER ── */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 12px;
}

/* ── TABS ── */
.tab-bar {
  display: flex;
  gap: 0;
  margin-top: 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tab-btn {
  flex: 1;
  padding: 13px 8px;
  background: #d0e8f8;
  border: none;
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--accent-dark);
  cursor: pointer;
  transition: background .2s, color .2s;
  border-right: 1px solid var(--border);
}
.tab-btn:last-child { border-right: none; }

.tab-btn.active,
.tab-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── TAB PANELS ── */
.tab-panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px 16px 24px;
  box-shadow: var(--shadow);
  animation: fadeIn .25s ease;
}
.tab-panel.active { display: block; }

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

.panel-title {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .03em;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 3px;
}

/* ── FIELD ROWS ── */
.field-row {
  margin-bottom: 14px;
}

.field-row label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.hint {
  font-size: .76rem;
  font-weight: 400;
  color: var(--hint);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 6px;
}
.hint strong { color: var(--accent-dark); }

.field-row input[type="number"],
.field-row input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--surface2);
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
  -moz-appearance: textfield;
}
.field-row input[type="number"]::-webkit-outer-spin-button,
.field-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.field-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,127,193,.15);
}

/* ── BUTTONS ── */
.btn-compute {
  width: 100%;
  padding: 13px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, #2aa8e0 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(26,127,193,.3);
  transition: opacity .18s, transform .12s;
}
.btn-compute:hover  { opacity: .92; transform: translateY(-1px); }
.btn-compute:active { transform: translateY(0); }

.btn-copy {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .18s;
}
.btn-copy:hover { opacity: .88; }

/* ── RESULT AREA ── */
.result-area {
  margin-top: 18px;
  background: #f0fff7;
  border: 1.5px solid #90d8b0;
  border-radius: var(--radius);
  padding: 14px 16px 10px;
}

.result-area pre {
  font-family: 'Courier New', monospace;
  font-size: .93rem;
  color: #1a3a2a;
  white-space: pre-wrap;
  line-height: 1.7;
}

/* ── ERROR AREA ── */
.error-area {
  margin-top: 12px;
  min-height: 0;
  color: var(--red);
  background: #fff5f5;
  border: 1.5px solid #f5c0c0;
  border-radius: 7px;
  font-size: .9rem;
  padding: 0;
  transition: all .2s;
}
.error-area:not(:empty) {
  padding: 10px 14px;
}

/* ── COPIED NOTICE ── */
.copied-notice {
  display: none;
  text-align: center;
  margin-top: 6px;
  font-size: .88rem;
  color: var(--green);
  font-weight: 600;
}

/* ── SPINNER ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: 14px;
  padding: 28px 24px 22px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  animation: popIn .22s ease;
}
@keyframes popIn {
  from { transform: scale(.88); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-icon { font-size: 2.2rem; margin-bottom: 10px; }
.modal-title {
  font-family: var(--font-head);
  font-size: 1.3rem;
  color: var(--accent-dark);
  margin-bottom: 10px;
}
.modal-msg {
  font-size: .92rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.modal-btns {
  display: flex;
  gap: 12px;
}
.btn-modal-yes {
  flex: 1;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-modal-no {
  flex: 1;
  padding: 11px;
  background: #e0e0e0;
  color: #444;
  border: none;
  border-radius: 7px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

/* ── RESPONSIVE ── */
@media (max-width: 400px) {
  .app-title { font-size: 1.45rem; }
  .tab-btn   { font-size: .95rem; padding: 11px 4px; }
  .field-row label { font-size: .82rem; }
}
