/* ═══════════════════════════════════════════════════════
   NeoCalculator.net — Industry Standard Premium CSS
   ═══════════════════════════════════════════════════════ */

:root {
  /* Light Mode */
  --bg-dark:      #f8fafc;
  --bg-card:      #ffffff;
  --bg-input:     #f1f5f9;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --text-light:   #0f172a;
  --text-muted:   #475569;
  --border:       #e2e8f0;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --radius:       12px;
  --transition:   all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --formula-bg:   #f0f9ff;
  --formula-text: #0369a1;
}

body.dark-theme {
  /* Dark Mode */
  --bg-dark:    #0f172a;
  --bg-card:    #1e293b;
  --bg-input:   #0f172a;
  --accent:     #3b82f6;
  --accent-hover: #2563eb;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --border:     #334155;
  --formula-bg: #1e1b4b;
  --formula-text: #38bdf8;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-light);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  transition: var(--transition);
  line-height: 1.6;
}

/* ── HEADER ────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

header h1 span {
  color: var(--text-light);
  font-weight: 400;
}

/* Nav Bar & Theme Toggle Alignment */
nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

nav a:hover, 
nav a.nav-active {
  color: var(--accent) !important;
  font-weight: 600;
}

.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  margin-left: 6px;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* Mobile Hamburger Toggle Button */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}

.hamburger-bar {
  width: 24px;
  height: 2.5px;
  background-color: var(--text-light);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── DROPDOWN SUBMENU STYLES ───────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dropdown-toggle .arrow {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.dropdown:hover .dropdown-toggle .arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  list-style: none;
  padding: 6px 0;
  margin: 0;
  z-index: 1000;
  transition: var(--transition);
}

.dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 10px;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu li a {
  display: block;
  padding: 10px 16px;
  color: var(--text-light);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-menu li a:hover {
  background-color: var(--bg-input);
  color: var(--accent) !important;
}

/* ── CONTAINER ──────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.content-page {
  padding: 30px 15px !important;
}

.content-page h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 24px;
}

.content-page h3 {
  font-size: 1.3rem;
  margin-top: 30px;
  margin-bottom: 12px;
}

.content-page p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.content-page ul {
  margin-bottom: 20px;
  padding-left: 20px;
  color: var(--text-muted);
}

.content-page li {
  margin-bottom: 8px;
}

/* ── SHARED HOW TO USE & FAQ SECTION ────────── */

.calculator-how-to {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  margin-top: 30px;
  margin-bottom: 30px;
}

.calculator-how-to h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text-light);
}

.calculator-how-to p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.faq-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 40px;
}

.faq-section h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-light);
  margin-bottom: 20px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: var(--transition);
}

.faq-item:last-child {
  margin-bottom: 0;
}

.faq-question {
  width: 100%;
  background: var(--bg-card);
  border: none;
  outline: none;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease;
}

.faq-question:hover {
  background: var(--bg-input);
}

.faq-icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
  color: var(--accent);
  flex-shrink: 0;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out, padding 0.3s ease;
  background: var(--bg-card);
  padding: 0 20px;
}

.faq-answer p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

@media (max-width: 600px) {
  .calculator-how-to,
  .faq-section {
    padding: 20px 16px;
  }

  .calculator-how-to h2 {
    font-size: 1.35rem;
  }

  .faq-section h3 {
    font-size: 1.25rem;
  }

  .faq-question {
    padding: 14px 15px;
    font-size: 0.92rem;
  }

  .faq-answer {
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* ── HERO & CARDS ───────────────────────────── */
.hero {
  text-align: center;
  padding: 50px 0 30px;
}

.hero h2 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-light);
  margin-bottom: 12px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* ── FOOTER ──────────────────────────────────── */
footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 30px 20px;
  margin-top: 60px;
  width: 100%;
  transition: var(--transition);
}

footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 5px;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--accent) !important;
}

.footer-brand-link {
  color: var(--accent) !important;
  font-weight: 700;
  text-decoration: none;
}

.footer-brand-link:hover {
  text-decoration: underline;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ── FORM & MODE STYLES ─────────────────────── */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 30px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.mode-tab {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.mode-tab:hover,
.mode-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row span {
  color: var(--text-light);
  font-weight: 500;
  font-size: 0.95rem;
}

input[type="number"],
input[type="text"],
input[type="email"],
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 1rem;
  transition: var(--transition);
}

input[type="number"] {
  width: 120px;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.btn:hover {
  background: var(--accent-hover);
}

.result-box {
  margin-top: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
}

.result-score {
  font-size: 2.5rem;
  font-weight: 800;
}

.result-label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 4px;
}

.result-letter {
  font-size: 3.5rem;
  font-weight: 900;
  opacity: 0.5;
}

.result-body {
  padding: 20px 24px;
  background: rgba(0,0,0,0.05);
}

body.dark-theme .result-body {
  background: rgba(0, 0, 0, 0.2);
}

.result-message {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.how-it-works {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 24px;
}

.formula-display {
  background: var(--formula-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--formula-text);
  text-align: center;
  margin: 16px 0;
}

.error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--danger);
  margin-top: 16px;
  font-weight: 500;
}

