@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-main: #0b0f19;
  --bg-card: #151d2e;
  --bg-card-hover: #1c263c;
  --bg-surface: #1e293b;
  --bg-input: #0f172a;
  
  --beer-gold: #f59e0b;
  --beer-light: #fbbf24;
  --beer-foam: #fef3c7;
  --beer-glow: rgba(245, 158, 11, 0.25);
  
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.15);
  --color-warning: #f59e0b;
  --color-info: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-subtle: #243048;
  --border-focus: #f59e0b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.3);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Contenedor Principal */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 90px;
}

/* Header de la Aplicación */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(21, 29, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-glow);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Tarjetas y Paneles */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0f19;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  background: var(--bg-surface);
  border-color: var(--beer-gold);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1.05rem;
}

/* Badges / Etiquetas */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.badge-open {
  background: rgba(245, 158, 11, 0.15);
  color: var(--beer-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-paid {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-pending {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Métricas / Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stat-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--border-subtle);
}

.stat-box.stat-gold::before { background: var(--beer-gold); }
.stat-box.stat-green::before { background: var(--color-success); }
.stat-box.stat-red::before { background: var(--color-danger); }
.stat-box.stat-blue::before { background: var(--color-info); }

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 4px;
}

/* Barra de progreso de pago */
.progress-bar-container {
  width: 100%;
  background: var(--bg-surface);
  height: 12px;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--border-subtle);
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mesas Grid (Panel del Dueño) */
.mesas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.mesa-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  position: relative;
}

.mesa-card:hover {
  border-color: var(--beer-gold);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.6);
}

.mesa-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.mesa-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--beer-gold);
  background: rgba(245, 158, 11, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
}

.mesa-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-primary);
}

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

.mesa-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 12px 0;
}

.mesa-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* Catálogo Rápido de Productos para el Dueño */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.product-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  user-select: none;
}

.product-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--beer-gold);
  transform: translateY(-2px);
}

.product-btn:active {
  transform: scale(0.95);
  background: var(--beer-gold);
  color: #000;
}

.product-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.product-title {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.product-price {
  font-size: 0.78rem;
  color: var(--beer-light);
  font-weight: 700;
}

/* Chips / Etiquetas Rápidas de Clientes */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.chip.active {
  background: var(--beer-gold);
  color: #0b0f19;
  border-color: var(--beer-gold);
  font-weight: 700;
}

/* Lista de consumos y pagos */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
}

.item-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.item-title {
  font-weight: 700;
  font-size: 0.9rem;
}

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

.item-badge-user {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.item-amount {
  font-weight: 800;
  font-size: 0.95rem;
  text-align: right;
}

.item-amount.paid {
  color: var(--color-success);
}

/* Podio Cervecero (Vista de Clientes) */
.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 20px 0 10px 0;
  margin-bottom: 20px;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30%;
  text-align: center;
}

.podium-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 3px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 6px;
  position: relative;
}

.podium-step.rank-1 .podium-avatar {
  border-color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
  width: 60px;
  height: 60px;
  font-size: 1.7rem;
}

.podium-step.rank-2 .podium-avatar {
  border-color: #94a3b8;
}

.podium-step.rank-3 .podium-avatar {
  border-color: #d97706;
}

.podium-name {
  font-size: 0.8rem;
  font-weight: 700;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-beers {
  font-size: 0.72rem;
  color: var(--beer-light);
  font-weight: 800;
  margin-bottom: 6px;
}

.podium-block {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #0b0f19;
}

.rank-1 .podium-block {
  height: 90px;
  background: linear-gradient(to bottom, #fbbf24, #d97706);
}

.rank-2 .podium-block {
  height: 65px;
  background: linear-gradient(to bottom, #cbd5e1, #64748b);
}

.rank-3 .podium-block {
  height: 45px;
  background: linear-gradient(to bottom, #f59e0b, #b45309);
}

/* Modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Formularios */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  border-color: var(--beer-gold);
}

/* Barra inferior móvil */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(21, 29, 46, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  padding: 10px 16px;
  z-index: 900;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  gap: 4px;
  transition: color var(--transition-fast);
}

.nav-item.active, .nav-item:hover {
  color: var(--beer-gold);
}

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

/* Utilidades */
.text-center { text-align: center; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-gold { color: var(--beer-gold) !important; }
.text-muted { color: var(--text-muted) !important; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 600px) {
  .app-container {
    padding: 10px;
    padding-bottom: 85px;
  }
  .app-header {
    padding: 12px 14px;
    gap: 10px;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
