/* ============================================================
   cutecalc 🌸 — style.css
   Soft pastel aesthetic · beginner-friendly · copy-paste ready
   ============================================================ */

/* ── Google Fonts are loaded in index.html ── */

/* ══════════════════════════════════════════
   CSS VARIABLES — edit these to change theme!
   ══════════════════════════════════════════ */
:root {
  /* base palette */
  --bg:          #fdf6f0;
  --bg2:         #fef9f5;
  --surface:     #ffffff;
  --border:      rgba(210,180,160,0.25);

  /* accent colours */
  --pink:        #f2b8cb;
  --pink-deep:   #d4708e;
  --pink-pale:   #fde8f0;
  --blush:       #f9d5e2;
  --peach:       #fddccc;
  --peach-deep:  #e8926a;
  --lavender:    #e0d4f5;
  --lav-deep:    #9b7dd4;
  --mint:        #c8edd8;
  --mint-deep:   #5aad7e;
  --yellow:      #fdf0c0;
  --yellow-deep: #c9a83a;
  --blue-soft:   #c8dff0;
  --blue-deep:   #5a8fc0;

  /* text */
  --text:        #6b4d5a;
  --text-soft:   #a08090;
  --text-muted:  #c0a8b8;

  /* shadows */
  --shadow-sm:   0 2px 8px  rgba(180,120,140,0.12);
  --shadow-md:   0 6px 20px rgba(180,120,140,0.16);
  --shadow-lg:   0 12px 36px rgba(180,120,140,0.18);

  /* radius */
  --r-sm:  10px;
  --r-md:  18px;
  --r-lg:  24px;
  --r-xl:  32px;
  --r-pill:50px;
}

/* ── theme overrides per topic ── */
body.theme-finance  { --bg:#f0f8f4; --bg2:#f5fdf8; --pink:#a8d8c0; --pink-deep:#3a8a60; --pink-pale:#e0f5ec; --blush:#c8eedd; }
body.theme-shopping { --bg:#fdf0f8; --bg2:#fef5fb; --pink:#f0b8d8; --pink-deep:#c0508a; --pink-pale:#fde0f2; --blush:#f8d0e8; }
body.theme-study    { --bg:#f0f2fd; --bg2:#f5f6ff; --pink:#b8c8f5; --pink-deep:#4a5ec0; --pink-pale:#dce4fd; --blush:#ccd4f8; }
body.theme-bills    { --bg:#fdf8f0; --bg2:#fffbf5; --pink:#f5d8a8; --pink-deep:#c09040; --pink-pale:#fdf0d8; --blush:#f8e4c0; }
body.theme-savings  { --bg:#f8f0fd; --bg2:#fbf5ff; --pink:#d8b8f5; --pink-deep:#8a50c0; --pink-pale:#f0e0fd; --blush:#e4ccf8; }

/* ══════════════════════════════════════════
   RESET + BASE
   ══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: 'Quicksand', sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(242,184,203,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(224,212,245,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(253,220,204,0.10) 0%, transparent 60%);
  min-height: 100vh;
  color: var(--text);
  overflow-x: hidden;
  transition: background-color 0.5s ease;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='4' fill='%23f2b8cb' opacity='0.7'/%3E%3C/svg%3E") 10 10, auto;
}

/* ══════════════════════════════════════════
   FLOATING PARTICLES
   ══════════════════════════════════════════ */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  font-size: 16px;
  opacity: 0;
  animation: particleRise linear infinite;
  user-select: none;
}

@keyframes particleRise {
  0%   { transform: translateY(100vh) rotate(0deg) scale(0.5);  opacity: 0; }
  8%   { opacity: 0.55; }
  92%  { opacity: 0.55; }
  100% { transform: translateY(-80px)  rotate(360deg) scale(1.1); opacity: 0; }
}

/* ══════════════════════════════════════════
   TOPIC BAR
   ══════════════════════════════════════════ */
.topic-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topic-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
}

.topic-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 6px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.22s ease;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--pink);
  color: var(--pink-deep);
  background: var(--pink-pale);
  transform: translateY(-1px);
}

.pill.active {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════
   MAIN LAYOUT  (3 columns)
   ══════════════════════════════════════════ */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px 1fr 200px;
  gap: 28px;
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* ══════════════════════════════════════════
   LEFT PANEL — NOTES
   ══════════════════════════════════════════ */
.notes-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* image slot */
.image-slot {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 2px solid rgba(242,184,203,0.35);
  box-shadow: var(--shadow-md);
  background: var(--pink-pale);
  position: relative;
}

.deco-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.deco-img:hover { transform: scale(1.04); }

.img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--pink-pale);
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 16px;
  line-height: 1.5;
}

