/* CineAHO Calculator Pro Ultimate Stylesheet */

/* Theme & Variables */
:root {
  /* HSL Colors */
  --hue-purple: 270;
  --hue-blue: 210;
  --hue-green: 145;
  --hue-gold: 45;
  --hue-red: 350;
  --hue-cyan: 190;

  /* Theme Core (Dark Mode default) */
  --bg-color: #060913;
  --bg-grid: rgba(255, 255, 255, 0.015);
  
  --panel-bg: rgba(14, 20, 38, 0.55);
  --panel-border: rgba(255, 255, 255, 0.05);
  --panel-hover-border: rgba(0, 242, 254, 0.25);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #475569;
  
  /* Gradation Accents */
  --grad-purple: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  --grad-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  --grad-green: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --grad-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --grad-red: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  
  --neon-glow: 0 0 30px rgba(126, 34, 206, 0.2);
  --neon-border-glow: 0 0 15px rgba(0, 242, 254, 0.3);

  --font-main: 'Noto Sans KR', 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  
  --highlight-color: #fbbf24;
}

[data-theme="light"] {
  --bg-color: #f8fafc;
  --bg-grid: rgba(15, 23, 42, 0.02);
  
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(15, 23, 42, 0.06);
  --panel-hover-border: rgba(59, 130, 246, 0.3);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dark: #cbd5e1;
  
  --neon-glow: 0 0 30px rgba(59, 130, 246, 0.1);
  --shadow-card: 0 12px 40px 0 rgba(15, 23, 42, 0.08);
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.5s ease, color 0.3s ease;
}

/* Grid Background */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  pointer-events: none;
}

/* Ambient Glow */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(160px);
  z-index: -3;
  pointer-events: none;
  opacity: 0.25;
}

.bg-glow-purple {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #7e22ce 0%, transparent 70%);
  top: -100px;
  left: 5%;
}

.bg-glow-blue {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
  top: 30%;
  right: 5%;
}

/* Common Panels */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: var(--panel-hover-border);
}

/* Header */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 1rem 1.5rem 0 1.5rem;
  border-radius: 50px;
  transition: var(--transition-smooth);
}

