/* =============================================
   QUICK CALCULATOR - Global Styles
   Theme: Orange + Black + White
   ============================================= */

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

/* --- CSS Variables --- */
:root {
  --orange: #ff7a00;
  --orange-hover: #ff9a3c;
  --orange-glow: rgba(255, 122, 0, 0.45);
  --orange-light: rgba(255, 122, 0, 0.12);
  --bg-dark: #0f172a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.10);
  --border-orange: rgba(255, 122, 0, 0.40);
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.55);
  --text-dim: rgba(255, 255, 255, 0.30);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-orange: 0 0 24px rgba(255, 122, 0, 0.40);
  --shadow-card: 0 8px 40px rgba(0, 0, 0, 0.50);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-white);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 122, 0, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 90%, rgba(255, 122, 0, 0.08) 0%, transparent 60%);
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: 'Inter', sans-serif;
}

input,
select {
  font-family: 'Inter', sans-serif;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--text-white);
  flex-shrink: 0;
}

.nav-brand span {
  color: var(--orange);
}

.nav-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--orange);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-orange);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text-white);
  background: var(--bg-card-hover);
}

.nav-links a.active {
  color: var(--orange);
  background: var(--orange-light);
  border: 1px solid var(--border-orange);
}

.nav-links a .nav-icon {
  font-size: 1rem;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: var(--transition);
}

.hamburger:hover {
  background: var(--bg-card);
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-white);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Drawer */
.nav-drawer {
  display: none;
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(20px);
  padding: 16px;
  border-bottom: 1px solid var(--border);
  z-index: 999;
  flex-direction: column;
  gap: 4px;
}

.nav-drawer.open {
  display: flex;
}

.nav-drawer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-drawer a:hover {
  color: var(--text-white);
  background: var(--bg-card);
}

.nav-drawer a.active {
  color: var(--orange);
  background: var(--orange-light);
  border: 1px solid var(--border-orange);
}

/* =============================================
   MAIN LAYOUT
   ============================================= */
.main-wrapper {
  min-height: 100vh;
  padding-top: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-hero {
  width: 100%;
  padding: 52px 24px 32px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.2;
}

.page-hero h1 span {
  color: var(--orange);
}

.page-hero p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto;
}

.page-content {
  width: 100%;
  max-width: 960px;
  padding: 0 20px 60px;
}

/* =============================================
   GLASS CARD
   ============================================= */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 32px;
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--border-orange);
  box-shadow: var(--shadow-card), 0 0 32px rgba(255, 122, 0, 0.08);
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-white);
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-group input::placeholder {
  color: var(--text-dim);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--orange);
  background: rgba(255, 122, 0, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.15);
}

.form-group select option {
  background: #1e2a3a;
  color: var(--text-white);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  transition: var(--transition);
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 122, 0, 0.40);
}

.btn-primary:hover {
  background: var(--orange-hover);
  box-shadow: 0 6px 30px rgba(255, 122, 0, 0.60), 0 0 0 2px rgba(255, 122, 0, 0.20);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-white);
  border-color: rgba(255, 255, 255, 0.20);
}

.btn-full {
  width: 100%;
}

/* =============================================
   RESULT BOX
   ============================================= */
.result-box {
  margin-top: 24px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.12) 0%, rgba(255, 122, 0, 0.04) 100%);
  border: 1px solid var(--border-orange);
  border-radius: var(--radius-lg);
  display: none;
}

.result-box.visible {
  display: block;
  animation: fadeSlideUp 0.35s ease;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

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

.result-box .result-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin-bottom: 6px;
}

.result-box .result-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-white);
}

.result-box .result-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.result-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  animation: fadeSlideUp 0.35s ease;
}

.result-item .ri-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--orange);
  margin-bottom: 6px;
}

.result-item .ri-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-white);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.result-item .ri-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =============================================
   ERROR / VALIDATION
   ============================================= */
.error-msg {
  font-size: 0.8rem;
  color: #ff4d6d;
  margin-top: 5px;
  display: none;
}

.error-msg.visible {
  display: block;
}

.input-error {
  border-color: #ff4d6d !important;
}

/* =============================================
   NORMAL / SCIENTIFIC CALCULATOR DISPLAY
   ============================================= */
.calc-shell {
  max-width: 420px;
  margin: 0 auto;
}

.calc-display {
  background: rgba(0, 0, 0, 0.40);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 20px 14px;
  text-align: right;
  margin-bottom: 18px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.calc-display .calc-expression {
  font-size: 0.9rem;
  color: var(--text-dim);
  min-height: 20px;
  word-break: break-all;
  margin-bottom: 4px;
}

.calc-display .calc-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-white);
  word-break: break-all;
  line-height: 1.2;
}

