:root {
  --primary: #2d5a27;
  /* Verde bosque profundo para salud */
  --primary-light: #e8f5e9;
  --accent: #fbc02d;
  /* Amarillo suave para alertas/detalles */
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --shadow-premium: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  width: 100%;
  max-width: 500px;
  /* Limit for desktop viewing */
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-premium);
}

/* Header & Hamburger */
.header {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.5);
}

.menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  letter-spacing: -0.5px;
}

/* Main Content Layout */
#main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.data-view,
.chat-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.data-view {
  background: white;
  z-index: 10;
  padding: 1.5rem;
  overflow-y: auto;
}

.chat-area {
  z-index: 5;
  background: var(--bg-gradient);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

/* Visibility classes */
.hidden {
  display: none !important;
}

.data-view:not(.active) {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.chat-area:not(.active) {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.data-view.active,
.chat-area.active {
  transform: translateX(0);
  opacity: 1;
}

/* Chat Input Area Adjustment */
.input-area {
  padding: 1rem;
  padding-bottom: calc(1rem + var(--safe-area-bottom));
  background: white;
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--glass-border);
  transition: transform 0.3s;
}

.input-area.hidden {
  transform: translateY(100%);
}

/* Sidebar & General Items already defined below ... */

.chat-input {
  flex: 1;
  padding: 0.8rem 1.2rem;
  border: 1px solid #e0e0e0;
  border-radius: 25px;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--primary);
}

.send-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.send-btn:active {
  transform: scale(0.9);
}

/* Sidebar Menu */
.sidebar {
  position: absolute;
  top: 0;
  left: -100%;
  width: 85%;
  height: 100%;
  background: white;
  z-index: 100;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.sidebar.active {
  left: 0;
}

.sidebar-header {
  padding: 1.5rem;
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.menu-item {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0.5rem;
}

.menu-item:hover {
  background: var(--primary-light);
}

.menu-item i {
  font-size: 1.2rem;
  color: var(--primary);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  display: none;
}

.overlay.active {
  display: block;
}

/* View Modal */
.view-modal {
  position: absolute;
  top: 100%;
  /* Start off-screen */
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 110;
  transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.view-modal.active {
  top: 0;
}

.view-header {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-light);
  color: var(--primary);
  border-bottom: 1px solid var(--glass-border);
}

.view-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--primary);
  cursor: pointer;
  padding: 0.5rem;
}

.view-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Stock View Specifics */
.stock-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #eee;
}

.stock-item span {
  font-weight: 500;
}

.btn-remove {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
}

.add-stock-form {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.5rem;
}

.add-stock-form input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
}

.btn-add {
  padding: 0 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}