* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 4rem 1rem 2rem 1rem;
}

.app-container {
  width: 100%;
  max-width: 600px;
}

.app-title {
  text-align: center;
  font-size: 2rem;
  color: #e94560;
  margin-bottom: 1.5rem;
  font-weight: 100;
  font-family: rbc;
}

.total-display {
  background-color: #16213e;
  border: 2px solid #e94560;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.total-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.total-label {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #a0a0b0;
}

.total-value {
  font-size: 3rem;
  font-weight: 700;
  color: #e94560;
}

.nutrition-totals {
  margin-top: 1rem;
  border-top: 1px solid #2a2a4a;
  padding-top: 1rem;
}

.nutrition-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nutrition-total-item {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid #2a2a4a;
}

.nutrition-total-item.sub {
  padding-left: 1.5rem;
}

.nt-label {
  font-size: 0.9rem;
  color: #a0a0b0;
}

.nt-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e0e0e0;
}

.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 1.5rem;
  background-color: #16213e;
  border-radius: 10px;
  padding: 4px;
}

.tab-button {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  background: none;
  color: #a0a0b0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s, color 0.2s;
}

.tab-button:hover {
  color: #e0e0e0;
}

.tab-button.active {
  background-color: #e94560;
  color: #ffffff;
}

.tab-button.locked {
  display: none;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  background-color: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
}

.search-bar input:focus {
  outline: none;
  border-color: #e94560;
}

.search-bar select {
  padding: 0.75rem 0.75rem;
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  background-color: #16213e;
  color: #e0e0e0;
  font-size: 0.9rem;
  cursor: pointer;
}

.search-bar select:focus {
  outline: none;
  border-color: #e94560;
}

.items-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1.5rem;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: #16213e;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.item-row:hover {
  background-color: #1a2540;
}

.item-row.selected {
  background-color: #2a1a3e;
  border-left: 3px solid #e94560;
}

.item-checkbox {
  width: 20px;
  height: 20px;
  accent-color: #e94560;
  cursor: pointer;
}

.item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background-color: #0f1a30;
  overflow: hidden;
  flex-shrink: 0;
}

.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.item-name {
  font-weight: 500;
}

.item-serving {
  font-size: 0.8rem;
  color: #a0a0b0;
}

.item-qty {
  width: 55px;
  padding: 0.3rem 0.4rem;
  border: 2px solid #2a2a4a;
  border-radius: 6px;
  background-color: #0f1a30;
  color: #e0e0e0;
  font-size: 0.9rem;
  text-align: center;
}

.item-qty:focus {
  outline: none;
  border-color: #e94560;
}

.item-calories {
  font-weight: 700;
  color: #e94560;
  min-width: 65px;
  text-align: right;
}

.selected-summary {
  background-color: #16213e;
  border-radius: 10px;
  padding: 1rem;
}

.selected-summary h3 {
  font-size: 1rem;
  color: #a0a0b0;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.selected-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #2a2a4a;
}

.selected-item:last-of-type {
  border-bottom: none;
}

.selected-item-info {
  display: flex;
  flex-direction: column;
}

.selected-item-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.selected-item-macros {
  font-size: 0.75rem;
  color: #a0a0b0;
}

.selected-item-cal {
  font-weight: 700;
  color: #e94560;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: #a0a0b0;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  background-color: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: #e94560;
}

.form-sub {
  padding-left: 1.5rem;
}

.image-preview {
  margin-top: 0.5rem;
}

.preview-img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  border: 2px solid #2a2a4a;
}

#itemImage {
  font-size: 0.85rem;
  color: #a0a0b0;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-add {
  background-color: #e94560;
  color: #ffffff;
  width: 100%;
}

.btn-clear {
  background-color: #2a2a4a;
  color: #a0a0b0;
  width: 100%;
  margin-top: 0.75rem;
}

.btn-delete {
  background: none;
  border: none;
  color: #e94560;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
}

.btn-delete:hover {
  opacity: 0.7;
}

.saved-items {
  margin-top: 1.5rem;
}

.saved-items h3 {
  font-size: 1rem;
  color: #a0a0b0;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.saved-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background-color: #16213e;
  border-radius: 8px;
  margin-bottom: 6px;
}

.saved-item-main {
  display: flex;
  align-items: center;
  flex: 1;
}

.saved-item-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background-color: #0f1a30;
  overflow: hidden;
  flex-shrink: 0;
  margin-right: 0.75rem;
}

.saved-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saved-item-info {
  display: flex;
  flex-direction: column;
}

.saved-item-name {
  font-weight: 500;
}

.saved-item-detail {
  font-size: 0.8rem;
  color: #a0a0b0;
}

