:root {
  --red: #E63946;
  --orange: #F4A261;
  --yellow: #E9C46A;
  --green: #2A9D8F;
  --dark-blue: #264653;
  --white: #FFFFFF;
  --black: #1A1A2E;
  --gradient: linear-gradient(135deg, var(--orange), var(--red));
  --shadow: 0 4px 20px rgba(0,0,0,.1);
  --radius: 16px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --transition: all .3s cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  line-height: 1.6;
  padding-bottom: 80px;
  overflow-x: hidden;
}

.app { max-width: 1200px; margin: 0 auto; }

/* ─── Navbar ─── */
.navbar {
  background: var(--gradient);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(230,57,70,.25);
}
.nav-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.2rem; }
.nav-brand { font-size: 1.5rem; font-weight: 800; color: white; text-decoration: none; letter-spacing: -.5px; }
.nav-links { display: flex; align-items: center; gap: .3rem; }
.nav-links a { color: rgba(255,255,255,.9); text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500; transition: var(--transition); }
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.2); color: #fff; }
.badge { background: var(--red); color: white; border-radius: 50%; padding: .1rem .42rem; font-size: .7rem; font-weight: 700; margin-left: .2rem; }
.admin-link { background: rgba(255,255,255,.15) !important; border: 1px solid rgba(255,255,255,.2); }

/* ─── Mobile Bottom Nav ─── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 2px solid #f0f0f0;
  padding: .4rem 0;
  z-index: 200;
  justify-content: space-around;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom, .4rem);
}
.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #999;
  font-size: .65rem;
  font-weight: 500;
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  gap: 2px;
}
.mobile-nav a i { font-size: 1.3rem; }
.mobile-nav a.active { color: var(--red); }
.mobile-nav a .badge { position: absolute; top: 0; right: -4px; font-size: .6rem; padding: .05rem .3rem; }

/* ─── Main ─── */
.main-content { padding: 1rem 1rem 2rem; min-height: calc(100vh - 60px); }
.main-content h1 { font-size: 1.5rem; font-weight: 800; color: var(--dark-blue); margin-bottom: .8rem; }
.main-content h2 { font-size: 1.2rem; font-weight: 700; color: var(--dark-blue); margin: 1rem 0 .6rem; }

.loading { text-align: center; padding: 3rem; color: #999; }
.loading::after { content: ''; display: block; width: 32px; height: 32px; margin: 1rem auto; border: 3px solid #f0f0f0; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; cursor: pointer; font-weight: 500; font-size: .9rem; animation: slideIn .3s; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.alert-error { background: #ffe0e0; color: var(--red); border: 1px solid #ffc0c0; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid var(--yellow); }
.alert-success { background: #d4edda; color: #155724; border: 1px solid var(--green); }
.empty-state { text-align: center; padding: 3rem 1rem; color: #bbb; font-size: .95rem; }

/* ─── Buttons ─── */
.btn {
  padding: .55rem 1.2rem; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: .85rem; font-weight: 600;
  transition: var(--transition); font-family: var(--font);
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--gradient); color: white; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(230,57,70,.35); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--dark-blue); color: white; }
.btn-success { background: var(--green); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--orange); color: var(--orange); }
.btn-outline:hover { background: var(--orange); color: white; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; }
.btn-lg { padding: .7rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; justify-content: center; }

/* ─── Menu Header ─── */
.menu-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap; gap: .8rem;
  background: var(--gradient); margin: -1rem -1rem 1rem;
  padding: 1.5rem 1rem; color: white; border-radius: 0 0 32px 32px;
}
.menu-header h1 { color: white; margin: 0; font-size: 1.6rem; }
.search-input {
  padding: .65rem 1.2rem; border: 2px solid rgba(255,255,255,.3);
  border-radius: 25px; font-size: .9rem; width: 280px; outline: none;
  background: rgba(255,255,255,.15); color: white; transition: var(--transition);
  font-family: var(--font);
}
.search-input::placeholder { color: rgba(255,255,255,.6); }
.search-input:focus { background: rgba(255,255,255,.25); border-color: var(--yellow); }