.img-fallback span { font-size: 36px; }

/* sticky note */
.sticky-note {
  background: var(--yellow);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow:
    var(--shadow-sm),
    4px 4px 0 rgba(200,160,60,0.15);
  border: 1px solid rgba(200,170,60,0.2);
  position: relative;
}

.sticky-note::before {
  content: '';
  position: absolute;
  top: -6px; left: 24px;
  width: 48px; height: 12px;
  background: rgba(200,168,60,0.3);
  border-radius: 4px 4px 0 0;
}

.sticky-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sticky-title {
  font-family: 'Dancing Script', cursive;
  font-size: 16px;
  color: var(--yellow-deep);
}

.clear-note-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.clear-note-btn:hover { color: #c05050; background: rgba(200,80,80,0.08); }

.notepad {
  width: 100%;
  min-height: 160px;
  border: none;
  background: transparent;
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.7;
}

.notepad::placeholder { color: var(--text-muted); font-style: italic; }

.note-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: var(--yellow-deep);
  opacity: 0.7;
}

/* finance panel */
.finance-panel {
  background: var(--mint);
  border-radius: var(--r-md);
  padding: 16px;
  border: 1px solid rgba(90,173,126,0.2);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.finance-panel.hidden { display: none; }

.fin-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--mint-deep);
  margin-bottom: 2px;
}

.fin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fin-row label {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.fin-row input {
  width: 110px;
  padding: 6px 10px;
  border: 1.5px solid rgba(90,173,126,0.3);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.7);
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.fin-row input:focus { border-color: var(--mint-deep); }

.fin-result {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--mint-deep);
  padding: 8px;
  background: rgba(255,255,255,0.5);
  border-radius: var(--r-sm);
}

/* ══════════════════════════════════════════
   CENTER — CALCULATOR
   ══════════════════════════════════════════ */
.calc-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.calc-header { text-align: center; }

.calc-subtitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 4px;
  transition: color 0.4s;
}

.calc-title {
  font-family: 'Dancing Script', cursive;
  font-size: 36px;
  font-weight: 700;
  color: var(--pink-deep);
  line-height: 1;
}

.title-deco { display: inline-block; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* calculator card */
.calc {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.95);
  border: 1.5px solid var(--border);
  transition: box-shadow 0.3s;
}

.calc:hover { box-shadow: var(--shadow-lg), 0 0 0 4px rgba(242,184,203,0.15), inset 0 1px 0 rgba(255,255,255,0.95); }

/* display */
.display {
  background: var(--pink-pale);
  border-radius: var(--r-lg);
  padding: 16px 20px 14px;
  margin-bottom: 20px;
  border: 1.5px solid rgba(242,184,203,0.4);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.display::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(242,184,203,0.25) 0%, transparent 70%);
  border-radius: 50%;
}

.display-expr {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  min-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Quicksand', sans-serif;
}

.display-main {
  font-family: 'Dancing Script', cursive;
  font-size: 50px;
  color: var(--pink-deep);
  text-align: right;
  line-height: 1.05;
  word-break: break-all;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  transition: color 0.3s;
}

.display-mode {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

/* base button */
.btn {
  height: 64px;
  border: none;
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s;
  position: relative;
  overflow: hidden;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ripple on click */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  border-radius: inherit;
  transition: background 0.12s;
}
.btn:hover::after  { background: rgba(255,255,255,0.22); }
.btn:active::after { background: rgba(255,255,255,0.12); }

.btn:active {
  transform: translateY(2px) scale(0.96) !important;
}

/* number buttons */
.btn-num {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 0 rgba(180,140,160,0.22), var(--shadow-sm);
  border: 1px solid rgba(210,180,200,0.18);
  font-size: 22px;
}
.btn-num:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(180,140,160,0.22), var(--shadow-md); }
.btn-num:active { box-shadow: 0 1px 0 rgba(180,140,160,0.22); }

/* function buttons (AC, +/-, %) */
.btn-fn {
  background: var(--blush);
  color: var(--pink-deep);
  box-shadow: 0 4px 0 rgba(212,112,142,0.2), var(--shadow-sm);
  border: 1px solid rgba(242,184,203,0.35);
  font-size: 16px;
  font-weight: 800;
}
.btn-fn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(212,112,142,0.2), var(--shadow-md); }
.btn-fn:active { box-shadow: 0 1px 0 rgba(212,112,142,0.2); }

