﻿@charset "utf-8";
/* =========================================
   GLOBAL COLOR VARIABLES
========================================= */
:root {
  /* === Base Backgrounds === */
  --bg-grad-light: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #94a3b8 100%);
  --bg-grad-dark: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  --page-bg: var(--bg-grad-light);
  --card-bg: #dbe7f0;
  --muted-card-bg: #dbe7f0;

  /* === Text & Display === */
  --panel-text: #1f2937;
  --display: #1f2937;

  /* === Calculator Frame === */
  --calc-metal: silver;
  --calc-glow: #0f0;
  --calc-bezel: #1a1a1a;
  --calc-shadow: inset 0 0 8px #888;

  /* === Sidebar === */
  --sidebar-bg: #cbd5e1;
  --sidebar-text: #1a202c;

  /* === Accent Colors === */
  --accent: #2563eb;     /* Blue-600 */
  --accent-2: #0ea5e9;    /* Sky-500 */

  /* === Button Colors === */
  --btn-primary: #2563eb;
  --btn-equals: #059669;  /* Emerald-600 */
  --btn-func: #6b7280;    /* Gray-500 */
  --btn-memory: #24A0ED;  /* Teal-600 */
  --btn-clear: #dc2626;   /* Red-600 */
  --btn-number: #dbeafe;
  --button-active: lime;

  /* === Effects === */
  --shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  --radius: 10px;
}

/* =========================================
   DARK THEME OVERRIDES
========================================= */
body[data-theme="dark"] {
  --page-bg: var(--bg-grad-dark);
  --card-bg: #0e1116;
  --muted-card-bg: #0b1220;
  --panel-text: green;
  --display: green;
  --sidebar-bg: #0b1220;
  --sidebar-text: #bfeee0;

  --accent: #2b8fd8;
  --btn-primary: #1f78a2;
  --btn-equals: #148b4a;
  --btn-func: #6e3a84;
  --btn-memory: #24A0ED;
  --btn-clear: #b73d3d;

  --shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* =========================================
   THEME STYLES
========================================= */

/* === Retro Orange === */
body[data-style="retro"] {
  --btn-number: #fff3cd;
  --btn-func: #f59e0b;
  --btn-memory: #f97316;
  --btn-equals: #d97706;
}
body[data-theme="dark"][data-style="retro"] {
  --btn-number: #665c3c;
  --btn-func: #fbbf24;
  --btn-memory: #fb923c;
  --btn-equals: #f59e0b;
}

/* === Neon Green === */
body[data-style="neon"] {
  --btn-number: #e0ffe0;
  --btn-func: #22c55e;
  --btn-memory: #10b981;
  --btn-equals: #059669;
}
body[data-theme="dark"][data-style="neon"] {
  --btn-number: #1e4021;
  --btn-func: #4ade80;
  --btn-memory: #34d399;
  --btn-equals: #10b981;
}

/* === Midnight Purple === */
body[data-style="midnight"] {
  --btn-number: #ede9fe;
  --btn-func: #6e3a84;
  --btn-memory: #8b5cf6;
  --btn-equals: #7c3aed;
}
body[data-theme="dark"][data-style="midnight"] {
  --btn-number: #3b2f4c;
  --btn-func: #a855f7;
  --btn-memory: #c084fc;
  --btn-equals: #9333ea;
}

/* === Aqua Sky === */
body[data-style="aqua"] {
  --btn-number: #e0f7fa;
  --btn-func: #0ea5e9;
  --btn-memory: #06b6d4;
  --btn-equals: #0284c7;
}
body[data-theme="dark"][data-style="aqua"] {
  --btn-number: #0c3c4a;
  --btn-func: #38bdf8;
  --btn-memory: #22d3ee;
  --btn-equals: #0ea5e9;
}

/* === Theme: Graphite === */
body[data-style="graphite"] {
  --btn-number: #e5e7eb;     /* Light slate */
  --btn-func: #6b7280;       /* Cool gray */
  --btn-memory: #4b5563;     /* Darker slate */
  --btn-equals: #374151;     /* Charcoal */
}
body[data-theme="dark"][data-style="graphite"] {
  --btn-number: #2d2f33;
  --btn-func: #4b5563;
  --btn-memory: #6b7280;
  --btn-equals: #9ca3af;
}

/* === Theme: Solar Amber === */
body[data-style="amber"] {
  --btn-number: #fff8e1;     /* Soft cream */
  --btn-func: #fbbf24;       /* Amber-400 */
  --btn-memory: #f59e0b;     /* Amber-500 */
  --btn-equals: #d97706;     /* Amber-600 */
}
body[data-theme="dark"][data-style="amber"] {
  --btn-number: #4b3a1e;
  --btn-func: #facc15;
  --btn-memory: #f59e0b;
  --btn-equals: #fbbf24;
}
/* =========================================
   LAYOUT
========================================= */
* {
  box-sizing: border-box
}
html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif
}
body {
  background: var(--page-bg);
  padding: 28px;
  color: var(--panel-text);
  transition: background .28s ease, color .28s ease;
}
.wrap {
  max-width: 1200px;
  margin: 0 auto;
}
.grid {
  display: flex;
  justify-content: space-between;
  gap: 28px;
}
/* stack columns on mobile */
@media (max-width:900px) {
  .grid {
    flex-direction: column
  }
}
/* =========================================
   SIDEBAR
========================================= */
.side {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  top: 28px;
  height: fit-content;
}
.side h2 {
  margin: 0 0 12px 0
}
.side nav {
  margin-top: 8px
}
.side a {
  display: block;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 8px 6px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-weight: 600;
  transition: background .18s, color .18s;
}
.side a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-2);
}
.theme-toggle {
  margin-top: 14px;
  display: flex;
  gap: 8px
}
.theme-toggle button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  color: var(--sidebar-text);
}
/* =========================================
   CALCULATOR
========================================= */
.calc {
  flex: 1;
  display: flex;
  justify-content: center;
}
.card {
  width: 100%;
  max-width: 720px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
border-radius: 30px 30px 40px 40px;
}
.header {
  text-align: center;
  margin-bottom: 18px;
}
.header h1, p {
  margin: 0;
  color: var(--panel-text);
}
.subtitle {
  margin-top: 6px;
  font-size: .95rem;
  opacity: .7;
} 
/* ===== Display panel ===== */
.display {
  border-radius: 10px 10px 10px 10px;
  padding: 18px;
  min-height: 75px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(0, 0, 0, 0.05) 100%), radial-gradient(circle at top center, rgba(255, 255, 255, 0.25) 0%, transparent 40%), linear-gradient(to bottom, rgba(255, 255, 255, 0.12) 0%, transparent 15%), var(--calc-metal);
  
    box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.bezel {
  background-color: var(--calc-bezel);
  padding: 5px;
  border-radius: 12px 12px 30px 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.frame {
  background: var(--calc-metal);
  padding: 12px;
  border-radius: 12px 12px 30px 30px;
  box-shadow:
    inset 0 0 6px #aaa, inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
}
.current {
  color: #0f0;
  text-shadow: 0 0 4px #0f0;
  font-family: 'Courier New', monospace;
}
/* --- FIXED: readable in both modes --- */
.previous {
  font-size: 1rem;
  opacity: .6;
  color: var(--panel-text);
}
.current {
  font-size: 2.1rem;
  font-weight: 600;
  text-align: right;
  color: var(--panel-text); /* FIXED */
     opacity: 0;
  transition: opacity 150ms ease;
}

button.num:active {
  opacity: 1;
}
.error {
  color: var(--btn-clear);
  font-weight: 600;
  min-height: 20px;
}
/* ===== Mode buttons ===== */
.modes {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--muted-card-bg);
  padding: 6px;
  border-radius: 10px;
}
.modes button {
  flex: 1;
  border: none;
  font-weight: 700;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--panel-text);
}
.modes button.active {
  background: var(--button-active);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}
