:root {
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --primary-light: #40916c;
  --accent: #f4a261;
  --danger: #e76f51;
  --warning: #e9c46a;
  --success: #2a9d8f;
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6c757d;
  --border: #e9ecef;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 20px 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 2px;
}

.btn-icon {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-icon:hover, .btn-icon:active {
  background: rgba(255,255,255,0.35);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 16px 8px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card.urgent .stat-number {
  color: var(--danger);
}

.stat-number {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Filters */
.filters {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.filter-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Product List */
.product-list {
  padding: 8px 16px 100px;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
  border-left: 5px solid var(--success);
  transition: transform 0.15s;
}

.product-card:active {
  transform: scale(0.98);
}

.product-card.urgent {
  border-left-color: var(--danger);
}

.product-card.warning {
  border-left-color: var(--warning);
}

.product-card.expired {
  border-left-color: #999;
  opacity: 0.7;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 4px;
  word-break: break-word;
}

.product-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-ok { background: #d8f3dc; color: #1b4332; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-urgent { background: #fee2e2; color: #991b1b; }
.badge-expired { background: #e5e7eb; color: #4b5563; }

.product-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-action {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
}

.btn-action:hover { opacity: 1; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  line-height: 1;
}

.empty-state h2 {
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 24px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 2rem;
  box-shadow: 0 6px 20px rgba(45, 106, 79, 0.4);
  cursor: pointer;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.fab:active {
  transform: scale(0.92);
}

.fab:hover {
  background: var(--primary-dark);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.2s ease;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 1.25rem;
}

.btn-close {
  background: var(--bg);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* Form */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--bg);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.date-input-group {
  display: flex;
  gap: 10px;
}

.date-input-group input {
  flex: 1;
}

.help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.photo-preview {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.photo-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

.ocr-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 8px 12px;
  font-size: 0.85rem;
  text-align: center;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}

/* Invite Modal */
.invite-modal {
  padding-bottom: 32px;
}

.invite-text {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.invite-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.invite-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}

.invite-card:hover {
  border-color: var(--primary);
  background: #f0f7f4;
}

.invite-card.affiliate {
  cursor: default;
  flex-direction: column;
}

.invite-card.affiliate:hover {
  background: var(--bg);
  border-color: var(--border);
}

.invite-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.invite-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 2px;
}

.invite-card small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.affiliate-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}

.btn-affiliate {
  display: block;
  background: #ff9900;
  color: #111;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  transition: background 0.2s;
}

.btn-affiliate:hover {
  background: #e68a00;
}

.invite-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 16px;
  text-align: center;
  line-height: 1.4;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary-dark);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.9rem;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (min-width: 600px) {
  .modal {
    align-items: center;
    padding: 20px;
  }
  .modal-content {
    border-radius: var(--radius);
    max-height: 85vh;
  }
  .header {
    border-radius: 0 0 20px 20px;
  }
}

/* Header actions */
.header-actions {
  display: flex;
  gap: 8px;
}

/* Form row (quantity + unit) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Footer */
.footer {
  padding: 24px 16px 100px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.disclaimer-short {
  margin-bottom: 12px;
  line-height: 1.4;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.link-btn.inline {
  display: inline;
  font-size: inherit;
}

.company {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Exit modal */
.exit-modal .exit-body {
  text-align: center;
}

.exit-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}

.exit-affiliate {
  margin: 16px 0;
}

.exit-affiliate .small {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 8px;
  text-decoration: underline;
}

/* Legal modals */
.legal-modal {
  max-height: 85vh;
}

.legal-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.legal-body p {
  margin-bottom: 12px;
}

.legal-body ol {
  padding-left: 20px;
  margin-bottom: 16px;
}

.legal-body li {
  margin-bottom: 8px;
}

.legal-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 20px;
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: 72px;
  left: 10px;
  right: 10px;
  background: var(--primary-dark);
  color: white;
  z-index: 998;
  padding: 14px;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  animation: slideUp 0.3s ease;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.cookie-content {
  max-width: 600px;
  margin: 0 auto;
}

.cookie-content p {
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 12px;
}

.cookie-content .link-btn {
  color: #a7f3d0;
}

.cookie-actions {
  display: flex;
  gap: 10px;
}

.btn-sm {
  padding: 10px 18px;
  font-size: 0.9rem;
  flex: 0 0 auto;
}

.cookie-actions .btn-primary {
  background: white;
  color: var(--primary-dark);
}

.cookie-actions .btn-secondary {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.5);
  color: white;
}

/* Quantity badge on product card */
.qty-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Amazon disclosure */
.amazon-disclosure {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin-top: 12px;
}

.footer-amazon {
  margin: 8px auto 12px;
  max-width: 420px;
}

/* App links (food waste apps) */
.btn-app {
  display: block;
  background: #1b4332;
  color: #fff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  transition: background 0.2s;
}

.btn-app:hover {
  background: #2d6a4f;
}

.apps-waste .affiliate-links {
  margin-top: 10px;
}

/* SEO content section */
.seo-content {
  padding: 32px 16px 24px;
  max-width: 720px;
  margin: 0 auto;
  color: var(--text);
  border-top: 1px solid var(--border);
  background: #f1f5f3;
}

.seo-content article {
  margin-bottom: 28px;
}

.seo-content h2 {
  font-size: 1.15rem;
  color: var(--primary-dark);
  margin-bottom: 10px;
  line-height: 1.35;
}

.seo-content p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #333;
  margin-bottom: 10px;
}

.seo-content ul {
  padding-left: 1.2rem;
  margin: 10px 0 12px;
}

.seo-content li {
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 8px;
  color: #333;
}

.seo-content strong {
  color: var(--primary-dark);
}

/* FAQ dentro de SEO */
.faq-item {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h3 {
  font-size: 0.98rem;
  color: var(--primary-dark);
  margin-bottom: 6px;
  line-height: 1.35;
}

.faq-item p {
  margin-bottom: 0;
}

/* ========== Views & Bottom Nav ========== */
.app-view {
  display: none;
  animation: fadeView 0.25s ease;
}

.app-view.active {
  display: block;
}

@keyframes fadeView {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

body {
  padding-bottom: 88px;
}

.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  min-height: 64px !important;
  height: 64px !important;
  background: #ffffff !important;
  border-top: 1px solid #d1d5db !important;
  display: flex !important;
  justify-content: space-around !important;
  align-items: center !important;
  z-index: 999 !important;
  padding: 0 4px !important;
  padding-bottom: 0 !important;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12) !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  transition: color 0.2s;
  border-radius: 12px;
  max-width: 90px;
}

.nav-item .nav-icon {
  font-size: 1.25rem;
  line-height: 1.2;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-item:active {
  background: rgba(45, 106, 79, 0.08);
}

.nav-share .nav-icon {
  background: var(--primary);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 2px;
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.35);
}

.nav-share {
  color: var(--primary);
  font-weight: 600;
}

/* FAB above bottom nav */
.fab {
  bottom: 80px;
}

/* Home footer note */
.home-footer-note {
  text-align: center;
  padding: 16px 24px 100px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Guide view */
.guide-hero {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.guide-title {
  font-size: 1.4rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.guide-lead {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.seo-content {
  padding-bottom: 100px;
}

.guide-footer {
  padding-bottom: 40px;
}

/* ========== Share modal ========== */
.share-modal, .more-modal {
  border-radius: 24px 24px 0 0;
  padding-top: 12px;
}

.share-handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 0 auto 12px;
}

.share-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.share-btn:hover, .share-btn:active {
  border-color: var(--primary);
  background: #f0f7f4;
  transform: translateY(-2px);
}

.share-btn-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.share-install-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* More modal */
.more-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.more-item:hover {
  border-color: var(--primary);
  background: #f0f7f4;
}

.more-item span:first-child {
  font-size: 1.4rem;
}

.more-item strong {
  display: block;
  font-size: 0.95rem;
}

.more-item small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.more-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 16px;
  text-align: center;
  line-height: 1.4;
}

/* Product list padding for nav */
.product-list {
  padding-bottom: 24px;
}

/* Toast above nav */
.toast {
  bottom: 90px;
}

/* Search & tools */
.search-bar {
  padding: 0 16px 8px;
}
.search-bar input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--card);
}
.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
}
.quick-tools {
  display: flex;
  gap: 8px;
  padding: 0 16px 8px;
}
.tool-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}
.tool-btn:active {
  background: #e8f5e9;
  color: var(--primary);
}
.product-actions {
  flex-wrap: wrap;
  max-width: 72px;
}