.saved-item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-edit {
  background: none;
  border: 1px solid #2a2a4a;
  color: #a0a0b0;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}

.btn-edit:hover {
  border-color: #e94560;
  color: #e0e0e0;
}

.manual-entry {
  margin-bottom: 1.5rem;
}

.manual-list h3 {
  font-size: 1rem;
  color: #a0a0b0;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.manual-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background-color: #16213e;
  border-radius: 8px;
  margin-bottom: 6px;
}

.manual-item-label {
  flex: 1;
}

.manual-item-cal {
  font-weight: 700;
  color: #e94560;
  margin-right: 0.75rem;
}

.items-list::-webkit-scrollbar {
  width: 6px;
}

.items-list::-webkit-scrollbar-track {
  background: #16213e;
  border-radius: 3px;
}

.items-list::-webkit-scrollbar-thumb {
  background: #2a2a4a;
  border-radius: 3px;
}

.items-list::-webkit-scrollbar-thumb:hover {
  background: #3a3a5a;
}

.empty-message {
  text-align: center;
  color: #a0a0b0;
  padding: 2rem;
  font-size: 0.9rem;
}

.auth-screen {
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-screen.hidden,
.app-container.hidden {
  display: none;
}

.auth-box {
  width: 100%;
  background-color: #16213e;
  border: 2px solid #e94560;
  border-radius: 12px;
  padding: 2rem;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1.5rem;
  background-color: #0f1a30;
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: none;
  color: #a0a0b0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s, color 0.2s;
}

.auth-tab.active {
  background-color: #e94560;
  color: #ffffff;
}

.auth-error {
  color: #e94560;
  font-size: 0.85rem;
  min-height: 1.2rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.auth-divider {
  text-align: center;
  color: #a0a0b0;
  font-size: 0.85rem;
  margin: 1rem 0;
}

.btn-guest {
  background-color: #2a2a4a;
  color: #e0e0e0;
  width: 100%;
}

.guest-section.hidden {
  display: none;
}

.account-corner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  background-color: #16213e;
  border-bottom: 2px solid #2a2a4a;
  z-index: 10;
  padding: 0.6rem 1rem;
  justify-content: space-between;
  transition: top 0.4s ease;
}

.account-corner.navbar-hidden {
  top: -100px;
}

.account-corner.hidden {
  display: none;
}

.account-name {
  font-size: 0.9rem;
  color: #a0a0b0;
  font-weight: 600;
}

.btn-account {
  background-color: #16213e;
  border: 1px solid #2a2a4a;
  color: #a0a0b0;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: border-color 0.2s, color 0.2s;
}

.btn-account:hover {
  border-color: #e94560;
  color: #e0e0e0;
}

.btn-back {
  background: none;
  border: none;
  color: #a0a0b0;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  margin-bottom: 1rem;
  transition: color 0.2s;
}

.btn-back:hover {
  color: #e94560;
}

.btn-back.hidden {
  display: none;
}

.form-group input[type="number"]::-webkit-inner-spin-button,
.form-group input[type="number"]::-webkit-outer-spin-button,
.item-qty::-webkit-inner-spin-button,
.item-qty::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.form-group input[type="number"],
.item-qty {
  appearance: textfield;
}

.stepper {
  display: flex;
  align-items: stretch;
}

.stepper-btn {
  border: 2px solid #2a2a4a;
  background-color: #2a2a4a;
  color: #e94560;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}

.stepper-btn:hover {
  background-color: #e94560;
  color: #ffffff;
}

.form-group .stepper-btn:first-child {
  border-radius: 8px 0 0 8px;
}

.form-group .stepper-btn:last-child {
  border-radius: 0 8px 8px 0;
}

.form-group .stepper input[type="number"] {
  flex: 1;
  border-radius: 0;
  border-left: none;
  border-right: none;
  text-align: center;
}

.item-row .stepper-btn {
  width: 1.6rem;
  font-size: 1rem;
}

.item-row .stepper-btn:first-child {
  border-radius: 6px 0 0 6px;
}

.item-row .stepper-btn:last-child {
  border-radius: 0 6px 6px 0;
}

.item-row .stepper .item-qty {
  border-radius: 0;
  border-left: none;
  border-right: none;
  width: 45px;
}

#itemImage {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 2px dashed #2a2a4a;
  border-radius: 8px;
  background-color: #0f1a30;
  color: #a0a0b0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

#itemImage:hover {
  border-color: #e94560;
}

#itemImage::file-selector-button {
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  border: none;
  border-radius: 6px;
  background-color: #e94560;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

#itemImage::file-selector-button:hover {
  opacity: 0.85;
}

.serving-row {
  display: flex;
  gap: 0.5rem;
}

.serving-row input {
  flex: 1;
}

#itemCategory,
#itemServingUnit {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  background-color: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  cursor: pointer;
}