/* operator buttons */
.btn-op {
  background: var(--pink);
  color: #fff;
  box-shadow: 0 4px 0 rgba(212,112,142,0.35), var(--shadow-sm);
  border: 1px solid rgba(212,112,142,0.2);
  font-size: 22px;
  text-shadow: 0 1px 2px rgba(180,80,110,0.3);
}
.btn-op:hover  { transform: translateY(-2px); background: var(--pink-deep); box-shadow: 0 6px 0 rgba(212,112,142,0.35), var(--shadow-md); }
.btn-op.active { background: var(--pink-deep); transform: translateY(1px); box-shadow: 0 2px 0 rgba(212,112,142,0.35); }
.btn-op:active { box-shadow: 0 1px 0 rgba(212,112,142,0.35); }

/* equals */
.btn-eq {
  background: linear-gradient(135deg, var(--pink-deep), #e05888);
  color: #fff;
  box-shadow: 0 4px 0 rgba(180,60,100,0.35), 0 6px 16px rgba(212,112,142,0.3);
  border: none;
  font-size: 26px;
  grid-column: span 2;
  text-shadow: 0 1px 3px rgba(150,40,80,0.3);
  letter-spacing: 0.05em;
}
.btn-eq:hover  { transform: translateY(-2px) scale(1.02); box-shadow: 0 6px 0 rgba(180,60,100,0.35), 0 10px 24px rgba(212,112,142,0.35); }
.btn-eq:active { transform: translateY(2px) scale(0.97) !important; box-shadow: 0 1px 0 rgba(180,60,100,0.35); }

/* zero spans 2 */
.btn-zero { grid-column: span 2; font-size: 22px; letter-spacing: 0.05em; }

/* extra row */
.extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
}

.btn-back {
  padding: 8px 16px;
  background: var(--lavender);
  color: var(--lav-deep);
  border: 1.5px solid rgba(155,125,212,0.25);
  border-radius: var(--r-pill);
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-back:hover { background: var(--lav-deep); color: #fff; transform: translateY(-1px); }
.btn-back:active { transform: translateY(1px); }

.calc-msg {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  font-family: 'Dancing Script', cursive;
  font-size: 14px;
  text-align: right;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

/* ══════════════════════════════════════════
   RIGHT PANEL — TIPS
   ══════════════════════════════════════════ */
.tips-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tips-card, .shortcut-card {
  background: var(--pink-pale);
  border-radius: var(--r-lg);
  padding: 16px;
  border: 1px solid rgba(242,184,203,0.3);
  box-shadow: var(--shadow-sm);
}

.shortcut-card { background: var(--lavender); border-color: rgba(155,125,212,0.2); }

.tips-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tips-list li {
  font-size: 12px;
  color: var(--text-soft);
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}

.tips-list li::before {
  content: '🌸';
  position: absolute;
  left: 0;
  font-size: 10px;
  top: 1px;
}

.shortcut-card .tips-list li::before { content: '✦'; color: var(--lav-deep); font-size: 8px; top: 3px; }

.deco-card {
  background: var(--peach);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  border: 1px solid rgba(232,146,106,0.2);
  box-shadow: var(--shadow-sm);
}

.deco-quote {
  font-family: 'Dancing Script', cursive;
  font-size: 15px;
  color: var(--peach-deep);
  line-height: 1.5;
  text-align: center;
}

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes popIn {
  0%   { transform: scale(0.85); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1);    opacity: 1; }
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  15%     { transform: translateX(-8px); }
  30%     { transform: translateX(8px); }
  45%     { transform: translateX(-6px); }
  60%     { transform: translateX(6px); }
  75%     { transform: translateX(-3px); }
  90%     { transform: translateX(3px); }
}

@keyframes successPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.06); }
  60%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.anim-shake   { animation: shake 0.4s ease; }
.anim-pop     { animation: popIn 0.3s cubic-bezier(.34,1.56,.64,1) both; }
.anim-success { animation: successPop 0.4s ease; }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
  .notes-panel, .tips-panel {
    display: none; /* hidden on mobile — show calc only */
  }
}

@media (max-width: 480px) {
  .topic-bar { padding: 10px 16px; }
  .layout    { padding: 16px 12px 40px; }
  .calc      { padding: 18px 16px; }
  .btn       { height: 56px; font-size: 18px; }
  .display-main { font-size: 40px; }
  .calc-title   { font-size: 28px; }
}

/* ══════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════ */
::-webkit-scrollbar        { width: 6px; }
::-webkit-scrollbar-track  { background: var(--bg); }
::-webkit-scrollbar-thumb  { background: var(--pink); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--pink-deep); }