.calc-grid {
  display: grid;
  gap: 10px;
}

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

.calc-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.calc-btn {
  padding: 0;
  height: 56px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.calc-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.15s;
}

.calc-btn:hover::after {
  background: rgba(255, 255, 255, 0.07);
}

.calc-btn:active::after {
  background: rgba(255, 255, 255, 0.14);
}

.cb-num {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white);
}

.cb-op {
  background: rgba(255, 122, 0, 0.18);
  color: var(--orange);
  border: 1px solid rgba(255, 122, 0, 0.25);
}

.cb-fn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.cb-eq {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 4px 18px rgba(255, 122, 0, 0.45);
}

.cb-eq:hover {
  background: var(--orange-hover);
  box-shadow: 0 6px 28px rgba(255, 122, 0, 0.60);
}

.cb-clr {
  background: rgba(255, 77, 109, 0.18);
  color: #ff4d6d;
  border: 1px solid rgba(255, 77, 109, 0.25);
}

.cb-span2 {
  grid-column: span 2;
}

/* =============================================
   PERCENTAGE TABS
   ============================================= */
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 3px 16px rgba(255, 122, 0, 0.40);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* =============================================
   CURRENCY CONVERTER
   ============================================= */
.currency-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: end;
}

.swap-btn {
  height: 48px;
  width: 48px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255, 122, 0, 0.40);
  transition: var(--transition);
  flex-shrink: 0;
  margin-bottom: 0;
}

.swap-btn:hover {
  background: var(--orange-hover);
  transform: rotate(180deg);
  box-shadow: 0 6px 24px rgba(255, 122, 0, 0.60);
}

/* =============================================
   AGE CALCULATOR
   ============================================= */
.age-timeline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.age-pill {
  padding: 10px 20px;
  background: rgba(255, 122, 0, 0.12);
  border: 1px solid var(--border-orange);
  border-radius: 50px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-white);
  animation: fadeSlideUp 0.35s ease;
}

.age-pill span {
  color: var(--orange);
}

/* =============================================
   CALORIE CALCULATOR
   ============================================= */
.gender-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.gender-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.gender-btn.active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
  box-shadow: 0 3px 14px rgba(255, 122, 0, 0.40);
}

.activity-select {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-white);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.activity-select:focus {
  outline: none;
  border-color: var(--orange);
  background: rgba(255, 122, 0, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.15);
}

.activity-select option {
  background: #1e2a3a;
}

/* =============================================
   CALORIE BAR
   ============================================= */
.calorie-bar-wrap {
  margin-top: 20px;
}

.calorie-bar-wrap .bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.calorie-bar {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  overflow: hidden;
}

.calorie-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-hover));
  border-radius: 50px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(255, 122, 0, 0.50);
}

/* =============================================
   HOME PAGE CARDS
   ============================================= */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  padding: 0 20px 60px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
}

.home-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.home-card:hover {
  border-color: var(--border-orange);
  transform: translateY(-5px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.40), var(--shadow-orange);
}

.home-card:hover::before {
  opacity: 1;
}

.home-card .hc-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(255, 122, 0, 0.50));
}

.home-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.home-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.home-card .hc-arrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 14px;
  transition: var(--transition);
}

.home-card:hover .hc-arrow {
  gap: 10px;
}

/* =============================================
   DIVIDER / SECTION TITLE
   ============================================= */
.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  margin-bottom: 8px;
}

/* =============================================
   FOOTER
   ============================================= */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

footer span {
  color: var(--orange);
}

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-orange);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--orange);
}

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

  .hamburger {
    display: flex;
  }

  .glass-card {
    padding: 22px 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .currency-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .swap-btn {
    transform: rotate(90deg);
  }

  .swap-btn:hover {
    transform: rotate(270deg);
  }

  .calc-btn {
    height: 50px;
    font-size: 0.95rem;
  }

  .calc-display .calc-value {
    font-size: 2rem;
  }

  .page-hero {
    padding: 36px 16px 24px;
  }

  .result-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .result-item {
    padding: 12px 8px;
  }

  .result-item .ri-value {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 12px 40px;
  }

  .home-card {
    padding: 18px 12px;
  }

  .home-card .hc-icon {
    font-size: 2.2rem;
  }

  .home-card h3 {
    font-size: 0.9rem;
  }

  .home-card p {
    display: none;
  }

  .home-card .hc-arrow {
    font-size: 0.75rem;
    margin-top: 8px;
  }

  .calc-grid-5 {
    grid-template-columns: repeat(4, 1fr);
  }

  .page-content {
    padding: 0 12px 40px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-item .ri-value {
    font-size: 1.5rem;
  }
}