/*
Theme Name: CalculatHub
Theme URI: https://calculathub.com/
Description: A modern, moody dark-themed calculator portal powered by Antigravity AI.
Author: Antigravity Agent
Author URI: https://calculathub.com/
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: calculathub
*/

/* ---------- Base Resets ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background-color: #020617;
  color: #e2e8f0;
  overflow-x: hidden;
  min-height: 100vh;
  animation: pageLoad 0.6s ease;
  /* Premium layered dark gradient background */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(13, 90, 167, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(246, 141, 46, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 10% 60%, rgba(13, 90, 167, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

@keyframes pageLoad {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Interactive Canvas Background ---------- */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #020617; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #0D5AA7, #F68D2E);
  border-radius: 3px;
}

/* ---------- Floating Math Symbols ---------- */
#floating-symbols-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.floating-symbol {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  will-change: transform, opacity;
  user-select: none;
  font-weight: 300;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  /* Subtle glow to give them a neon-esque feel */
  text-shadow: 0 0 8px currentColor;
}

/* Float upward animation */
@keyframes floatDrift {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
    opacity: var(--sym-opacity, 0.05);
  }
  25% {
    transform: translateY(calc(var(--drift-y, -25vh))) translateX(calc(var(--drift-x, 10px))) rotate(90deg) scale(1.05);
  }
  50% {
    transform: translateY(calc(var(--drift-y, -25vh) * 2)) translateX(calc(var(--drift-x, 10px) * -1)) rotate(180deg) scale(1);
    opacity: var(--sym-opacity, 0.05);
  }
  75% {
    transform: translateY(calc(var(--drift-y, -25vh) * 3)) translateX(calc(var(--drift-x, 10px) * 0.5)) rotate(270deg) scale(0.95);
  }
  100% {
    transform: translateY(calc(var(--drift-y, -25vh) * 4)) translateX(0) rotate(360deg) scale(1);
    opacity: var(--sym-opacity, 0.05);
  }
}

/* Gentle bob for symbols that stay in place */
@keyframes gentleBob {
  0%, 100% {
    transform: translateY(0) rotate(var(--base-rot, 0deg));
    opacity: var(--sym-opacity, 0.05);
  }
  33% {
    transform: translateY(-12px) rotate(calc(var(--base-rot, 0deg) + 5deg));
  }
  66% {
    transform: translateY(8px) rotate(calc(var(--base-rot, 0deg) - 3deg));
  }
}

/* ---------- Hero Gradient Orbs ---------- */
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  opacity: 0.10;
}
.hero-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #0D5AA7 0%, transparent 70%);
  top: -200px; right: -150px;
  animation: pulseOrb 8s ease-in-out infinite alternate;
}
.hero-orb-2 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, #F68D2E 0%, transparent 70%);
  bottom: -100px; left: -100px;
  animation: pulseOrb 10s ease-in-out infinite alternate-reverse;
}
@keyframes pulseOrb {
  0%   { transform: scale(1);   opacity: 0.06; }
  100% { transform: scale(1.35); opacity: 0.16; }
}

/* ---------- Gradient Text ---------- */
.gradient-text {
  background: linear-gradient(135deg, #5b9fe0 20%, #F68D2E 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Glassmorphism Calculator Card ---------- */
.glass-card {
  position: relative;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(13, 90, 167, 0.12);
  border-radius: 1.25rem;
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  overflow: hidden;
  /* Inner glass highlight */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 24px rgba(0, 0, 0, 0.2);
}

/* Glass sheen overlay */
.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 40%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.03) 60%,
    transparent 100%
  );
  transition: left 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1;
}

.glass-card:hover::before {
  left: 130%;
}

.glass-card:hover {
  background: rgba(13, 20, 41, 0.65);
  border-color: rgba(246, 141, 46, 0.25);
  transform: translateY(-8px) scale(1.018);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 28px 72px rgba(13, 90, 167, 0.15),
    0 0 48px rgba(246, 141, 46, 0.06),
    0 0 0 1px rgba(246, 141, 46, 0.08);
}

/* Accent bar at card top */
.card-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #0D5AA7, #F68D2E);
  border-radius: 1.25rem 1.25rem 0 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 2;
}
.glass-card:hover .card-accent { opacity: 1; }

