/* ===== BASE LAYOUT & ADMIN STYLES ===== */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f6f8fa;
  color: #1f2937;
}
#admin-warning {
  background: #fff3cd;
  color: #7a5d00;
  font-size: .85rem;
  text-align: center;
  padding: 6px 12px;
  border-bottom: 1px solid #e5d9a6;
}
#admin-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
#nav-toggle {
  font-size: 1.2rem;
  background: none;
  border: none;
  cursor: pointer;
}
.admin-title {
  font-weight: 600;
}
#admin-layout {
  display: flex;
  min-height: calc(100vh - 32px);
}
#admin-sidebar {
  width: 240px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  padding: 16px;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7280;
}
.nav-link {
  text-decoration: none;
  color: #111827;
  padding: 6px 8px;
  border-radius: 6px;
}
.nav-link:hover {
  background: #f3f4f6;
}
#admin-content {
  flex: 1;
  padding: 28px 32px;
}
.page-header {
  margin-bottom: 24px;
}
.page-subtitle {
  color: #6b7280;
}
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.nav-link.is-active {
  background: #0b1c2a;
  color: #fff;
  border-radius: 10px;
}

/* ===== MIXING STEPS STYLES ===== */
.mixing-step {
  background: #f8fafc;
  border-left: 4px solid #4f46e5;
  padding: 15px;
  margin: 15px 0;
  border-radius: 0 8px 8px 0;
}
.mixing-step h4 {
  margin-top: 0;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #4f46e5;
  color: white;
  border-radius: 50%;
  font-weight: bold;
  font-size: 14px;
}
.ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}
.ingredient-item {
  background: white;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.ingredient-name {
  font-weight: 600;
}
.ingredient-percent {
  color: #4f46e5;
  font-weight: bold;
}
.ingredient-weights {
  font-family: monospace;
  font-size: 12px;
  color: #6b7280;
}
.mixing-tip {
  background: #f0f9ff;
  border-left: 3px solid #0ea5e9;
  padding: 10px 15px;
  margin: 10px 0;
  font-size: 14px;
  border-radius: 0 6px 6px 0;
}
.note {
  font-size: 0.9rem;
  color: #6b7280;
  background: #f8fafc;
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
}

/* ===== INTEGRATED CALCULATOR STYLES ===== */
.integrated-calculator {
  margin-top: 16px;
}
.input-group {
  margin-bottom: 20px;
}
.input-group label {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}
.input-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.input-field {
  flex: 1;
  min-width: 150px;
}
.input-field input {
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
}
.unit-selector {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
  padding: 12px;
  background: #f8fafc;
  border-radius: 12px;
}
.unit-buttons {
  display: flex;
  gap: 8px;
}
.unit-btn {
  padding: 6px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  cursor: pointer;
}
.unit-btn.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: #4f46e5;
  color: white;
}
.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.batch-summary {
  background: #eef2ff;
  padding: 16px;
  border-radius: 12px;
  margin: 20px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
}

/* ===== MOBILE NAVIGATION - FIXED Z-INDEX ===== */
#menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 900px) {
  #admin-topbar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 1002;
    background: #ffffff;
  }
  
  #admin-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 20px 16px;
    transition: left 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  
  #admin-sidebar.open {
    left: 0;
  }
  
  #admin-content {
    padding: 20px;
  }
}

@media (min-width: 901px) {
  #admin-topbar {
    display: none !important;
  }
  
  #admin-sidebar {
    position: relative;
    left: 0;
    width: 240px;
    height: auto;
    z-index: auto;
  }
}

@media (max-width: 768px) {
  .input-row { flex-direction: column; }
  .batch-summary { flex-direction: column; text-align: center; }
}

@media (max-width: 600px) {
  .action-buttons { flex-direction: column; }
  .btn { width: 100%; text-align: center; }
  .unit-buttons { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .card { padding: 15px; }
  .ingredient-item { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 360px) {
  #admin-content { padding: 12px; }
  .card { padding: 12px; }
}

@media (max-width: 300px) {
  .results-table { min-width: 400px; }
}