@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #121826;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.08);
  
  --primary: #7c3aed;
  --primary-hover: #8b5cf6;
  --primary-light: rgba(124, 58, 237, 0.1);
  
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

/* Contenedor Principal */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Encabezado */
header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(18, 24, 38, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.brand-icon svg {
  fill: #fff;
  width: 18px;
  height: 18px;
}

.brand-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Indicador de Sincronización */
.sync-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

.sync-badge::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.sync-badge.syncing {
  color: var(--accent-orange);
  background-color: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}
.sync-badge.syncing::before {
  background-color: var(--accent-orange);
  animation: pulse 1.5s infinite;
}

.sync-badge.synced {
  color: var(--accent-green);
  background-color: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}
.sync-badge.synced::before {
  background-color: var(--accent-green);
}

.sync-badge.offline {
  color: var(--accent-red);
  background-color: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}
.sync-badge.offline::before {
  background-color: var(--accent-red);
}

/* Vistas de la App */
.view {
  flex: 1;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hidden {
  display: none !important;
}

/* Pantalla de Autenticación */
.auth-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-top: 40px;
  letter-spacing: -0.5px;
}

.auth-desc {
  color: var(--text-secondary);
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(124, 58, 237, 0.2);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
}

button {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-glow);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(124, 58, 237, 0.4);
}

button:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
}

/* Dashboard Hogar */
.welcome-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.welcome-title {
  font-size: 24px;
  font-weight: 700;
}

.welcome-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Inventario List */
.section-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.product-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(2px);
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.product-updated {
  font-size: 11px;
  color: var(--text-muted);
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
  padding: 0;
}

.qty-btn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: none;
}

.qty-btn:active {
  transform: scale(0.95);
}

.qty-number {
  font-size: 18px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state svg {
  fill: var(--text-muted);
  width: 48px;
  height: 48px;
}

/* Event Logs section (Debug) */
.event-log-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.event-row {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background-color: rgba(0, 0, 0, 0.15);
  border-left: 3px solid var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.event-row.add {
  border-left-color: var(--accent-green);
}

.event-row.remove {
  border-left-color: var(--accent-red);
}

.event-time {
  color: var(--text-muted);
}

/* Notificación Flotante */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: #1e1b4b;
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Modales e inputs Premium */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(5px);
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 400px;
}

/* Footer info */
.footer-info {
  margin-top: auto;
  padding: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}
.footer-info a {
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-info a:hover {
  text-decoration: underline;
}