#itemServingUnit {
  width: auto;
  min-width: 90px;
}

#itemCategory:focus,
#itemServingUnit:focus {
  outline: none;
  border-color: #e94560;
}

.form-group.hidden {
  display: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #e0e0e0;
  font-weight: 500;
}

.checkbox-label input {
  width: 20px;
  height: 20px;
  accent-color: #e94560;
  cursor: pointer;
}

.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.confirm-box {
  background: #1a1a2e;
  border: 1px solid #16213e;
  border-radius: 8px;
  padding: 24px 32px;
  max-width: 360px;
  width: 90%;
}

.confirm-message {
  color: #e0e0e0;
  font-size: 15px;
  margin: 0 0 20px 0;
  text-align: center;
  line-height: 1.4;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-confirm-cancel {
  background: #16213e;
  color: #e0e0e0;
  border: 1px solid #0f3460;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-confirm-cancel:hover {
  background: #0f3460;
}

.btn-confirm-delete {
  background: #533483;
  color: #e0e0e0;
  border: 1px solid #e94560;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-confirm-delete:hover {
  background: #e94560;
}

.facts-toggle {
  background: #16213e;
  color: #e0e0e0;
  border: 1px solid #0f3460;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  margin-top: 8px;
}

.facts-toggle:hover {
  background: #0f3460;
}

.nutrition-totals.collapsed {
  display: none;
}

.total-display.manual-active .nutrition-totals,
.total-display.manual-active .facts-toggle {
  display: none;
}

.side-panel {
  position: fixed;
  top: 70px;
  right: 0;
  display: flex;
  align-items: stretch;
  z-index: 900;
  transition: transform 0.25s ease;
}

.side-panel.collapsed {
  transform: translateX(calc(100% - 28px));
}

.side-panel-tab {
  width: 28px;
  background: #0f3460;
  color: #e0e0e0;
  border: none;
  cursor: pointer;
  font-size: 16px;
  border-radius: 6px 0 0 6px;
}

.side-panel-tab:hover {
  background: #533483;
}

.side-panel-body {
  background: #1a1a2e;
  border: 1px solid #16213e;
  border-left: none;
  border-radius: 0 6px 6px 0;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.side-panel-label {
  font-size: 11px;
  color: #9aa;
  text-transform: uppercase;
}

.side-panel-value {
  font-size: 20px;
  font-weight: 700;
  color: #e94560;
}

.scroll-tab {
  position: fixed;
  left: 0;
  width: 28px;
  height: 36px;
  background: #0f3460;
  color: #e0e0e0;
  border: none;
  cursor: pointer;
  font-size: 16px;
  border-radius: 0 6px 6px 0;
  z-index: 950;
  top: 70px;
}

.scroll-tab-bottom {
  top: auto;
  bottom: 20px;
}

.scroll-tab:hover {
  background: #533483;
}

.form-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #e94560;
  padding: 0.75rem 0;
  margin-bottom: 0.5rem;
  border: none;
  border-bottom: 2px solid #e94560;
  background: none;
  cursor: pointer;
}

.form-section-toggle:hover {
  opacity: 0.8;
}

.toggle-arrow {
  font-size: 1rem;
}

.form-section-body.collapsed {
  display: none;
}

.checkbox-group {
  margin-bottom: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: #e0e0e0;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.6rem 0;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: #e94560;
  cursor: pointer;
  flex-shrink: 0;
}

.total-display.hide-total {
  display: none;
}

@media (max-width: 600px) {
  body {
    padding: 3.5rem 0.75rem 2rem 0.75rem;
  }

  .app-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .total-display {
    padding: 1rem;
  }

  .total-value {
    font-size: 2.25rem;
  }

  .tab-bar {
    flex-wrap: wrap;
  }

  .tab-button {
    flex: 1 1 calc(50% - 4px);
    padding: 0.6rem 0.4rem;
    font-size: 0.85rem;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar select {
    width: 100%;
  }

  .item-row {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
  }

  .item-info {
    flex: 1 1 100%;
    order: 3;
  }

  .item-row .stepper {
    order: 4;
  }

  .item-calories {
    order: 5;
    min-width: 0;
    flex: 1;
  }

  .items-list {
    max-height: 50vh;
  }

  .serving-row {
    flex-direction: column;
  }

  #itemServingUnit {
    width: 100%;
  }

  .side-panel {
    top: auto;
    bottom: 80px;
  }

  .scroll-tab {
    top: auto;
    bottom: 60px;
  }

  .scroll-tab-bottom {
    bottom: 20px;
  }

  .confirm-buttons {
    flex-wrap: wrap;
  }
}

@font-face {
  font-family: rbc;
  src: url('../assets/Helicopta.otf');
}