.glass-header {
  background: rgba(14, 20, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.logo-circle {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-text {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
}

.logo-text span {
  color: var(--text-muted);
  font-weight: 400;
}

.header-nav {
  flex-grow: 1;
  margin: 0 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 1.25rem;
  white-space: nowrap;
}

.nav-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  padding: 0.5rem 0.25rem;
  position: relative;
}

.nav-list a:hover,
.nav-list a.active {
  color: var(--text-main);
}

.nav-list a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #2563eb;
  border-radius: 2px;
}

.btn-back-dashboard {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 0.5rem 1.2rem;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-back-dashboard:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #2563eb;
  transform: translateX(-2px);
}

/* Calculator Container */
.calc-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header Section */
.calc-header-section {
  text-align: center;
}

.main-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.main-title span {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 800px;
  margin: 0 auto 1.5rem auto;
  line-height: 1.6;
}

.tag-badges {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.25rem 0.75rem;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* 8 Tabs Bar */
.calc-tabs-bar {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.calc-tabs-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 12px;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.tab-btn.active {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: #60a5fa;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.1);
}

/* Mode Indicator Bar */
.mode-indicator-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.5rem;
}

.indicator-icon {
  width: 32px;
  height: 32px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #a78bfa;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.mode-indicator-bar h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.mode-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.history-controls {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.btn-history-toggle {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-history-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Workspace Grid (Left Panel / Right History) */
.calc-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

/* Calculator Core Panel */
.calc-core-panel {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow: hidden;
}

/* LCD Display */
.calc-lcd-display {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-height: 120px;
  position: relative;
}

.btn-copy-display {
  position: absolute;
  left: 1.25rem;
  top: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.btn-copy-display:hover {
  color: var(--text-main);
}

.lcd-formula {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-muted);
  min-height: 1.5rem;
  word-break: break-all;
  text-align: right;
}

.lcd-output {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  word-break: break-all;
  text-align: right;
  line-height: 1.2;
}

/* Pad Area (Keys) */
.calc-pad-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Button Rows & Layout Grid */
.keys-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.keys-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

/* Individual Buttons */
.btn-calc {
  height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn-calc:active {
  transform: scale(0.95);
}

/* 1. Memory Buttons: Light Purple */
.btn-mem {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  font-size: 0.85rem;
  height: 40px;
}
.btn-mem:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.35);
}

/* 2. Reset / CE / Clear: Red & Deep Orange */
.btn-clear {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}
.btn-clear:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* 3. Single Operations / Backspace: Orange */
.btn-op-single {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.2);
  color: #fb923c;
}
.btn-op-single:hover {
  background: #f97316;
  color: #fff;
  border-color: #f97316;
}

/* 4. Operator Buttons (+, -, *, /): Blue */
.btn-op {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
}
.btn-op:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* 5. Equals Button: Vibrant Green */
.btn-equals {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-equals:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

/* 6. Scientific Function keys */
.btn-sci-func {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  font-size: 0.9rem;
}
.btn-sci-func:hover {
  background: #06b6d4;
  color: #fff;
  border-color: #06b6d4;
}

/* 7. Numbers key default hover */
.btn-calc:hover:not(.btn-mem):not(.btn-clear):not(.btn-op-single):not(.btn-op):not(.btn-equals):not(.btn-sci-func) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ----------------------------------------------------
   Converter & Finance & Matrix & Graph Special Forms
   ---------------------------------------------------- */
.form-workspace {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 1.5rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-group input,
.input-group select {
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
}

.input-group input:focus,
.input-group select:focus {
  border-color: #3b82f6;
}

/* Programer display list */
.programmer-display-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.prog-item {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.prog-label {
  color: var(--text-dark);
  font-weight: 700;
}

.prog-val {
  color: #60a5fa;
  word-break: break-all;
}

/* Financial Result List */
.finance-result-list {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.50rem;
}

.finance-result-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.finance-result-row span {
  color: var(--text-muted);
}

.finance-result-row strong {
  font-family: var(--font-display);
  color: #10b981;
}

/* Matrix Inputs container */
.matrix-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin: 1rem 0;
}

.matrix-box {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.matrix-box input {
  width: 48px;
  height: 40px;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  outline: none;
}

.matrix-box input:focus {
  border-color: #8b5cf6;
}

.matrix-result-box {
  margin-top: 0.50rem;
  padding: 0.85rem;
  background: rgba(139, 92, 246, 0.03);
  border: 1px dashed rgba(139, 92, 246, 0.15);
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Graph Canvas container */
.graph-canvas-container {
  background: #10121e;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  justify-content: center;
}

#graph-canvas {
  display: block;
}

/* Statistics text area */
.stats-textarea {
  resize: none;
  min-height: 80px;
}

/* ----------------------------------------------------
   History Side Panel
   ---------------------------------------------------- */
.history-side-panel {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  height: 100%;
  max-height: 600px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.history-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-clear-history:hover {
  color: #ef4444;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  flex-grow: 1;
}

.history-empty {
  text-align: center;
  color: var(--text-dark);
  font-size: 0.85rem;
  margin-top: 2rem;
}

.history-item {
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.hist-formula {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hist-result {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-display);
}

/* ----------------------------------------------------
   Floating Navigator Widgets
   ---------------------------------------------------- */
.floating-navigator {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
  z-index: 1000;
}

.nav-overlay-menu {
  width: 200px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: var(--transition-smooth);
  margin-bottom: 0.25rem;
}

.nav-overlay-menu.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-overlay-menu h5 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
}

.nav-overlay-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.50rem;
}

.nav-overlay-menu li {
  font-size: 0.8rem;
  color: var(--text-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-overlay-menu li:hover,
.nav-overlay-menu li.active {
  color: var(--text-main);
}

.nav-overlay-menu li span {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255,255,255,0.04);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: #10b981;
}

.nav-overlay-menu li.active span {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.floating-buttons-col {
  display: flex;
  flex-direction: column;
  gap: 0.50rem;
  align-items: center;
}

.progress-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.progress-ring__circle {
  transition: stroke-dashoffset 0.35s;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-text {
  position: absolute;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  color: #10b981;
}

.btn-float {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(14, 20, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-float:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  transform: translateY(-2px);
}

/* Toast alert */
.toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(37, 99, 235, 0.95);
  color: #ffffff;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.35);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast-notification.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsiveness */
@media (max-width: 900px) {
  .calc-workspace-grid {
    grid-template-columns: 1fr;
  }
  .history-side-panel {
    max-height: 250px;
  }
}

@media (max-width: 600px) {
  .btn-calc {
    height: 46px;
    font-size: 0.95rem;
  }
}