/* Card icon container */
.card-icon {
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  font-size: 1.5rem;
  background: rgba(13, 90, 167, 0.08);
  border: 1px solid rgba(13, 90, 167, 0.12);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.glass-card:hover .card-icon {
  background: rgba(246, 141, 46, 0.12);
  border-color: rgba(246, 141, 46, 0.25);
  transform: scale(1.12) rotate(-5deg);
  box-shadow: 0 0 20px rgba(246, 141, 46, 0.1);
}

/* Card arrow */
.card-arrow {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(13, 90, 167, 0.06);
  border: 1px solid rgba(13, 90, 167, 0.10);
  color: #64748b;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.glass-card:hover .card-arrow {
  background: linear-gradient(135deg, #0D5AA7, #F68D2E);
  border-color: transparent;
  color: #fff;
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(13, 90, 167, 0.3);
}

/* Card enter animation */
.card-enter {
  animation: cardEnter 0.5s ease forwards;
  opacity: 0;
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(28px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Category Pills ---------- */
.category-pill {
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(13, 90, 167, 0.12);
  color: #94a3b8;
  transition: all 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.category-pill:hover {
  background: rgba(13, 90, 167, 0.12);
  color: #e2e8f0;
  border-color: rgba(13, 90, 167, 0.25);
}
.category-pill.active {
  background: linear-gradient(135deg, #0D5AA7, #1274cc);
  border-color: rgba(13, 90, 167, 0.6);
  color: #fff;
  box-shadow: 0 0 24px rgba(13, 90, 167, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* ---------- Search Input ---------- */
.search-glow {
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(13, 90, 167, 0.15);
  transition: all 0.3s ease;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.search-glow:focus-within {
  border-color: #F68D2E;
  box-shadow:
    0 0 0 3px rgba(246, 141, 46, 0.08),
    0 0 32px rgba(246, 141, 46, 0.08),
    0 4px 24px rgba(0, 0, 0, 0.3);
}

/* ---------- Language Switcher ---------- */
.lang-switcher {
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(13, 90, 167, 0.15);
  color: #94a3b8;
  transition: all 0.3s ease;
  cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.lang-switcher:focus {
  border-color: #F68D2E;
  outline: none;
}
.lang-switcher option {
  background: #020617;
  color: #e2e8f0;
}

/* ---------- Stats Cards ---------- */
.stat-number {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  background: linear-gradient(135deg, #0D5AA7, #F68D2E);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal-content {
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(13, 90, 167, 0.18);
  border-radius: 1.5rem;
  width: 95%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(13, 90, 167, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}
.modal-content::-webkit-scrollbar { width: 4px; }
.modal-content::-webkit-scrollbar-thumb {
  background: rgba(13, 90, 167, 0.3);
  border-radius: 2px;
}

/* ---------- Calculator Input ---------- */
.calc-input {
  width: 100%;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(13, 90, 167, 0.14);
  color: #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}
.calc-input:focus {
  border-color: #F68D2E;
  box-shadow: 0 0 0 2px rgba(246, 141, 46, 0.08);
  outline: none;
}
.calc-input::placeholder { color: #475569; }

/* ---------- Calculate / Reset Buttons ---------- */
.calc-btn {
  background: linear-gradient(135deg, #0D5AA7, #F68D2E);
  color: #fff; font-weight: 600;
  border: none; border-radius: 0.75rem;
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative; overflow: hidden;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}
.calc-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #F68D2E, #0D5AA7);
  opacity: 0; transition: opacity 0.3s ease;
}
.calc-btn:hover::before { opacity: 1; }
.calc-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(13, 90, 167, 0.25), 0 0 20px rgba(246, 141, 46, 0.15);
}
.calc-btn span { position: relative; z-index: 1; }

.reset-btn {
  background: rgba(13, 90, 167, 0.08);
  border: 1px solid rgba(13, 90, 167, 0.15);
  color: #94a3b8; font-weight: 500;
  border-radius: 0.75rem;
  padding: 0.8rem 1.4rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}
.reset-btn:hover {
  background: rgba(246, 141, 46, 0.08);
  border-color: rgba(246, 141, 46, 0.2);
  color: #F68D2E;
}

/* ---------- Result Display ---------- */
.result-box {
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(13, 90, 167, 0.18);
  border-radius: 1rem;
  padding: 1.25rem;
  animation: fadeSlideUp 0.4s ease;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-value {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  background: linear-gradient(135deg, #5b9fe0, #F68D2E);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Mobile Menu ---------- */
.mobile-menu {
  position: fixed;
  top: 0; right: -100%;
  width: 80%; max-width: 340px;
  height: 100vh;
  background: rgba(2, 6, 23, 0.95);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  border-left: 1px solid rgba(13, 90, 167, 0.12);
  z-index: 201;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.mobile-menu.open { right: 0; }

.mobile-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.mobile-overlay.open { opacity: 1; pointer-events: all; }

/* ---------- Footer ---------- */
.footer-gradient-line {
  height: 2px;
  background: linear-gradient(90deg, transparent, #0D5AA7, #F68D2E, transparent);
}

/* ---------- Hamburger Icon ---------- */
.hamburger-line {
  display: block;
  width: 22px; height: 2px;
  background: #94a3b8;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ---------- Typing Cursor ---------- */
.typing-cursor {
  display: inline-block;
  width: 3px; height: 0.9em;
  background: #F68D2E;
  margin-left: 4px;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  border-radius: 1px;
}
@keyframes blink {
  0%, 50%  { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ---------- No Results ---------- */
.no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: #475569;
}
.no-results-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

/* ---------- Chart Container ---------- */
.chart-container {
  background: rgba(2, 6, 23, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(13, 90, 167, 0.12);
  border-radius: 1rem;
  padding: 1.25rem 1rem;
  animation: fadeSlideUp 0.5s ease;
}

.chart-container canvas {
  max-height: 260px !important;
}

/* ---------- Field Validation ---------- */
.field-error {
  display: block;
  font-size: 0.72rem;
  color: #f87171;
  margin-top: 0.3rem;
  min-height: 0.85rem;
  line-height: 1.2;
  transition: opacity 0.2s ease;
}

.calc-input.invalid {
  border-color: rgba(248, 113, 113, 0.45) !important;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.08);
}

.calc-input.invalid:focus {
  border-color: rgba(248, 113, 113, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.12);
}

/* ---------- Scientific Calculator Keypad ---------- */
.sci-calc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-width: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(13, 90, 167, 0.14);
  border-radius: 0.625rem;
  color: #e2e8f0;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sci-calc-btn:hover {
  background: rgba(13, 90, 167, 0.18);
  border-color: rgba(13, 90, 167, 0.35);
  transform: translateY(-1px);
}
.sci-calc-btn:active {
  transform: scale(0.93);
  transition: transform 0.08s ease;
}
.sci-num-btn {
  background: rgba(13, 30, 55, 0.5);
  border-color: rgba(13, 90, 167, 0.18);
  color: #f1f5f9;
  font-weight: 600;
  font-size: 1rem;
}
.sci-num-btn:hover {
  background: rgba(13, 90, 167, 0.22);
}
.sci-op-btn {
  background: rgba(246, 141, 46, 0.10);
  border-color: rgba(246, 141, 46, 0.22);
  color: #F68D2E;
  font-size: 1.1rem;
  font-weight: 600;
}
.sci-op-btn:hover {
  background: rgba(246, 141, 46, 0.22);
  border-color: rgba(246, 141, 46, 0.4);
}
.sci-fn-btn {
  background: rgba(5, 20, 45, 0.5);
  border-color: rgba(13, 90, 167, 0.12);
  color: #94a3b8;
}
.sci-fn-btn:hover {
  color: #5b9fe0;
  border-color: rgba(13, 90, 167, 0.3);
}
/* Wider modal for Scientific Calculator */
.modal-content.sci-wide {
  max-width: 480px;
}
@media (max-width: 480px) {
  .sci-calc-btn { height: 40px; font-size: 0.8rem; }
  .sci-num-btn  { font-size: 0.9rem; }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .stat-number { font-size: 1.3rem; }
  .floating-symbol { font-size: 1rem; }
  .hero-orb-1 { width: 280px; height: 280px; }
  .hero-orb-2 { width: 220px; height: 220px; }
}

@media (max-width: 480px) {
  .modal-content { border-radius: 1rem; width: 98%; }
  .result-value { font-size: 1.1rem; }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .floating-symbol,
  .hero-orb,
  .glass-card,
  .glass-card::before,
  .card-icon,
  .card-arrow {
    animation: none !important;
    transition: none !important;
  }
  #bg-canvas { display: none; }
}
