/* ==========================================================================
   PORTAL DE RECIBOS DE NÓMINA - LA FERRE COMERCIALIZADORA
   Estilos CSS Modernos, Elegantes y Corporativos
   ========================================================================== */

:root {
  --primary: #0f172a;        /* Azul Oscuro Corporativo */
  --primary-light: #1e293b;  /* Slate Oscuro */
  --accent: #f97316;         /* Naranja La Ferre (Default) */
  --accent-hover: #ea580c;
  --success: #10b981;        /* Verde Percepciones */
  --danger: #ef4444;         /* Rojo Deducciones */
  --warning: #f59e0b;        /* Ámbar Alertas */
  --info: #3b82f6;           /* Azul Información */
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ==========================================================================
   TEMAS MULTI-EMPRESA (La Ferre vs Transportes Flores Vega)
   ========================================================================== */

body.theme-laferre {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #f97316;
  --accent-hover: #ea580c;
}

body.theme-floresvega {
  --primary: #1c1917;         /* Gris Oscuro Cantera */
  --primary-light: #292524;
  --accent: #65a30d;          /* Verde Olivo / Lima */
  --accent-hover: #4d7c0f;    /* Verde Olivo Oscuro */
}

/* Badge Razón Social */
.company-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.company-badge.la-ferre {
  background-color: rgba(249, 115, 22, 0.15);
  color: #ea580c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.company-badge.flores-vega {
  background-color: rgba(101, 163, 13, 0.15);
  color: #4d7c0f;
  border: 1px solid rgba(101, 163, 13, 0.3);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   PANTALLA DE LOGIN
   ========================================================================== */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #334155 100%);
  padding: 1.5rem;
  position: relative;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 80% 20%, rgba(249, 115, 22, 0.15), transparent 40%);
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.brand-icon {
  font-size: 2.2rem;
  color: var(--accent);
}

.brand-name {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--primary);
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
  background-color: #f8fafc;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
  background-color: #fff;
}

.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.forgot-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover {
  text-decoration: underline;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

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

.btn-secondary:hover {
  background-color: var(--primary-light);
}

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

.btn-outline:hover {
  background-color: #f1f5f9;
}

.btn-block {
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
}

.badge-s3 {
  background-color: #ff9900;
  color: #111;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.login-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.demo-user-selector {
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.demo-selector-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.demo-btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.demo-btn {
  font-size: 0.75rem;
  padding: 0.35rem 0.4rem;
  white-space: nowrap;
  background-color: white;
}

.demo-btn:hover {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

.system-info {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* ==========================================================================
   ESTRUCTURA Y NAVBAR DEL PORTAL
   ========================================================================== */

.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar {
  background-color: var(--primary);
  color: white;
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.navbar-icon {
  font-size: 1.8rem;
  color: var(--accent);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text .main-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-text .sub-title {
  font-size: 0.75rem;
  color: var(--text-light);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.s3-status-pill {
  background-color: rgba(255, 153, 0, 0.15);
  border: 1px solid rgba(255, 153, 0, 0.4);
  color: #ffaa00;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background-color: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-light);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.btn-icon:hover {
  color: white;
  background-color: rgba(255,255,255,0.1);
}

/* ==========================================================================
   CONTENIDO PRINCIPAL
   ========================================================================== */

.app-content {
  flex: 1;
  padding: 2rem;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

.welcome-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.welcome-banner::after {
  content: '';
  position: absolute;
  right: -50px;
  bottom: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.banner-text h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.banner-text h1 span {
  color: var(--accent);
}

.banner-text p {
  font-size: 0.92rem;
  color: #cbd5e1;
  max-width: 850px;
  margin-bottom: 1.5rem;
}

.employee-info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.info-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.info-card.highlight-card {
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.3);
}

.card-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.info-card .label {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-card .value {
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
}

/* ==========================================================================
   METRIC CARDS (RESUMEN FINANCIERO)
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  border: 1px solid var(--border-color);
}

.metric-card.featured-metric {
  border-left: 4px solid var(--info);
  background-color: #f0f9ff;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.metric-header i {
  font-size: 1.25rem;
}

.icon-green { color: var(--success); }
.icon-red { color: var(--danger); }
.icon-blue { color: var(--info); }
.icon-amber { color: var(--warning); }

.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-blue { color: var(--info); }
.text-amber { color: var(--warning); }

.metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.metric-subtext {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ==========================================================================
   SECCIÓN DE TABLA DE RECIBOS Y FILTROS
   ========================================================================== */

.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.filter-bar {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  background-color: #f1f5f9;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
}

.filter-group select {
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: white;
  outline: none;
  cursor: pointer;
}

/* TABLA RESPONSIVA */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table th {
  background-color: #f8fafc;
  color: var(--primary-light);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

.btn-group-sm {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   MODAL DE RECIBO DE NÓMINA (CFDI BREAKDOWN)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

.modal-card {
  background-color: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  background-color: var(--primary);
  color: white;
  padding: 1.25rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.modal-icon {
  font-size: 1.8rem;
  color: var(--accent);
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-header .subtext {
  font-size: 0.8rem;
  color: var(--text-light);
}

.btn-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.btn-close:hover { opacity: 1; }

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.cfdi-header-box {
  background-color: #f8fafc;
  border: 1px dashed var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
}

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.concepts-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.box-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.mini-table th {
  text-align: left;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.mini-table td {
  padding: 0.4rem 0;
  border-bottom: 1px dashed #f1f5f9;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

.cfdi-total-bar {
  background-color: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.total-item strong {
  font-size: 1.1rem;
  display: block;
}

.s3-info-box {
  background-color: #fff7ed;
  border: 1px solid #ffedd5;
  padding: 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.83rem;
}

.s3-big-icon {
  font-size: 2.2rem;
  color: #f97316;
}

.modal-footer {
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.75rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================================================
   PANEL ADMINISTRATIVO (Pestañas, Tablas de Gestión y Controles)
   ========================================================================== */

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--primary);
  background-color: rgba(241, 245, 249, 0.6);
}

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

.badge-active {
  background-color: #d1fae5;
  color: #065f46;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-inactive {
  background-color: #fee2e2;
  color: #991b1b;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
