/* ================================================================
   PORTAL DE FACTURAS — Estilos Profesionales de Clase Mundial (v2)
   ================================================================ */

:root {
  --primary: #2771c2;
  --primary-dark: #1e5aa3;
  --primary-light: #e8f0ff;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ================================================================
   Estilos Base
   ================================================================ */

* {
  box-sizing: border-box;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
}

body {
  background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
  min-height: 100vh;
}

/* Barra superior decorativa */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, #4a90e2 100%);
  z-index: 1030;
}

/* ================================================================
   Card Principal
   ================================================================ */

.card-premium {
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: var(--white);
  margin-top: 0;
  border: 1px solid var(--gray-200);
}

.card-premium:hover {
  box-shadow: var(--shadow-xl) !important;
  transform: translateY(-2px);
}

/* Cabecera Premium */
.card-header-premium {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 16px 20px;
  border: none;
  position: relative;
  overflow: hidden;
}

.card-header-premium::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: float 6s ease-in-out infinite;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.logo-premium {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  animation: slideInLeft 0.6s ease;
}

.header-text {
  flex: 1;
}

.title-main {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
  animation: slideInRight 0.6s ease;
}

.title-sub {
  font-size: 0.85rem;
  margin: 2px 0 0 0;
  opacity: 0.9;
  font-weight: 500;
  animation: slideInRight 0.7s ease 0.1s both;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, 10px); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Card Body Premium */
.card-body-premium {
  background: var(--white);
  position: relative;
}

/* ================================================================
   Indicador de Progreso
   ================================================================ */

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--gray-50);
  border-radius: 12px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.step.active {
  opacity: 1;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
  transition: all 0.3s ease;
  font-size: 14px;
}

.step.active .step-number {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(39, 113, 194, 0.3);
  transform: scale(1.1);
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

.step.active .step-label {
  color: var(--primary);
  font-weight: 700;
}

.step.completed:not(.active) .step-number {
  background: var(--success);
  color: white;
  border-color: var(--success);
  font-size: 0;
}

.step.completed:not(.active) .step-number::after {
  content: '✓';
  font-size: 20px;
  font-weight: 700;
}

.step.completed:not(.active) .step-label {
  color: var(--success);
  font-weight: 600;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--gray-300);
  margin: 0 8px;
  position: relative;
  top: -24px;
}

/* ================================================================
   Alertas Personalizadas
   ================================================================ */

.alert-custom {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  animation: slideDown 0.4s ease;
  border-left: 4px solid;
  margin-bottom: 12px;
}

.alert-info.alert-custom {
  background: #eff6ff;
  color: #0c4a6e;
  border-left-color: #0284c7;
}

.alert-warning.alert-custom {
  background: #fef3c7;
  color: #92400e;
  border-left-color: #f59e0b;
}

.alert-danger.alert-custom {
  background: #fee2e2;
  color: #7f1d1d;
  border-left-color: #dc2626;
}

.alert-success.alert-custom {
  background: #dcfce7;
  color: #166534;
  border-left-color: #22c55e;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   Secciones de Formulario
   ================================================================ */

.form-section {
  background: var(--white);
  border-radius: 12px;
  padding: 16px 20px;
  border: 2px solid var(--gray-200);
  transition: all 0.3s ease;
  margin-bottom: 12px;
}

.form-section:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.icon-section {
  font-size: 1.2rem;
  color: var(--primary);
  width: 28px;
  text-align: center;
}

.section-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0;
}

/* ================================================================
   Inputs y Labels
   ================================================================ */

.form-label-premium {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.required {
  color: var(--danger);
  font-weight: 700;
}

.form-control-premium {
  border: 2px solid var(--gray-300);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: none;
  background: var(--white) !important;
  color: var(--text-primary) !important;
}

.form-control-premium:focus {
  border-color: var(--primary);
  background-color: var(--white) !important;
  box-shadow: 0 0 0 0.2rem rgba(39, 113, 194, 0.15);
  color: var(--text-primary) !important;
}

.form-control-premium::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.input-group-text {
  border: 2px solid var(--gray-300);
  color: var(--text-secondary);
  background-color: var(--white) !important;
}

.input-group-text.bg-transparent {
  background-color: var(--white) !important;
}

.form-text {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ================================================================
   Carga de Archivos (Drag-Drop)
   ================================================================ */

.file-upload-group {
  margin-bottom: 12px;
}

.file-upload-wrapper {
  position: relative;
}

.file-upload-wrapper input[type="file"] {
  display: none;
}

.file-upload-label {
  display: block;
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--primary-light);
  user-select: none;
}

.file-upload-label:hover {
  border-color: var(--primary-dark);
  background: #d4e0ff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.file-upload-wrapper.dragover .file-upload-label {
  border-color: var(--primary-dark);
  background: #d4e0ff;
  box-shadow: 0 6px 20px rgba(39, 113, 194, 0.25);
  transform: scale(1.02);
}

.file-upload-wrapper.file-loaded .file-upload-label {
  border-color: var(--success);
  background: #f0fdf4;
  border-style: solid;
}

.file-upload-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.upload-icon {
  font-size: 1.8rem;
  color: var(--primary);
  transition: all 0.3s ease;
}

.file-upload-label:hover .upload-icon {
  transform: scale(1.1) rotate(-5deg);
}

.upload-text {
  text-align: left;
}

.upload-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-size: 0.9rem;
}

