/* ========================================
   EAC Limpiezas V2 - Estilos Base
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&display=swap');

:root {
  /* Paleta EAC corporativa */
  --color-primary: #EE4550;        /* Rojo EAC */
  --color-primary-dark: #2D142C;   /* Morado EAC */
  --color-primary-light: #C72C41;  /* Rojo 100 */
  --color-success: #28a745;
  --color-danger: #C72C41;
  --color-warning: #d4a017;
  --color-info: #510A32;           /* Morado 75 */
  --color-purple: #801336;         /* Morado 50 */
  --color-bg: #F6F4F2;            /* Gris Claro 75 */
  --color-card: #FFFFFF;
  --color-text: #333333;           /* Negro 100 */
  --color-text-muted: #BDB6B0;    /* Gris Oscuro 100 */
  --color-border: #E0DCD8;        /* Gris Oscuro 50 */
  --color-bg-warm: #F1EEEC;       /* Gris Claro 100 */
  --shadow: 0 2px 8px rgba(45, 20, 44, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Figtree', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

/* ========================================
   Login Page
   ======================================== */
body.login-page {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-dark) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  background: var(--color-card);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-container h1 {
  margin: 0 0 10px;
  color: var(--color-primary);
  font-size: 28px;
  font-weight: 300;
}

.login-container h2 {
  margin: 0 0 30px;
  color: var(--color-text-muted);
  font-size: 16px;
  font-weight: normal;
}

/* ========================================
   Layout con Menú
   ======================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--color-primary-dark) 0%, #510A32 50%, var(--color-primary-dark) 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
  margin: 0;
  font-size: 20px;
}

.sidebar-header .user-info {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.8;
}

/* Menú */
.menu {
  list-style: none;
  margin: 0;
  padding: 10px 0;
  flex: 1;
}

.menu-item {
  margin: 2px 0;
}

.menu-link {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.menu-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.menu-link.active {
  background: rgba(238, 69, 80, 0.2);
  border-left-color: var(--color-primary);
  color: white;
}

.menu-icon {
  width: 24px;
  margin-right: 12px;
  text-align: center;
}

.menu-section {
  padding: 20px 20px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.5);
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 10px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.2);
}

/* Main Content */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 30px;
  max-width: calc(100% - 260px);
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.page-header p {
  margin: 0;
  color: var(--color-text-muted);
}

/* ========================================
   Componentes
   ======================================== */

/* Cards */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.card-title {
  margin: 0;
  font-size: 18px;
}

/* Formularios */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(238, 69, 80, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Botones */
button {
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--color-primary-light);
}