.grade-a         { background: linear-gradient(135deg, #059669, #10b981); color: white; }
.grade-b         { background: linear-gradient(135deg, #2563eb, #3b82f6); color: white; }
.grade-c         { background: linear-gradient(135deg, #d97706, #f59e0b); color: white; }
.grade-d         { background: linear-gradient(135deg, #ea580c, #f97316); color: white; }
.grade-f         { background: linear-gradient(135deg, #dc2626, #ef4444); color: white; }
.grade-impossible{ background: linear-gradient(135deg, #7f1d1d, #b91c1c); color: #fca5a5; }
.grade-already   { background: linear-gradient(135deg, #065f46, #059669); color: #a7f3d0; }

/* Advanced Mode */
.advanced-tip{
    background:var(--bg-input);
    border:1px solid var(--border);
    border-left:4px solid var(--accent);
    padding:16px;
    border-radius:10px;
    margin-bottom:18px;
    color:var(--text-muted);
    font-size:.9rem;
    line-height:1.7;
}

.weight-counter{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:14px 18px;
    margin-bottom:18px;
    background:var(--bg-input);
    border:1px solid var(--border);
    border-radius:10px;
    font-weight:700;
}

.weight-counter.exact{ border-color:#22c55e; color:#16a34a; }
.weight-counter.over{ border-color:#ef4444; color:#dc2626; }

.adv-category-row{
    position:relative;
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:12px;
    padding:22px;
    margin-bottom:18px;
}

.cat-header{
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:20px;
    flex-wrap:wrap;
}

.cat-header input[type=text]{ flex:1; min-width:220px; }
.cat-header .weight-input{ width:80px; }

.adv-fields-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:18px;
}

.btn-remove-cat{
    position:absolute;
    top:14px;
    right:14px;
    background:none;
    border:none;
    color:#64748b;
    cursor:pointer;
    font-size:18px;
}

.btn-remove-cat:hover{ color:#ef4444; }

.btn-add-cat{
    width:100%;
    background:transparent;
    border:1px dashed var(--accent);
    color:var(--accent);
    padding:12px;
    border-radius:10px;
    cursor:pointer;
    margin:5px 0 25px;
    font-weight:600;
}

.btn-add-cat:hover{ background:var(--bg-input); }

.adv-final-section{
    border-top:2px dashed var(--border);
    margin-top:20px;
    padding-top:22px;
}

.adv-final-section h4{
    margin-bottom:18px;
    color:var(--text-light);
    font-size:1.15rem;
}

/* ═══════════════════════════════════════════════════════
   MOBILE RESPONSIVE NAVIGATION & LAYOUT ADJUSTMENTS
   ═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }

  .header-main {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  header h1 {
    font-size: 1.25rem;
  }

  .menu-toggle {
    display: flex; /* Mobile par 3-line hamburger button dikhega */
  }

  nav#mainNav {
    display: none; /* Mobile par mainNav initial hidden rahega */
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    gap: 12px;
  }

  nav#mainNav.mobile-open {
    display: flex; /* Hamburger click par open hoga */
  }

  nav#mainNav a.nav-link {
    font-size: 1rem;
    padding: 6px 0;
    text-align: center;
    width: 100%;
  }

  .theme-toggle {
    margin-left: 0;
    margin-top: 4px;
    width: fit-content;
  }

  .dropdown {
    width: 100%;
    text-align: center;
  }

  .dropdown-toggle {
    justify-content: center;
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: 1px solid var(--border);
    background-color: var(--bg-input);
    margin-top: 8px;
    border-radius: 8px;
    width: 100%;
  }

  .dropdown.open .dropdown-menu {
    display: block !important;
  }

  /* Form & Layout Mobile Rules */
  .hero { padding: 30px 0 20px; }
  .hero h2 { font-size: 1.8rem; }
  .card { padding: 20px 15px; }

  .mode-tabs {
    display: flex;
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 8px; 
    margin: 15px 0 25px;
  }

  .mode-tab {
    padding: 6px 12px;
    font-size: 0.8rem;
    flex: 1 1 auto;
    min-width: calc(50% - 8px); 
    text-align: center;
  }

  .form-row {
    gap: 8px;
  }

  input[type="number"] {
    width: 90px; flex-grow: 1; min-width: 70px;
  }

  .btn { width: 100%; text-align: center; }

  .adv-fields-grid { grid-template-columns: 1fr; }
  .cat-header { flex-direction: column; align-items: flex-start; }

  .result-header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .result-score { font-size: 2rem; }
  .result-letter { font-size: 2.8rem; }
}

@media (max-width: 480px) {
  .hero h2 { font-size: 1.4rem; }
  .card h3 { font-size: 1.1rem; }
}