/* ============================================================
   J&C Distribuciones - Custom Styles
   Paleta: #014B68 (petróleo) · #87BF74 (verde) · #F5F7F8 (fondo) · #333333 (texto)
   ============================================================ */

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

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #333333;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  padding-top: 68px;
}

/* ============================================================
   Navbar
   ============================================================ */
#navbar {
  transition: box-shadow 0.3s ease, background 0.3s ease;
}
#navbar.scrolled {
  box-shadow: 0 4px 24px rgba(1,75,104,0.12);
  background: rgba(255,255,255,0.98) !important;
}

.nav-link {
  position: relative;
  padding: 0.5rem 0.875rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
  border-radius: 0.5rem;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}
.nav-link:hover,
.nav-link.active {
  color: #014B68;
  background: #F5F7F8;
}

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 180px;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  border: 1px solid #e2e8f0;
  padding: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown-menu a {
  display: block;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.dropdown-menu a:hover { background: #F5F7F8; color: #014B68; }

/* ============================================================
   Botones
   ============================================================ */
.btn-primary {
  display: inline-block;
  background: #87BF74;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  line-height: 1.4;
}
.btn-primary:hover {
  background: #72a860;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(135,191,116,0.38);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-block;
  background: #014B68;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-secondary:hover { background: #015f88; transform: translateY(-1px); }

.btn-outline {
  display: inline-block;
  border: 2px solid #014B68;
  color: #014B68;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.btn-outline:hover { background: #014B68; color: white; transform: translateY(-1px); }

.btn-outline-white {
  display: inline-block;
  border: 2px solid rgba(255,255,255,0.7);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.625rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.btn-outline-white:hover {
  background: rgba(255,255,255,0.15);
  border-color: white;
  transform: translateY(-1px);
}

.btn-lg { padding: 0.875rem 2rem !important; font-size: 1rem !important; border-radius: 0.625rem !important; }

.mobile-nav-link {
  display: block;
  padding: 0.625rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav-link:hover { background: #F5F7F8; color: #014B68; }

/* ============================================================
   Hero Principal (home)
   ============================================================ */
.hero-bg {
  background: linear-gradient(135deg, #013040 0%, #014B68 45%, #015f88 100%);
  position: relative;
  overflow: hidden;
}
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(135,191,116,0.09) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(1,95,136,0.4) 0%, transparent 50%);
}
.hero-grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}
.hero-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ============================================================
   Secciones
   ============================================================ */
.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #87BF74;
  background: rgba(135,191,116,0.12);
  padding: 0.25rem 0.875rem;
  border-radius: 9999px;
  margin-bottom: 0.875rem;
}
.section-title {
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  font-weight: 800;
  color: #014B68;
  line-height: 1.15;
}
.section-subtitle {
  font-size: 1.0625rem;
  color: #64748b;
  line-height: 1.7;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  overflow: hidden;
}
.card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  transform: translateY(-4px);
}

.brand-card {
  background: white;
  border: 1.5px solid #e8edf5;
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  cursor: default;
}
.brand-card:hover {
  border-color: #87BF74;
  box-shadow: 0 8px 30px rgba(135,191,116,0.15);
  transform: translateY(-3px);
}
.brand-logo {
  width: 72px;
  height: 72px;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 800;
  color: white;
  margin-bottom: 0.875rem;
  letter-spacing: -0.02em;
}

/* Stats */
.stat-number { font-size: clamp(2rem, 5vw, 3rem); font-weight: 900; color: #014B68; line-height: 1; }
.stat-label  { font-size: 0.875rem; font-weight: 500; color: #64748b; margin-top: 0.25rem; }

/* ============================================================
   Formularios
   ============================================================ */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}
.form-label span.required { color: #ef4444; margin-left: 2px; }

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: #333333;
  background: #F5F7F8;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.625rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}
.form-input:focus {
  border-color: #014B68;
  background: white;
  box-shadow: 0 0 0 3px rgba(1,75,104,0.1);
}
.form-input.error { border-color: #ef4444; background: #fff8f8; }
.form-input::placeholder { color: #94a3b8; }

.form-error { font-size: 0.8125rem; color: #ef4444; margin-top: 0.25rem; display: none; }
.form-error.visible { display: block; }

.form-select {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-size: 0.9375rem;
  color: #333333;
  background: #F5F7F8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 0.875rem center;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.625rem;
  appearance: none; -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none; cursor: pointer; font-family: inherit;
}
.form-select:focus {
  border-color: #014B68;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(1,75,104,0.1);
}

.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: #333333;
  background: #F5F7F8;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.625rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none; resize: vertical; min-height: 120px; font-family: inherit;
}
.form-textarea:focus {
  border-color: #014B68;
  background: white;
  box-shadow: 0 0 0 3px rgba(1,75,104,0.1);
}

/* File Upload */
.file-upload-area {
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #F5F7F8;
}
.file-upload-area:hover, .file-upload-area.dragover {
  border-color: #014B68;
  background: rgba(1,75,104,0.04);
}
.file-upload-area input[type="file"] { display: none; }

/* Checkbox items */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.checkbox-item {
  display: flex; align-items: center; gap: 0.5rem;
  background: #F5F7F8; border: 1.5px solid #e2e8f0; border-radius: 0.5rem;
  padding: 0.4rem 0.875rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s; user-select: none;
}
.checkbox-item input[type="checkbox"] { display: none; }
.checkbox-item.checked { border-color: #014B68; background: rgba(1,75,104,0.07); }
.checkbox-item span { font-size: 0.875rem; font-weight: 500; color: #475569; }
.checkbox-item.checked span { color: #014B68; }

/* Mensajes de formulario */
.form-success, .form-error-msg {
  display: none; padding: 1rem 1.25rem; border-radius: 0.75rem;
  font-size: 0.9375rem; font-weight: 500; margin-bottom: 1.5rem;
}
.form-success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; }
.form-error-msg { background: #fef2f2; border: 1.5px solid #fca5a5; color: #991b1b; }
.form-success.show, .form-error-msg.show { display: block; }

/* Submit loading */
.btn-submit { position: relative; min-width: 180px; justify-content: center; }
.btn-submit .btn-text { transition: opacity 0.2s; }
.btn-submit .btn-spinner { display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.btn-submit.loading .btn-text { opacity: 0; }
.btn-submit.loading .btn-spinner { display: block; }
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }
.spinner-ring {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* ============================================================
   Territory Cards
   ============================================================ */
.territory-card {
  background: white; border: 1.5px solid #e8edf5; border-radius: 0.875rem;
  padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.territory-card:hover {
  border-color: #87BF74;
  box-shadow: 0 4px 20px rgba(135,191,116,0.15);
  transform: translateY(-2px);
}
.territory-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #014B68, #015f88);
  border-radius: 0.625rem; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: white; font-size: 1.125rem;
}

/* ============================================================
   Sede Cards
   ============================================================ */
.sede-card {
  background: white; border-radius: 1.25rem; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transition: box-shadow 0.3s, transform 0.3s;
}
.sede-card:hover {
  box-shadow: 0 16px 48px rgba(0,0,0,0.13);
  transform: translateY(-4px);
}
.sede-card-header {
  background: linear-gradient(135deg, #014B68, #015f88);
  padding: 1.5rem 2rem; color: white;
}
.sede-card-body { padding: 1.75rem 2rem; }
.sede-info-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.625rem 0; border-bottom: 1px solid #f1f5f9;
}
.sede-info-row:last-child { border-bottom: none; }
.sede-info-icon {
  width: 32px; height: 32px; background: rgba(1,75,104,0.08);
  border-radius: 0.5rem; display: flex; align-items: center; justify-content: center;
  color: #014B68; flex-shrink: 0; font-size: 0.8125rem;
}

/* ============================================================
   Value Cards
   ============================================================ */
.value-card {
  background: white; border-radius: 1rem; padding: 2rem; border-top: 4px solid;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: box-shadow 0.3s, transform 0.3s;
}
.value-card:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.1); transform: translateY(-4px); }

/* ============================================================
   Footer
   ============================================================ */
.footer-bg { background: #013040; }
.footer-link {
  display: block; font-size: 0.875rem; color: #94a3b8;
  text-decoration: none; padding: 0.2rem 0; transition: color 0.15s;
}
.footer-link:hover { color: #87BF74; }
.social-btn {
  width: 38px; height: 38px; background: rgba(1,75,104,0.6); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: 0.875rem; text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.social-btn:hover { background: #87BF74; color: white; transform: translateY(-2px); }

/* ============================================================
   Page Hero (páginas interiores)
   Padding reducido porque body ya tiene padding-top:68px para el navbar
   ============================================================ */
.page-hero {
  background: linear-gradient(135deg, #013040 0%, #014B68 60%, #015f88 100%);
  padding: 2.5rem 1rem 3rem;  /* Sin 7rem - el cuerpo ya compensa el navbar */
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 20px 20px;
}
.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8125rem; color: rgba(255,255,255,0.55); margin-bottom: 1rem;
}
.breadcrumb a { color: rgba(255,255,255,0.55); text-decoration: none; transition: color 0.15s; }
.breadcrumb a:hover { color: #87BF74; }

/* ============================================================
   Animaciones
   ============================================================ */
.fade-in {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }
.fade-in-delay-1 { transition-delay: 0.1s; }
.fade-in-delay-2 { transition-delay: 0.2s; }
.fade-in-delay-3 { transition-delay: 0.3s; }
.fade-in-delay-4 { transition-delay: 0.4s; }
.fade-in-delay-5 { transition-delay: 0.5s; }

/* ============================================================
   Admin Panel
   ============================================================ */
.admin-table th {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: #64748b; padding: 0.75rem 1rem; background: #F5F7F8;
  border-bottom: 2px solid #e2e8f0; white-space: nowrap;
}
.admin-table td {
  padding: 0.875rem 1rem; font-size: 0.875rem; color: #333333;
  border-bottom: 1px solid #f1f5f9; vertical-align: middle;
}
.admin-table tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 0.2rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.badge-pendiente  { background: #fef9c3; color: #854d0e; }
.badge-revisado   { background: #dbeafe; color: #1e40af; }
.badge-contactado { background: #dcfce7; color: #166534; }
.badge-descartado { background: #fee2e2; color: #991b1b; }
.badge-nuevo      { background: #fef9c3; color: #854d0e; }
.badge-activo     { background: #dcfce7; color: #166534; }

/* ============================================================
   Utilidades
   ============================================================ */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section-py { padding-top: 5rem; padding-bottom: 5rem; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, #e2e8f0, transparent); }

.title-underline { position: relative; display: inline-block; }
.title-underline::after {
  content: ''; position: absolute; left: 0; bottom: -6px;
  width: 60%; height: 4px;
  background: linear-gradient(90deg, #87BF74, #a8d494);
  border-radius: 2px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .section-py { padding-top: 3.5rem; padding-bottom: 3.5rem; }
  .container  { padding: 0 1rem; }
  body { padding-top: 60px; } /* navbar más pequeño en móvil */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