.btn-primary:disabled {
  background: #a0c4e8;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-success {
  background: var(--color-success);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-success:hover {
  background: #218838;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-warning {
  background: var(--color-warning);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-warning:hover {
  background: #b8941d;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  text-decoration: underline;
  padding: 8px;
  font-size: 13px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-danger {
  background: #f8d7da;
  color: var(--color-primary-light);
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-info {
  background: #f3e6f0;
  color: var(--color-primary-dark);
}

.badge-default {
  background: var(--color-bg-warm);
  color: #666;
}

.badge-secondary {
  background: #e2e8f0;
  color: #4a5568;
}

/* Edición de fotos en modal */
.fotos-edicion {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.foto-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.foto-item img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.foto-item img.foto-clickable {
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
}

.foto-item img.foto-clickable:hover {
  opacity: 0.85;
  border-color: #4a90d9;
}

.foto-missing {
  width: 100px;
  height: 80px;
  background: #f0f0f0;
  border-radius: 6px;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #999;
}

/* Tablas */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: var(--color-bg-warm);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
}

tr:hover {
  background: var(--color-bg);
}

/* Mensajes */
.message {
  margin: 16px 0;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: pre-wrap;
}

.message-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.message-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

/* Fotos */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

.photo-box {
  background: #fafafa;
  border: 2px dashed #ddd;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.photo-box.has-image {
  border-style: solid;
  border-color: var(--color-primary);
}

.photo-box img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  cursor: pointer;
}

.photo-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

/* Botón imagen estándar */
.btn-std-imagen {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px;
  color: #555;
  background: #f0f0f0;
  border: 1px dashed #aaa;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-std-imagen:hover {
  background: #e0e8ff;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-std-imagen.activo {
  background: #d4edda;
  border-color: #28a745;
  border-style: solid;
  color: #155724;
  font-weight: 600;
}

/* Filtros */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--color-bg-warm);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #eee;
  margin-bottom: 20px;
}

.tab {
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab:hover {
  color: var(--color-primary);
}

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* Loading */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 20px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .photo-grid {
    grid-template-columns: 1fr;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Utilidades */
.hidden {
  display: none !important;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-center {
  text-align: center;
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ── Tarjetas de registro (reg-card) ─────────────────────── */
.reg-listado {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reg-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 32px 0;
  font-size: 14px;
}

.reg-card {
  display: flex;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .15s;
}

.reg-card:hover {
  box-shadow: 0 4px 14px rgba(45, 20, 44, 0.13);
}

.reg-card.is-virtual {
  opacity: 0.7;
  background: var(--color-bg-warm);
}

/* Franja de color lateral */
.reg-stripe {
  width: 5px;
  flex-shrink: 0;
}
.reg-stripe-pending    { background: var(--color-warning); }
.reg-stripe-validated  { background: var(--color-success); }
.reg-stripe-rejected   { background: var(--color-danger); }     /* rojo — rechazo */
.reg-stripe-unrealized { background: #d97706; }                  /* ámbar — sin realizar */
.reg-stripe-todo       { background: #60a5fa; }

/* Cuerpo de la tarjeta */
.reg-body {
  flex: 1;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

/* Fila 1: periodo, ID, badge */
.reg-r1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reg-periodo {
  font-size: 12px;
  font-weight: 600;
  color: #777;
  letter-spacing: .03em;
}

.reg-id {
  font-size: 12px;
  font-weight: 600;
  color: #555;
}

.reg-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.reg-badge-pending    { background: #fff3cd; color: #7a5000; border: 1px solid #f0d080; }
.reg-badge-validated  { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.reg-badge-rejected   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.reg-badge-unrealized { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; } /* ámbar — sin realizar */
.reg-badge-todo       { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* Fila 2: nombre + dirección */
.reg-r2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reg-atm-name {
  font-weight: 700;
}

.reg-sep {
  color: var(--color-text-muted);
  margin: 0 3px;
}

.reg-address {
  color: var(--color-text);
}

.reg-city {
  color: var(--color-text);
  font-weight: 500;
}

/* Fila 3: metadatos (provincia, tipo, tier) */
.reg-r3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 12px;
}

.reg-meta {
  font-size: 12px;
  color: #777;
}

.reg-meta strong {
  color: var(--color-text);
  font-weight: 600;
}

.reg-dot {
  width: 3px;
  height: 3px;
  background: var(--color-border);
  border-radius: 50%;
  display: inline-block;
  margin: 0 4px;
  vertical-align: middle;
}

/* Divisor */
.reg-divider {
  height: 1px;
  background: var(--color-border);
  margin: 3px 0;
}

/* Fila 4: info de limpieza */
.reg-r4 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 12px;
}

.reg-sin-limpieza {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
}

.reg-fecha {
  font-weight: 600;
  color: var(--color-text);
}

.reg-tipo {
  font-size: 12px;
  color: var(--color-text);
}

.reg-comentario {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* Fila 5: comentarios supervisor / super user */
.reg-r5 {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.reg-comment-box {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--color-text);
  line-height: 1.4;
}

.rcb-supervisor {
  background: #f0f4ff;
  border-left: 3px solid #6366f1;
}

.rcb-superuser {
  background: #fff7ed;
  border-left: 3px solid var(--color-warning);
}

.rcb-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

/* Área de acciones (botones) */
.reg-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-left: 1px solid var(--color-border);
  background: var(--color-bg-warm);
  flex-shrink: 0;
}

/* ── Validación en lote (bulk checkboxes) ────────────────── */
.bulk-chk-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  cursor: pointer;
  flex-shrink: 0;
  background: var(--color-bg-warm);
  border-right: 1px solid var(--color-border);
  transition: background .15s;
}
.bulk-chk-col input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--color-primary);
}
.reg-card.bulk-selected {
  border-color: var(--color-primary);
  background: #fff8f8;
}
.reg-card.bulk-selected .bulk-chk-col {
  background: #ffe8e8;
}
#btnValidarLote {
  white-space: nowrap;
}
#btnValidarLote:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ── Barra de resumen del mes (mis-limpiezas) ───────────────── */
.resumen-mes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 14px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 12px;
  margin-bottom: 0;
}
.resumen-label {
  font-weight: 600;
  color: #555;
  margin-right: 4px;
  white-space: nowrap;
}
.resumen-sep {
  color: var(--color-border);
  font-size: 14px;
}
.resumen-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.chip-unrealized { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; } /* ámbar — sin realizar */
.chip-pending    { background: #fff3cd; color: #7a5000; border: 1px solid #f0d080; }
.chip-rejected   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.chip-validated  { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* ── Responsive: 2 columnas en pantallas grandes ─────────── */
@media (min-width: 1280px) {
  .reg-listado {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .reg-listado > .reg-empty,
  .reg-listado > p {
    grid-column: 1 / -1;
  }
  .reg-comentario { max-width: 500px; }
  .reg-comment-box { max-width: 400px; }
}

/* ══════════════════════════════════════════════════════
   Perfil — seguridad de contraseña
   ══════════════════════════════════════════════════════ */

/* Banner contraseña caducada */
.pass-expired-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}

/* Input con botón ojo */
.pass-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.pass-wrapper input[type="password"],
.pass-wrapper input[type="text"] {
  flex: 1;
  padding-right: 44px;
}
.btn-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color .2s;
}
.btn-eye:hover { color: var(--color-primary); }

/* Barra de fortaleza */
.pass-strength {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pass-strength-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.pass-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width .3s, background .3s;
}
.pass-strength-label {
  font-size: 12px;
  font-weight: 600;
  min-width: 72px;
  text-align: right;
}

/* Lista de requisitos */
.pass-requirements {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.pass-req-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 8px;
}
.pass-requirements ul {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.req-item {
  font-size: 13px;
  padding-left: 20px;
  position: relative;
}
.req-item::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}
.req-fail::before { content: '✗'; color: #ef4444; }
.req-ok::before   { content: '✓'; color: #22c55e; }
.req-fail { color: #6b7280; }
.req-ok   { color: #15803d; }
.pass-req-disclaimer {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}