/* ─── Category Tabs ─── */
.category-tabs {
  display: flex; gap: .5rem; margin-bottom: 1.2rem;
  overflow-x: auto; padding: .3rem 0; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs button {
  padding: .45rem 1.1rem; border: 2px solid #e8e8e8; border-radius: 25px;
  background: white; cursor: pointer; font-size: .8rem; font-weight: 500;
  transition: var(--transition); white-space: nowrap; color: var(--dark-blue);
}
.category-tabs button:hover { border-color: var(--orange); }
.category-tabs button.active { background: var(--gradient); color: white; border-color: transparent; }

/* ─── Product Grid ─── */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.product-card {
  background: white; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: var(--transition);
  cursor: pointer; border: 1px solid #f5f5f5;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px rgba(0,0,0,.12); }
.product-image {
  width: 100%; height: 130px; display: flex; align-items: center;
  justify-content: center; font-size: 2.5rem; color: white; font-weight: 800;
  background: var(--gradient);
}
.product-info { padding: .8rem 1rem 1rem; }
.product-info h3 { font-size: .95rem; font-weight: 700; color: var(--dark-blue); margin-bottom: .2rem; }
.product-desc { color: #999; font-size: .75rem; margin-bottom: .4rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { font-size: 1.15rem; font-weight: 800; color: var(--red); margin-bottom: .6rem; }
.product-card .btn { width: 100%; justify-content: center; }

/* ─── Product Modal ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 300; display: flex; align-items: flex-end;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: white; border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-height: 85vh; overflow-y: auto;
  padding: 1.5rem; animation: slideUp .3s;
  max-width: 500px; margin: 0 auto;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h2 { font-size: 1.3rem; font-weight: 800; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #999; }
.customize-section { margin-bottom: 1rem; }
.customize-section h4 { font-size: .85rem; font-weight: 700; color: var(--dark-blue); margin-bottom: .5rem; }
.customize-options { display: flex; flex-wrap: wrap; gap: .4rem; }
.customize-options button {
  padding: .35rem .8rem; border: 2px solid #e8e8e8; border-radius: 20px;
  background: white; cursor: pointer; font-size: .78rem; font-weight: 500;
  transition: var(--transition); color: var(--dark-blue);
}
.customize-options button.selected { background: var(--gradient); color: white; border-color: transparent; }
.customize-options button:hover:not(.selected) { border-color: var(--orange); }
.modal-total { font-size: 1.3rem; font-weight: 800; color: var(--red); text-align: center; margin: 1rem 0; }

/* ─── Cart ─── */
.cart-item { display: flex; justify-content: space-between; align-items: center; background: white; padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: .5rem; box-shadow: 0 1px 6px rgba(0,0,0,.06); border: 1px solid #f5f5f5; }
.cart-item-info { display: flex; flex-direction: column; flex: 1; }
.cart-item-info strong { font-size: .9rem; color: var(--dark-blue); }
.cart-item-info small { color: #999; font-size: .75rem; }
.cart-item-actions { display: flex; align-items: center; gap: .4rem; }
.qty-display { min-width: 1.5rem; text-align: center; font-weight: 700; font-size: .9rem; }
.cart-item-subtotal { font-weight: 700; min-width: 4rem; text-align: right; color: var(--red); }

/* ─── Floating Cart Bar ─── */
.cart-floating {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; padding: .7rem 1rem; z-index: 150;
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: env(safe-area-inset-bottom, .7rem);
  display: none;
}
.cart-floating .cart-summary-bar { display: flex; gap: .5rem; align-items: center; }
.cart-floating .cart-summary-bar strong { font-size: 1.1rem; }
.cart-floating .cart-count { background: var(--red); color: white; border-radius: 50%; padding: .15rem .5rem; font-size: .75rem; font-weight: 700; }
.cart-summary { background: white; border-radius: var(--radius); padding: 1.2rem; margin-top: 1rem; box-shadow: var(--shadow); }
.cart-summary p { display: flex; justify-content: space-between; margin-bottom: .4rem; font-size: .9rem; color: #666; }
.total { font-size: 1.3rem; font-weight: 800; color: var(--red); }
.notes-input { width: 100%; padding: .6rem; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); margin: .8rem 0; resize: vertical; min-height: 50px; font-family: var(--font); font-size: .85rem; }

/* ─── Auth ─── */
.auth-form { max-width: 400px; margin: 2rem auto; background: white; padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-form h1 { text-align: center; margin-bottom: 1.2rem; }
.auth-form input { width: 100%; padding: .7rem 1rem; margin-bottom: .8rem; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); font-size: .9rem; font-family: var(--font); transition: var(--transition); }
.auth-form input:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px rgba(244,162,97,.15); }
.auth-form .btn { width: 100%; }
.auth-toggle { text-align: center; margin-top: 1rem; font-size: .85rem; color: #999; }
.auth-toggle a { color: var(--red); text-decoration: none; font-weight: 600; }

/* ─── Orders ─── */
.order-card { background: white; border-radius: var(--radius); padding: 1rem; margin-bottom: .7rem; box-shadow: 0 1px 6px rgba(0,0,0,.06); cursor: pointer; transition: var(--transition); border: 1px solid #f5f5f5; }
.order-card:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.order-header { display: flex; justify-content: space-between; margin-bottom: .4rem; }
.order-id { font-weight: 700; color: var(--dark-blue); }

/* ─── Order Status ─── */
.order-status { padding: .2rem .7rem; border-radius: 20px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.status-received { background: #fff3cd; color: #856404; }
.status-preparing { background: #cce5ff; color: #004085; }
.status-ready { background: #e8daef; color: #6c3483; }
.status-en_camino { background: #d4edda; color: #1b5e20; }
.status-delivered { background: #d4edda; color: #1b5e20; }

/* ─── Tracking Page ─── */
.tracking-container { max-width: 600px; margin: 0 auto; }
.tracking-header { text-align: center; margin-bottom: 1.5rem; }
.tracking-header h1 { font-size: 1.4rem; }
.tracking-steps { display: flex; justify-content: space-between; margin-bottom: .5rem; position: relative; }
.tracking-steps::before { content: ''; position: absolute; top: 50%; left: 2rem; right: 2rem; height: 3px; background: #e8e8e8; transform: translateY(-50%); }
.step { display: flex; flex-direction: column; align-items: center; gap: .3rem; position: relative; z-index: 1; }
.step-dot { width: 36px; height: 36px; border-radius: 50%; background: #e8e8e8; display: flex; align-items: center; justify-content: center; font-size: .9rem; border: 3px solid #e8e8e8; transition: var(--transition); }
.step.completed .step-dot { background: var(--green); border-color: var(--green); color: white; }
.step.active .step-dot { background: var(--orange); border-color: var(--orange); color: white; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(244,162,97,.4); } 50% { box-shadow: 0 0 0 10px rgba(244,162,97,0); } }
.step-label { font-size: .65rem; font-weight: 600; color: #999; text-align: center; max-width: 70px; }
.step.completed .step-label { color: var(--green); }
.step.active .step-label { color: var(--orange); }

.progress-bar { height: 6px; background: #e8e8e8; border-radius: 3px; overflow: hidden; margin: 1rem 0; }
.progress-fill { height: 100%; background: var(--gradient); border-radius: 3px; transition: width .8s cubic-bezier(.4,0,.2,1); }

.tracking-map { height: 200px; background: #f8f8f8; border-radius: var(--radius); margin: 1rem 0; overflow: hidden; }
.tracking-details { background: white; border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.tracking-details p { display: flex; justify-content: space-between; font-size: .85rem; padding: .3rem 0; }
.tracking-details .label { color: #999; }

/* ─── Checkout ─── */
.checkout-section { max-width: 600px; margin: 0 auto; }
.checkout-map { height: 250px; background: #f0f0f0; border-radius: var(--radius); margin-bottom: 1rem; position: relative; overflow: hidden; }
.checkout-map .map-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: #999; flex-direction: column; gap: .5rem; }
.location-inputs { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0; }
.location-inputs input, .location-inputs textarea { padding: .65rem 1rem; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); font-size: .85rem; font-family: var(--font); transition: var(--transition); }
.location-inputs input:focus, .location-inputs textarea:focus { border-color: var(--orange); outline: none; }

.payment-methods { display: flex; gap: .6rem; margin: 1rem 0; }
.payment-method { flex: 1; padding: .8rem; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); cursor: pointer; text-align: center; transition: var(--transition); font-size: .85rem; font-weight: 500; }
.payment-method:hover { border-color: var(--orange); }
.payment-method.selected { border-color: var(--red); background: #fff5f5; }
.payment-method .icon { font-size: 1.5rem; display: block; margin-bottom: .3rem; }

/* ─── Admin ─── */
.admin-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; overflow-x: auto; padding: .2rem; -webkit-overflow-scrolling: touch; }
.admin-tabs button { padding: .45rem .9rem; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); background: white; cursor: pointer; font-size: .78rem; font-weight: 600; transition: var(--transition); white-space: nowrap; }
.admin-tabs button:hover { border-color: var(--dark-blue); }
.admin-tabs button.active { background: var(--dark-blue); color: white; border-color: var(--dark-blue); }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.dash-card { background: white; padding: 1rem; border-radius: var(--radius-sm); box-shadow: 0 1px 6px rgba(0,0,0,.06); text-align: center; border: 1px solid #f5f5f5; }
.dash-card h3 { font-size: .75rem; color: #999; text-transform: uppercase; letter-spacing: .5px; margin-bottom: .3rem; }
.dash-card p { font-size: 1.4rem; font-weight: 800; color: var(--dark-blue); }
.dash-card .trend { font-size: .75rem; font-weight: 600; }
.dash-card .trend.up { color: var(--green); }
.dash-card .trend.down { color: var(--red); }

.admin-order { background: white; padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: .5rem; box-shadow: 0 1px 4px rgba(0,0,0,.04); border: 1px solid #f5f5f5; }
.admin-order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; font-weight: 600; }
.admin-order-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }

.form-card { background: white; padding: 1.2rem; border-radius: var(--radius); margin: 1rem 0; box-shadow: var(--shadow); }
.form-card h3 { margin-bottom: 1rem; }
.form-card form { display: flex; flex-direction: column; gap: .7rem; }
.form-card input, .form-card select, .form-card textarea { padding: .6rem .8rem; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); font-size: .85rem; font-family: var(--font); }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus { border-color: var(--orange); outline: none; }

.admin-table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04); margin-top: .8rem; font-size: .85rem; }
.admin-table th { background: #fafafa; padding: .6rem .7rem; text-align: left; font-size: .72rem; color: #999; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.admin-table td { padding: .6rem .7rem; border-top: 1px solid #f5f5f5; }
.admin-filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.admin-filters select, .admin-filters input { padding: .45rem .7rem; border: 2px solid #e8e8e8; border-radius: var(--radius-sm); font-size: .82rem; font-family: var(--font); }

/* ─── Profile ─── */
.profile-info { background: white; padding: 1.2rem; border-radius: var(--radius); box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.profile-info p { display: flex; justify-content: space-between; margin-bottom: .6rem; font-size: .9rem; padding: .3rem 0; border-bottom: 1px solid #f5f5f5; }
.profile-info p:last-child { border: none; }
.profile-info strong { color: #999; font-weight: 500; }

/* ─── Rating ─── */
.rating-section { margin-top: 1.5rem; background: white; padding: 1rem; border-radius: var(--radius); box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.rating-item { display: flex; justify-content: space-between; align-items: center; padding: .4rem 0; }
.stars { display: flex; gap: 2px; }
.star { cursor: pointer; font-size: 1.3rem; color: #ddd; transition: var(--transition); }
.star.active, .star:hover { color: var(--yellow); }

/* ─── Responsive ─── */
@media (max-width: 320px) {
  .product-grid { grid-template-columns: 1fr; }
  .nav-brand { font-size: 1.2rem; }
  .menu-header h1 { font-size: 1.2rem; }
}

@media (min-width: 321px) and (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .product-image { height: 100px; font-size: 2rem; }
  .product-info { padding: .5rem .6rem .7rem; }
  .product-info h3 { font-size: .82rem; }
  .product-price { font-size: 1rem; }
  .nav-links a { font-size: .75rem; padding: .3rem .5rem; }
  .search-input { width: 100%; }
  .menu-header { padding: 1rem; flex-direction: column; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-links .desktop-only { display: none; }
  .mobile-nav { display: flex; }
  .cart-floating { display: flex; }
  body { padding-bottom: 120px; }
  .recommendations { grid-template-columns: 1fr; }
  .payment-methods { flex-direction: column; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .recommendations { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1025px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
  .modal-content { border-radius: var(--radius); }
}

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .4rem; }
.gap-2 { gap: .8rem; }

/* ─── Charts (simple CSS bars) ─── */
.chart-bar { display: flex; align-items: center; gap: .5rem; margin: .3rem 0; }
.chart-bar .bar-label { min-width: 80px; font-size: .78rem; color: #666; }
.chart-bar .bar-fill { height: 20px; border-radius: 10px; background: var(--gradient); transition: width .6s; min-width: 4px; }
.chart-bar .bar-value { font-size: .78rem; font-weight: 600; min-width: 50px; text-align: right; }

.sticky-note { background: var(--yellow); padding: .5rem .8rem; border-radius: var(--radius-sm); font-size: .82rem; font-weight: 500; margin-bottom: .8rem; }
