:root {
  --primary: #1a3a5d;
  --primary-light: #2d5a8a;
  --secondary: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --light: #f8f9fa;
  --dark: #212529;
  --border: #dee2e6;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--dark);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  min-height: 100vh;
  box-shadow: var(--shadow-lg);
}

.app-header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.header-banners {
  text-align: center;
  width: 100%;
}

.header-link-pdf {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 8px;
  text-decoration: none;
  margin-bottom: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.header-link-pdf:hover {
  background: #fff;
}

.header-publica-sin-costo {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.user-badge {
  background: rgba(255,255,255,0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-badge::before {
  content: '👤';
}

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

.btn-publicar-anuncio {
  display: inline-block;
  padding: 10px 18px;
  background: #fff;
  color: #1a3a5d;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  border: 2px solid #fff;
  transition: background 0.2s, color 0.2s;
}

.btn-publicar-anuncio:hover {
  background: #e8f0f8;
  color: #1a3a5d;
}

.link-cerrar-sesion {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.link-cerrar-sesion:hover {
  color: #e8f0f8;
}
.link-soporte {
  color: #fff;
  font-size: 0.95rem;
  text-decoration: none;
  margin-left: 10px;
}
.link-soporte:hover {
  color: #e8f0f8;
}

/* Banner hero Clasificados (PWA) */
.clasif-hero-banner { margin: 0 0 20px 0; padding: 22px 18px; background: linear-gradient(135deg, #0d9488 0%, #0f766e 40%, #134e4a 100%); border-radius: 14px; text-align: center; box-shadow: 0 6px 20px rgba(13,148,136,0.3); border: 2px solid rgba(255,255,255,0.15); color: #fff; }
.clasif-hero-banner h2 { margin: 0 0 8px 0; font-size: 1.35rem; font-weight: 800; color: #fff; }
.clasif-hero-banner p { margin: 0 0 8px 0; font-size: 0.95rem; line-height: 1.45; color: rgba(255,255,255,0.95); }
.clasif-hero-banner .cta-line { margin-top: 14px; font-size: 1rem; font-weight: 700; }
.clasif-hero-banner .cta-line a { color: #fff; text-decoration: underline; }
.clasif-hero-banner .contador-visitantes { margin-top: 16px; padding: 12px 16px; background: rgba(0,0,0,0.2); border-radius: 10px; font-size: 0.95rem; font-weight: 600; display: inline-block; }
.clasif-hero-banner .categorias-destacadas { margin-top: 10px; font-size: 0.85rem; color: rgba(255,255,255,0.9); font-style: italic; }

/* Contador hero PWA: tamaño super visible para campaña */
.clasif-hero-banner .contador-hero { display: block; text-align: center; margin: 20px auto 0 auto; padding: 22px 24px; max-width: 100%; background: rgba(0,0,0,0.2); border-radius: 14px; border: 2px solid rgba(255,255,255,0.25); color: #fff; }
.clasif-hero-banner .contador-hero .contador-hero-texto { margin: 0; font-size: clamp(1.35rem, 5vw, 2.5rem); font-weight: 800; line-height: 1.25; letter-spacing: 0.02em; text-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.clasif-hero-banner .contador-hero .contador-hero-numero { font-size: clamp(1.75rem, 7vw, 3.5rem); font-weight: 900; display: inline-block; margin: 0 4px; letter-spacing: 0.02em; }
.clasif-hero-banner .contador-leyenda { margin: 8px 0 0 0; font-size: 0.7rem; color: rgba(255,255,255,0.75); font-weight: 500; text-align: center; line-height: 1.35; }

.nav-tabs {
  display: flex;
  background: var(--light);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 99;
}

.nav-tab {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: white;
}

.content {
  padding: 20px;
}

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-header {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--dark);
  font-size: 0.9rem;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

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

.form-input.code-input {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 600;
  font-size: 1.2rem;
  text-align: center;
}

.btn {
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

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

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.list-item {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.list-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.list-item-title {
  font-weight: 600;
  color: var(--primary);
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-danger {
  background: #f8d7da;
  color: #721c24;
}

.badge-info {
  background: #d1ecf1;
  color: #0c5460;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.spinner {
  border: 3px solid var(--light);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.notification-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
}

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

.stat-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  opacity: 0.9;
}

.hidden {
  display: none !important;
}

/* Overlay primera visita - Descargar la app */
.pwa-install-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.pwa-install-overlay.hidden {
  display: none !important;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.pwa-install-card {
  background: white;
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.pwa-install-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}
.pwa-install-card h2 {
  color: var(--primary);
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.pwa-install-card p {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}
.btn-install-pwa {
  display: block;
  width: 100%;
  padding: 18px 24px;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(26,58,93,0.4);
}
.btn-install-pwa:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,58,93,0.5);
}
.btn-skip-install {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 0.9rem;
  color: #666;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-skip-install:hover {
  background: var(--light);
}
.pwa-install-hint {
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 12px;
  margin-bottom: 0;
}
.btn-skip-primary {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 16px;
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  margin-bottom: 12px;
}
.btn-skip-primary:hover {
  background: #e8f0f8;
}
.btn-install-outline {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: none;
}
.btn-install-outline:hover {
  background: #e8f0f8;
  color: var(--primary);
}
.pwa-corazon-negocio {
  margin: 0 0 12px 0;
  padding: 12px 16px;
  background: rgba(255,255,255,0.95);
  border: 2px solid var(--primary);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
}
.pwa-policy-footer {
  font-size: 0.7rem;
  color: #666;
  text-align: center;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 1.1rem;
  }
  
  .nav-tab {
    font-size: 0.8rem;
    padding: 12px 6px;
  }
  
  .content {
    padding: 16px;
  }
}
