/* =========================================
   Variables & Reset
   ========================================= */
:root {
  --primary-color: #4facfe;
  --secondary-color: #00f2fe;
  --bg-dark: #0f172a;
  --bg-light: #f8fafc;
  --text-dark: #e2e8f0;
  --text-light: #1e293b;
  --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);
  --font-heading: "Poppins", sans-serif;
  --font-body: "Inter", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-body);
}

body {
  background-color: var(--bg-dark);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition:
    background-color 0.5s ease,
    color 0.5s ease;
  position: relative;
}

body.light {
  background-color: var(--bg-light);
  color: var(--text-light);
}

/* =========================================
     Background Orbs (Decoration)
     ========================================= */
.background-orb {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    rgba(79, 172, 254, 0.15) 0%,
    rgba(0, 0, 0, 0) 70%
  );
  top: -200px;
  left: -200px;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  animation: float 10s ease-in-out infinite;
}

.orb-2 {
  top: auto;
  bottom: -200px;
  left: auto;
  right: -200px;
  background: radial-gradient(
    circle,
    rgba(0, 242, 254, 0.15) 0%,
    rgba(0, 0, 0, 0) 70%
  );
  animation: float 12s ease-in-out infinite reverse;
}

@keyframes float {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(30px, 50px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* Cursor Glow */
.cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(79, 172, 254, 0.4) 0%, rgba(0,0,0,0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  opacity: 0.8;
  transition: opacity 0.3s;
}

body.light .cursor-glow {
  background: radial-gradient(circle, rgba(0, 166, 255, 0.3) 0%, rgba(255,255,255,0) 70%);
  mix-blend-mode: multiply;
}

/* =========================================
     Header
     ========================================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  z-index: 10;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: -0.5px;
}

.logo .dot {
  color: var(--primary-color);
}

/* Theme Toggle */
.theme-switch {
  display: inline-block;
  width: 60px;
  height: 30px;
  position: relative;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: 0.4s;
  border-radius: 34px;
  border: 1px solid var(--glass-border);
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 3px;
  background-color: var(--primary-color);
  transition: 0.4s;
  border-radius: 50%;
}

body.light .slider {
  background-color: #cbd5e1;
  border-color: #94a3b8;
}

input:checked + .slider:before {
  transform: translateX(28px);
  background-color: #f59e0b; /* Sun color */
}

/* =========================================
     Main Container & Glass Card
     ========================================= */
.container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 500px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.glass-card:hover {
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

body.light .glass-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Card Header */
.card-header {
  margin-bottom: 30px;
  text-align: center;
}

.card-header h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2rem;
  margin-bottom: 5px;
  background: linear-gradient(
    135deg,
    var(--secondary-color),
    var(--primary-color)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card-header p {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Input Group */
.input-group {
  margin-bottom: 25px;
}

.input-group label,
.select-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.9;
}

input[type="number"],
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
}

body.light input[type="number"],
body.light select {
  background: #fff;
  border-color: #cbd5e1;
  color: #334155;
}

input:focus,
select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

/* Unit Selection Row */
.unit-row {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  margin-bottom: 30px;
}

.select-group {
  flex: 1;
}

.arrow-icon {
  padding-bottom: 12px;
  font-size: 1.2rem;
  color: var(--primary-color);
  opacity: 0.8;
}

/* Actions */
.convert-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition:
    transform 0.2s,
    filter 0.2s;
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.convert-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.convert-btn:active {
  transform: translateY(0);
}

/* Result Area */
.result-area {
  margin-top: 30px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  text-align: center;
  border: 1px solid var(--glass-border);
}

body.light .result-area {
  background: #f1f5f9;
  border-color: transparent;
}

.result-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
  margin-bottom: 5px;
}

.result-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 600;
}

/* History Section */
.history-section {
  margin-top: 30px;
  border-top: 1px solid var(--glass-border);
  padding-top: 20px;
}

body.light .history-section {
  border-color: #e2e8f0;
}

.history-section h3 {
  font-size: 1rem;
  margin-bottom: 15px;
  font-weight: 600;
}

.history-list {
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-list div {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  display: flex;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
}

body.light .history-list div {
  background: rgba(0, 0, 0, 0.03);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
body.light ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .glass-card {
    padding: 25px;
  }

  .logo {
    font-size: 1.4rem;
  }

  .unit-row {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .arrow-icon {
    text-align: center;
    padding: 0;
    transform: rotate(90deg);
  }
}
