/* =========================================
   ESTILOS GENERALES Y DE FONDO
   ========================================= */
body {
  /* FONDO: Imagen profesional de leyes (Unsplash) */
  background-image: url("https://images.unsplash.com/photo-1505664194779-8beaceb93744?q=80&w=2070&auto=format&fit=crop");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Capa oscura para legibilidad */
.bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.85);
  /* Azul oscuro transparente */
  z-index: -1;
}

/* =========================================
   PANTALLA DE LOGIN
   ========================================= */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  padding: 2rem 1.75rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 380px;
  text-align: center;
  border-top: 4px solid #003d4c;
}

.login-logo {
  width: 180px;
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  border-radius: 6px;
}

@media (max-width: 576px) {
  .login-card {
    padding: 1.5rem 1.25rem;
    max-width: 340px;
    border-radius: 0.5rem;
  }

  .login-logo {
    width: 150px;
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 400px) {
  .login-card {
    padding: 1.25rem 1rem;
    max-width: 320px;
  }

  .login-logo {
    width: 130px;
    margin-bottom: 1rem;
  }
}

/* =========================================
   ESTILOS DEL BUSCADOR
   ========================================= */
.highlight {
  background-color: #fff3cd;
  color: #856404;
  font-weight: bold;
  padding: 0 2px;
  border-radius: 2px;
  border-bottom: 2px solid #ffeeba;
}

.card {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.metadata-label {
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
}

.metadata-value {
  color: #333;
  font-size: 0.95rem;
}

.context-box {
  background-color: #ffffff;
  border-left: 4px solid #003d4c;
}

.book-cover {
    height: 6cm;
    width: 4cm;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    background-color: #eee;
    border: 1px solid #ddd;
}

.book-cover-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.book-cover-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.history-tag {
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.history-tag:hover {
  background-color: #e9ecef !important;
  border-color: #ced4da !important;
  color: #003d4c !important;
}

.logout-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

/* Result Count Styling */
.result-count {
  font-size: 1.2rem !important;
  /* Slightly larger font size */
  padding: 0.5em 1em !important;
  /* Adjust padding for better look */
}

/* OVERRIDE BOOTSTRAP PRIMARY COLORS (Pantone 548C) */
.text-primary {
  color: #003d4c !important;
}

.btn-primary {
  background-color: #003d4c !important;
  border-color: #003d4c !important;
}

.btn-primary:hover {
  background-color: #002a35 !important;
  /* Un poco más oscuro para hover */
  border-color: #002a35 !important;
}

.form-control:focus {
  border-color: #ced4da !important;
  /* Reset to default or handle via input-group */
  box-shadow: none !important;
}

/* UNIFIED SEARCH BOX FOCUS */
/* When the search input is focused, highlight the whole group (Icon + Input + Button) */
.input-group:has(#search-input:focus) {
  box-shadow: 0 0 0 0.25rem rgba(0, 61, 76, 0.25) !important;
  border-radius: 0.375rem;
  z-index: 3;
}

.input-group:has(#search-input:focus) .input-group-text {
  border-color: #003d4c !important;
  background-color: #fff;
  /* Ensure it stays white */
}

.input-group:has(#search-input:focus) .form-control {
    border-color: #003D4C !important;
}

/* Estilos para centrar el título del modal */
#imageModal .modal-header {
    position: relative;
    justify-content: center;
    border-bottom: none;
    padding: 1.5rem !important; /* Padding igual arriba y abajo para alineación perfecta */
}

#imageModal .modal-title {
    width: 100%;
    text-align: center;
    font-weight: bold;
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8); /* Sombra para mejor lectura */
    padding: 0 3.5rem; /* Espacio de seguridad para que no choque con la X */
}

#imageModal .btn-close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem; /* Alineación fija arriba, igual que el padding del header */
    transform: none; /* Eliminamos el centrado vertical dinámico */
    z-index: 10;
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: 0.5rem;
}
