@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #0f111a;
  --bg-gradient: radial-gradient(circle at top right, #2a1b41, #0f111a 60%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --primary: #9b51e0;
  --secondary: #ff3366;
  --accent: #00e5ff;
  
  --text-main: #f8f9fa;
  --text-muted: #adb5bd;
  
  --font-family: 'Outfit', sans-serif;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 8px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Blurs */
.blob {
  position: fixed;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.5;
  border-radius: 50%;
  animation: float 20s infinite ease-in-out;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 40vw;
  height: 40vw;
  background: var(--primary);
  animation-delay: 0s;
}

.blob-2 {
  bottom: -20%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: var(--secondary);
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 60%;
  width: 30vw;
  height: 30vw;
  background: var(--accent);
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
}

h1.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Header/Nav */
header {
  padding: 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

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

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background: var(--accent);
  transition: var(--transition);
}

.nav-links a:hover::after, .nav-links a.active::after {
  width: 100%;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--glass-shadow);
  padding: 2rem;
  transition: var(--transition);
}

.glass-panel:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(155, 81, 224, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(155, 81, 224, 0.5);
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  backdrop-filter: blur(10px);
}

.btn-outline:hover {
  background: var(--glass-bg);
  border-color: var(--text-main);
}

/* Calculator Grid Setup */
.calc-container {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.calc-display {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: right;
  border: 1px inset rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

.calc-display .prev-operand {
  color: var(--text-muted);
  font-size: 1.1rem;
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
}

.calc-display .current-operand {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  word-wrap: break-word;
  word-break: break-all;
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.calc-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  padding: 1rem 0;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.calc-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

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

.calc-btn.operator {
  color: var(--accent);
  background: rgba(0, 229, 255, 0.05);
  border-color: rgba(0, 229, 255, 0.1);
}

.calc-btn.operator:hover {
  background: rgba(0, 229, 255, 0.15);
}

.calc-btn.equals {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
}

.calc-btn.equals:hover {
  box-shadow: 0 6px 20px rgba(255, 51, 102, 0.5);
  background: linear-gradient(135deg, #a865f0, #ff4c79);
}

.calc-btn.clear {
  color: var(--secondary);
}

/* Footer */
footer {
  margin-top: auto;
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--glass-border);
}

/* Animations */
.fade-in-up {
  animation: fadeInUp 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: block !important;
  }

  .mobile-nav.active {
    display: flex !important;
  }
  
  .container {
    padding: 1.5rem;
  }
  
  .calc-buttons {
    gap: 0.75rem;
  }
  
  .calc-btn {
    padding: 0.75rem 0;
  }
}