.upload-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.upload-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.file-status {
  display: none;
  padding: 12px;
  margin-top: 12px;
  border-radius: 8px;
  background: #f0fdf4;
  border-left: 4px solid var(--success);
  color: var(--success);
  font-weight: 600;
  font-size: 0.9rem;
  animation: slideDown 0.3s ease;
}

.file-upload-wrapper.file-loaded .file-status {
  display: block;
}

/* ================================================================
   Botones
   ================================================================ */

.btn {
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 24px;
  transition: all 0.3s ease;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

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

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-verify {
  background: linear-gradient(135deg, #4a90e2 0%, var(--primary) 100%);
  color: white;
  min-height: 48px;
  font-size: 1rem;
}

.btn-verify:hover {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  text-decoration: none;
}

.btn-verify:disabled {
  background: var(--gray-300);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-submit {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  font-size: 1rem;
  min-height: 48px;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--text-primary);
  border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-300);
  color: var(--text-primary);
  border-color: var(--gray-400);
}

.button-group {
  margin-top: 8px;
  animation: slideUp 0.6s ease 0.3s both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   Footer del Formulario
   ================================================================ */

.form-footer {
  background: var(--gray-50);
  padding: 16px 20px;
  border-radius: 12px;
  border-top: 1px solid var(--gray-200);
  margin-top: 16px;
}

.form-footer i {
  display: block;
  transition: all 0.3s ease;
  color: var(--primary);
}

.form-footer:hover i {
  transform: scale(1.2);
}

.form-footer p {
  margin: 0;
  color: var(--text-secondary);
}

/* ================================================================
   Honeypot
   ================================================================ */

.hp-field {
  display: none !important;
  visibility: hidden;
  position: absolute;
  left: -9999px;
}

/* ================================================================
   Responsive
   ================================================================ */

@media (max-width: 768px) {
  .card-header-premium {
    padding: 20px 16px;
  }

  .header-content {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .logo-premium {
    height: 50px;
  }

  .title-main {
    font-size: 1.5rem;
  }

  .title-sub {
    font-size: 0.85rem;
  }

  .progress-steps {
    margin-bottom: 20px;
    gap: 8px;
  }

  .step {
    flex-direction: column;
  }

  .step-label {
    font-size: 0.6rem;
  }

  .step-line {
    top: -28px;
    margin: 0 4px;
  }

  .file-upload-content {
    flex-direction: column;
    gap: 12px;
  }

  .upload-icon {
    font-size: 2rem;
  }

  .form-section {
    padding: 16px;
  }

  .form-footer {
    padding: 16px;
  }

  .form-footer p {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px;
  }

  .container-fluid {
    padding: 0;
  }

  .card-body-premium {
    padding: 16px !important;
  }

  .progress-steps {
    display: none;
  }

  .card-header-premium {
    padding: 16px;
  }

  .title-main {
    font-size: 1.3rem;
  }

  .title-sub {
    font-size: 0.8rem;
  }

  .form-section {
    padding: 16px;
    margin-bottom: 16px;
  }

  .file-upload-label {
    padding: 16px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .upload-subtitle {
    font-size: 0.8rem;
  }

  .section-header {
    margin-bottom: 16px;
  }
}

/* ================================================================
   Utilidades
   ================================================================ */

.text-muted {
  color: var(--text-secondary) !important;
}

.border-top {
  border-top: 1px solid var(--gray-200) !important;
}

.min-vh-100 {
  min-height: 100vh;
}

/* ================================================================
   Animaciones de Carga
   ================================================================ */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ================================================================
   Soporte Bootstrap (garantizar que se sobrescriba)
   ================================================================ */

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  background-color: var(--white) !important;
  color: var(--text-primary) !important;
  border-color: var(--gray-300) !important;
}

.form-control:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  background-color: var(--white) !important;
  color: var(--text-primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(39, 113, 194, 0.15) !important;
}
