:root {
  --candy-red:#ffabab;
  --sky-blue:#249e96;
  --sunny-yellow:#fcd124;
  --soft-pink:#FFB6C1;
  --mint-green:#9af89a;
  --lavender:#E6E6FA;
  --dark-bg:#1a1a1a;
  --dark-card:#2d2d2d;
  --dark-text:#e7e3e3;
  --dark-border:#404040;
  --white:#FFFFFF;
  --dark-gray:#1A1A1A;
  --light-gray:#F8F9FA;
  --shadow:0 8px 32px rgba(0,0,0,0.1);
  --glass:rgba(255,255,255,0.15);
}

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

body {
  font-family: 'Comic Neue', cursive;
  background-color:#f5f3f1;
  min-height:100vh;
  color:#1a1a1a;
  transition:all .3s ease;
}
body.dark-mode { background-color:#0d0d0d; color:#e7e3e3; }

/* ===== NAVBAR ===== */
.navbar {
  background: radial-gradient(circle at center, #e5c5b3, #e9b4b6);
  backdrop-filter: blur(15px);
  padding: 1rem 2rem;
  position: fixed; top: 0; width: 100%; z-index: 1000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.2);
  transition: all .3s ease;
}
body.dark-mode .navbar { background:#1e1e1e !important; border-bottom:1px solid rgba(255,255,255,0.1) !important; }

.nav-container { display:flex; justify-content:space-between; align-items:center; max-width:1500px; margin:0 auto; }
.logo { font-size:2rem; font-weight:600; color:#3e2723; text-decoration:none; display:flex; align-items:center; gap:.5rem; min-width:150px; padding-right:50px; }
.logo-icon { font-size:2rem; transition: transform .3s ease; }
.logo:hover { transform: scale(1.05); }
.logo:hover .logo-icon { transform: rotate(10deg); }
body.dark-mode .logo { color:#e0e0e0; }

.nav-links { display:flex; list-style:none; gap:1.5rem; align-items:center; }
.nav-links a {
  text-decoration: none;
  color: #3e2723;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.7rem 1rem;
  border-radius: 25px;
  transition: all 0.3s ease;
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
}

body.dark-mode .nav-links a {
  color: #e0e0e0 !important;
  background: rgba(111, 100, 91, 0.133) !important;
  border: 2px solid transparent !important;
}

.nav-links a:hover {
  background-color: #f3e0d6;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border-color: rgba(228, 191, 180, 0.3);
  color: #3e2723;
}

body.dark-mode .nav-links a:hover {
  background-color: #0d0d0d !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border-color: #1e1e1e !important;
  color: #e0e0e0 !important;
}

/* Active navigation link styles */
.nav-links a.active {
  background: linear-gradient(90deg, #3e2723, #573730, #3e2723)  !important;
  color: #ffffff !important;
  border-color: #1e1e1e !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
body.dark-mode .nav-links a.active {
  background-color: #0d0d0d !important;
  color: #ffffff !important;
  border-color: #1e1e1e !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-actions { display:flex; align-items:center; gap:1rem; }
.dark-mode-btn {
  background:linear-gradient(135deg, #3e2723, #4d312b);
  border:none;
  color:white;
  padding:.7rem;
  border-radius:50%;
  cursor:pointer;
  transition:all .4s cubic-bezier(0.4, 0, 0.2, 1);
  font-size:1rem;
  width:45px;
  height:45px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 4px 15px rgba(0,0,0,0.2);
  position:relative;
  overflow:hidden;
}
.dark-mode-btn::before{
  content:'';
  position:absolute;
  top:50%;
  left:50%;
  width:0;
  height:0;
  background:rgba(255,255,255,0.2);
  border-radius:50%;
  transition:all .4s ease;
  transform:translate(-50%, -50%);
}
.dark-mode-btn:hover::before{width:100%; height:100%}
.dark-mode-btn:hover { 
  transform:scale(1.15) rotate(360deg); 
  box-shadow:0 8px 25px rgba(0,0,0,0.3), 0 4px 12px rgba(62,39,35,0.2);
  background:linear-gradient(135deg, #4d312b, #3e2723);
}
body.dark-mode .dark-mode-btn { 
  background:linear-gradient(135deg, #e0e0e0, #d0d0d0); 
  color:#1e1e1e;
  box-shadow:0 4px 15px rgba(224,224,224,0.2);
}
body.dark-mode .dark-mode-btn:hover{
  background:linear-gradient(135deg, #f0f0f0, #e0e0e0);
  box-shadow:0 8px 25px rgba(224,224,224,0.3), 0 4px 12px rgba(30,30,30,0.2);
}

.hamburger { display:none; flex-direction:column; cursor:pointer; padding:.5rem; border-radius:8px; transition:all .3s ease; }
.hamburger:hover { background: rgba(255,255,255,0.1); }
.hamburger span { width:25px; height:3px; background:linear-gradient(45deg,#a4766a,#5d4037); margin:3px 0; transition:.3s; border-radius:2px; }
body.dark-mode .hamburger span { background:#e0e0e0; }
.hamburger.active span:nth-child(1){ transform:rotate(-45deg) translate(-5px, 6px); }
.hamburger.active span:nth-child(2){ opacity:0; }
.hamburger.active span:nth-child(3){ transform:rotate(45deg) translate(-5px, -6px); }

/* Mobile nav */
@media (max-width:1242px) {
  .navbar { padding:.8rem 1rem; }
  .nav-links{
    display:flex; position:fixed; top:0; left:0; width:100%; height:100vh; background:#1a1a1a;
    flex-direction:column; justify-content:flex-start; align-items:center; padding-top:6rem;
    transition:transform .3s ease; transform:translateX(-100%); gap:0; z-index:999;
  }
  .nav-links.active { transform:translateX(0); }
  .nav-actions{gap:.5rem; z-index:1001; position: absolute; right:5rem;}
  .nav-links li { width:90%; border-bottom:1px solid rgba(255,255,255,0.1); }
  .nav-links a { 
    width:100%; padding:1.5rem 2rem; font-size:1.2rem; background:#2a2a2a !important; 
    color:#e0e0e0 !important; border-radius:0; display:flex; gap:1rem; 
    transition:all .3s ease;
  }
  .nav-links a:hover { 
    background:#3a3a3a !important; 
    color:#ffffff !important;
  }

  /* Mobile navigation active state */
  .nav-links a.active {
    background: #0d0d0d !important;
    color: #ffffff !important;
  }
  .hamburger { display:flex; position:relative; z-index:1001; }
  .logo { font-size:1.5rem; }
  .logo-icon { font-size:1.7rem; }
}
@media (max-width:480px) {
  .navbar { padding:.5rem; }
  .logo { font-size:1.3rem; }
  .logo-icon { font-size:1.5rem; }
  .nav-actions { gap:.3rem; }
  .dark-mode-btn { width:35px; height:35px; font-size:.8rem; }
}

/* ===== MAIN ===== */
main { padding:6rem 2rem 2rem; max-width:1200px; margin:0 auto; }
.page-header { text-align:center; margin-bottom:3rem; }
.page-title { font-size:clamp(2rem, 6vw, 3rem); font-weight:700; margin-bottom:1rem; color:#3e2723; animation:bounce 2s ease-in-out infinite; }
body.dark-mode .page-title{ color:#e0e0e0 !important; }
.page-subtitle { font-size:1.2rem; color:#6b6767; opacity:.9; margin-bottom:2rem; }
body.dark-mode .page-subtitle{ color:#e0e0e0 !important; }

@keyframes bounce {
  0%,20%,50%,80%,100% { transform:translateY(0);}
  40% { transform:translateY(-10px);}
  60% { transform:translateY(-5px);}
}

.converter-container { display:grid; grid-template-columns:1fr; gap:2rem; max-width:800px; margin:0 auto; }

.input-section,
.results-section {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 2rem;
  border: 1px solid rgba(255,255,255,0.2);
}
.results-section { display:none; }
body.dark-mode .input-section,
body.dark-mode .results-section {
  background: linear-gradient(135deg, #050505, #0d1731);
  border: 1px solid var(--dark-border) !important; 
  backdrop-filter: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); 
}

.input-group { margin-bottom:1.5rem; }
.input-label { display:block; font-size:1.1rem; font-weight:600; margin-bottom:.5rem; color:#3e2723; }
body.dark-mode .input-label { color:#e0e0e0 }

.recipe-input {
  width:100%;
  min-height:200px;
  padding:1rem;
  border:none;
  border-radius:15px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  color: #222; /* Dark text for light mode */
  font-family:'Comic Neue', cursive;
  font-size:1rem;
  resize:vertical;
  border:2px solid #6b6767;
  transition:all .3s ease;
}
.recipe-input:focus {
  outline:none;
  border-color:#3e2723;
  box-shadow:0 0 2px rgba(255,165,2,0.3);
}
body.dark-mode .recipe-input {
  background: rgba(255,255,255,0.08);
  color: #fff; /* White text for dark mode */
}
body.dark-mode .recipe-input:focus {
  border-color:#0d0d0d;
  box-shadow:0 0 2px #0d0d0d;
}

.file-upload { display:none; }
.file-upload-label {
  display:inline-block;
  padding:1rem 2rem;
  background:linear-gradient(90deg,#3e2723,#6e463e,#3e2723);
  color:white;
  border-radius:25px;
  cursor:pointer;
  transition:all .3s ease;
  font-weight:600;
  margin-right:1rem;
}
.file-upload-label:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
body.dark-mode .file-upload-label { background: rgba(220,121,63,0.893); color:#e0e0e0; }

.convert-button {
  width:100%;
  padding:1.5rem;
  background:linear-gradient(90deg,#3e2723,#6e463e,#3e2723);
  color:white;
  border:none;
  border-radius:25px;
  font-size:1.3rem;
  font-weight:700;
  cursor:pointer;
  transition:all .3s ease;
  position:relative;
  overflow:hidden;
  margin-top:1rem;
}
.convert-button:hover { transform: translateY(-3px); box-shadow:0 15px 40px rgba(0,0,0,0.2); }
.convert-button:disabled { opacity:.6; cursor:not-allowed; transform:none; }
body.dark-mode .convert-button { background: rgba(220,121,63,0.893); color:#e0e0e0; }

.loading-spinner{
  display:none;
  width:20px;
  height:20px;
  border:2px solid transparent;
  border-top:2px solid #fff;
  border-radius:50%;
  animation:spin 1s linear infinite;
  margin-right:10px;
}
@keyframes spin { to{ transform:rotate(360deg);} }

.results-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:2rem;
}
.results-title { font-size:1.5rem; font-weight:700; }
.unit-toggle {
  display:flex;
  background:rgba(255,255,255,0.1);
  border-radius:25px;
  padding:.2rem;
}
.unit-toggle button {
  padding:.5rem 1rem;
  border:none;
  background:transparent;
  color:#333;
  border-radius:20px;
  cursor:pointer;
  transition:all .3s ease;
  font-family:'Comic Neue', cursive;
  font-weight:600;
}
.unit-toggle button.active { background: var(--sunny-yellow); color: var(--dark-gray); }

.results-table {
  width:100%;
  border-collapse:collapse;
  margin-top:1rem;
}
.results-table th,
.results-table td {
  padding:1rem;
  text-align:left;
  border-bottom:1px solid rgba(0,0,0,0.06);
}
.results-table th {
  background:rgba(255,255,255,0.1);
  font-weight:700;
  color:#3e2723;
}
body.dark-mode .results-table th {
  color:var(--sunny-yellow);
  border-bottom:1px solid rgba(255,255,255,0.1);
}
body.dark-mode .results-table td { border-bottom:1px solid rgba(255,255,255,0.06); }

.ingredient-row { transition: all .3s ease; }
.ingredient-row:hover { background: rgba(0,0,0,0.03); }
body.dark-mode .ingredient-row:hover { background: rgba(255,255,255,0.05); }

.ingredient-icon { font-size:1.5rem; margin-right:.5rem; }

.tooltip {
  position:relative;
  cursor:help;
}
.tooltip::after {
  content: attr(data-tooltip);
  position:absolute;
  bottom:125%;
  left:50%;
  transform:translateX(-50%);
  background: var(--dark-gray);
  color: var(--white);
  padding:.5rem;
  border-radius:8px;
  font-size:.8rem;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition: opacity .3s;
  z-index:1001;
}
.tooltip:hover::after { opacity:1; }

/* Warning popup */
.warning-popup {
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  background:rgba(255,71,87,0.95);
  backdrop-filter: blur(20px);
  padding:2rem;
  border-radius:20px;
  border:2px solid var(--candy-red);
  z-index:1002;
  display:none;
  max-width:400px;
  text-align:center;
  color:#fff;
}
.warning-popup h3 { margin-bottom:1rem; font-size:1.3rem; }
.warning-popup button {
  padding:.8rem 1.5rem;
  background:#fff;
  color:var(--candy-red);
  border:none;
  border-radius:15px;
  font-weight:600;
  cursor:pointer;
  margin:.5rem;
  transition:all .3s ease;
}
.warning-popup button:hover { transform: translateY(-2px); }

.overlay {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
  z-index:1001;
  display:none;
}

/* Floating emojis */
.floating-elements {
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:1;
}
.floating-cupcake {
  position:absolute;
  font-size:2rem;
  animation: float 6s ease-in-out infinite;
}
.floating-cupcake:nth-child(1){ top:10%; left:10%; animation-delay:0s;}
.floating-cupcake:nth-child(2){ top:20%; right:15%; animation-delay:2s;}
.floating-cupcake:nth-child(3){ bottom:20%; left:20%; animation-delay:4s;}
.floating-cupcake:nth-child(4){ bottom:30%; right:10%; animation-delay:1s;}
@keyframes float {
  0%,100% { transform:translateY(0) rotate(0deg);}
  50% { transform:translateY(-20px) rotate(5deg);}
}

/* Back to Top Button Styles */
#backToTop {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  z-index: 2000;
  background: linear-gradient(45deg, #a4766a, #5d4037);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.2s;
}

body.dark-mode #backToTop {
  background: #e0e0e0;
  color: #0d0d0d;
}

#backToTop.show {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1.08);
}

#backToTop:hover {
  background: linear-gradient(45deg, #a4766a, #5d4037);
  transform: scale(1.15);
}

/* Back to Top to Bottom Button Styles */
#Toptoback {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  z-index: 2000;
  background: linear-gradient(45deg, #a4766a, #5d4037);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.2s;
}

body.dark-mode #Toptoback {
  background: #e0e0e0;
  color: #0d0d0d;
}

#Toptoback.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-10px) scale(1.08);
}

#Toptoback:hover {
  background: linear-gradient(45deg, #a4766a, #5d4037);
  transform: scale(1.15);
}

body.dark-mode #Toptoback:hover {
  background: #e0e0e0;
  transform: scale(1.15);
}

/*badges*/
.footer-badges {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
}
.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.badge-green {
  background: linear-gradient(90deg, #3e2723, #6e463e, #3e2723);
}

.badge-blue {
  background: linear-gradient(90deg, #3e2723, #6e463e, #3e2723);
}

.badge-purple {
  background: linear-gradient(90deg, #3e2723, #6e463e, #3e2723);
}
body.dark-mode .badge-green {
  background: #e0e0e0;
  color: #0d0d0d;
}

body.dark-mode .badge-blue {
  background: #e0e0e0;
  color: #0d0d0d;
}

body.dark-mode .badge-purple {
  background: #e0e0e0;
  color: #0d0d0d;
}

/* ===== FOOTER ===== */
.footer {
  background: radial-gradient(circle at center, #e9b4b6, #e5c5b3);
  backdrop-filter: blur(15px);
  position:relative;
  z-index:2;
  border-top:1px solid rgba(255,255,255,0.3);
  margin-top:4rem;
}
body.dark-mode .footer {
  background:#1e1e1e;
}
.footer-content {
  max-width:1500px;
  margin:0 auto;
  display:grid;
  grid-template-columns:2fr 1fr 1fr 1fr;
  gap:3rem;
  padding:3rem 2rem 2rem;
}
.footer-section h3.footer-title {
  color:#3e2723;
  font-size:1.2rem;
  font-weight:700;
  margin-bottom:1.5rem;
  position:relative;
}
.footer-section h3.footer-title::after {
  content:'';
  position:absolute;
  bottom:-8px;
  left:0;
  width:30px;
  height:3px;
  background:#3e2723;
  border-radius:2px;
}
body.dark-mode .footer-section h3.footer-title::after {
  background:#e0e0e0;
}
.footer-logo {
  display:flex;
  align-items:center;
  gap:.8rem;
  margin-bottom:1.5rem;
  font-size:1.8rem;
  font-weight:700;
  color:#3e2723;
}
.footer-logo-icon { font-size:2rem; }
.footer-description {
  color:#333;
  line-height:1.6;
  margin-bottom:2rem;
  font-size:.95rem;
}
.footer-links { list-style:none; padding:0; margin:0; }
.footer-links li { margin-bottom:.8rem; }
.footer-links a {
  color:#333;
  text-decoration:none;
  display:flex;
  align-items:center;
  gap:.8rem;
  font-weight:500;
  transition:all .3s ease;
  padding:.3rem 0;
  border-radius:5px;
}
.footer-links a:hover {
  color:black;
  transform:translateX(4px);
  background:rgba(255,107,107,0.1);
  padding-left:.8rem;
}
.footer-links i {
  font-size:.9rem;
  width:16px;
  opacity:.7;
}
.social-links {
  display:flex;
  gap:1rem;
  margin-top:1rem;
}
.social-link {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:45px;
  height:45px;
  background:linear-gradient(90deg,#3e2723,#6e463e,#3e2723);
  color:white;
  text-decoration:none;
  border-radius:50%;
  font-size:1.2rem;
  transition:all .3s ease;
  box-shadow:0 4px 15px rgba(0,0,0,0.2);
}
.social-link:hover {
  transform:translateY(-3px) scale(1.1);
  box-shadow:0 8px 25px rgba(0,0,0,0.3);
}

.footer-bottom {
  background:rgba(0,0,0,0.05);
  backdrop-filter:blur(10px);
  border-top:1px solid rgba(255,255,255,0.1);
  padding:1.5rem 0;
}
.footer-bottom-content {
  max-width:1500px;
  margin:0 auto;
  padding:0 2rem;
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:1rem;
}
.copyright {
  color:#333;
  font-size:.9rem;
  margin:0;
}
.copyright .name {
  color:#3e2723;
  font-weight:600;
}

/*dark mode*/
body.dark-mode .footer {
  background: #1e1e1e;
}
body.dark-mode .footer-section h3.footer-title {
  color: #e0e0e0;
}
body.dark-mode .footer-logo {
  color: #e0e0e0;
}
body.dark-mode .footer-description {
  color: #a0a0a0;
}
body.dark-mode .footer-links a {
  color: #a0a0a0;
}
body.dark-mode .footer-links a:hover {
  color: #a0a0a0;
  background: rgba(255, 138, 128, 0.1);
}
body.dark-mode .footer-bottom {
  background: #1e1e1e;
}
body.dark-mode .copyright {
  color: #a0a0a0;
}
body.dark-mode .copyright .name {
  color: #ef6154;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
@media (max-width:1024px){
  .footer-content{ grid-template-columns:1fr 1fr; gap:2rem; }
}
@media (max-width:768px){
  .footer-content{ grid-template-columns:1fr; gap:2rem; text-align:center; }
  .footer-bottom-content{ flex-direction:column; text-align:center; gap:1rem; }
  .social-links{ justify-content:center; }
}