/* ===== Buttons grid ===== */
.btn-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 12px;
  margin-top: 10px;
}


/* ===== Button styling ===== */
.btn {
  border: none;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 4px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(to bottom, #e0e0e0, #c0c0c0); /* light metallic top to darker bottom */
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.6), /* top highlight for concave look */ inset 0 -2px 4px rgba(0, 0, 0, 0.2), /* bottom shadow inside */ 0 4px 6px rgba(0, 0, 0, 0.3); /* external shadow for depth */
  transition: all 0.15s ease-in-out;
}
.btn:active {
  background: linear-gradient(to bottom, #c0c0c0, #a0a0a0);
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  transform: translateY(2px); /* simulate button press */
}
.btn.na {
  background-color: var(--btn-na, #d1d5db);
  color: #6b7280;
  cursor: default;
  opacity: 0.6;
}
.btn.clear {
  background-color: var(--btn-clear, #ef4444);
  color: #fff;
  font-weight: bold;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
/* --- FIXED: Light mode number buttons visible --- */
.btn.number {
  background-color: var(--btn-number);
  color: #1f2937;
  font-weight: 600;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background-color 0.2s ease;
}
.btn.number:hover {
  background-color: #bfdbfe;
}
.btn.double-zero {
  background-color: var(--btn-number, #e5e7eb); /* match number button base */
  color: #111827;
  font-weight: 600;
  grid-column: span 1; /* or span 2 if you want it wider */
  border-radius: 6px;
  transition: background-color 0.2s ease;
}
.btn.double-zero:hover {
  background-color: #d1d5db;
}
.btn.operator {
  background: var(--btn-primary);
  color: #fff
}
.btn.func {
  background: var(--btn-func);
  color: #fff
}
.btn.memory {
  background: var(--btn-memory);
  color: #fff
}
.btn.clear {
  background: var(--btn-clear);
  color: #fff
}
.btn.equals {
  background: var(--btn-equals);
  color: #fff;
  grid-column: span 2;
}
/* =========================================
   RIGHT PANEL (Memory + History)
========================================= */
.right {
  width: 340px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 28px;
  height: fit-content;
}
.panel-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.mem-display {
  background: var(--muted-card-bg);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  color: var(--panel-text);
}
.mem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.mem-grid button {
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
}
.history {
  max-height: 360px;
  overflow: auto;
  padding-right: 6px;
}
.hist-item {
  background: var(--muted-card-bg);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  border-left: 4px solid var(--accent);
}
.hist-expression {
  font-size: .95rem;
  opacity: .7;
}
.hist-result {
  font-weight: 700;
  margin-top: 6px
}
/* Helpers */
.center {
  text-align: center
}
.muted {
  opacity: .75
}

