/* ============================================================
   VUNA-Calc — Styles
   ============================================================ */

:root {
  --primary:   #667eea;
  --secondary: #764ba2;
  --accent:    #f093fb;
  --dark:      #2c3e50;
  --light:     #ecf0f1;
  --success:   #2ecc71;
  --warning:   #f39c12;
  --danger:    #e74c3c;
  --shadow:    0 10px 30px rgba(0,0,0,.2);
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  transition: background .3s;
}

body.dark-mode {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.2rem;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(6px);
  transition: background .2s;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,.3); }

/* ── Card ─────────────────────────────────────────────────── */
.calculator-card {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: none;
  overflow: hidden;
  transition: transform .3s, box-shadow .3s;
}
.calculator-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(0,0,0,.3);
}
body.dark-mode .calculator-card {
  background: rgba(30,30,50,.95);
  color: #e0e0e0;
}

/* ── Display ──────────────────────────────────────────────── */
#result {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 500;
  text-align: right;
  padding: 18px 20px;
  margin-bottom: 8px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,.2);
}
#result:disabled { opacity: 1; }

/* Percent insight bar */
#percent-insight {
  min-height: 24px;
  font-size: .85rem;
  color: var(--secondary);
  text-align: center;
  margin-bottom: 12px;
  font-weight: 600;
  transition: opacity .2s;
}
body.dark-mode #percent-insight { color: #b39ddb; }

/* ── Button grid ──────────────────────────────────────────── */
.btn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn-grid button {
  border: none;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 600;
  height: 58px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
.btn-grid button:hover  { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.btn-grid button:active { transform: translateY(0);    box-shadow: 0 2px 6px rgba(0,0,0,.15); }

/* Number buttons */
.btn-light {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: var(--dark);
  border: 1px solid rgba(0,0,0,.08) !important;
}
body.dark-mode .btn-light {
  background: linear-gradient(135deg, #2e2e4e 0%, #252540 100%);
  color: #e0e0e0;
  border-color: rgba(255,255,255,.08) !important;
}

/* Operator buttons */
.btn-operator {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
}

/* Action (AC) button */
.btn-action {
  background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%);
  color: #fff;
}

/* CE button */
.btn-ce {
  background: linear-gradient(135deg, var(--warning) 0%, #e67e22 100%);
  color: #fff;
}

/* Equals button — spans full width */
.btn-equals {
  grid-column: span 4;
  background: linear-gradient(135deg, var(--success) 0%, #27ae60 100%);
  color: #fff;
  font-size: 1.4rem;
}

/* % insight button */
.btn-percent {
  background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
  color: #fff;
}

/* ── Header ───────────────────────────────────────────────── */
.group-header {
  color: var(--secondary);
  font-weight: 700;
  letter-spacing: 1px;
}
body.dark-mode .group-header { color: #b39ddb; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .btn-grid button { height: 50px; font-size: 1rem; }
  #result          { font-size: 1.4rem; }
}
