/* =========================================================================
   BIBLIOTECA - ESTILOS ESPECÍFICOS
   ========================================================================= */

/* =========================================================================
   OPCIÓN 1: PESTAÑAS
   ========================================================================= */
.biblioteca-tabs {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  border-bottom: 2px solid rgba(0, 75, 135, 0.2);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 1rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  bottom: -2px;
}

.tab-btn:hover {
  color: var(--brand-primary);
}

.tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.tab-content-wrapper {
  position: relative;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SECCIÓN INTRO */
.section-intro {
  margin-bottom: 2rem;
}

.section-intro h2 {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.section-intro p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 800px;
}

/* FILTROS POR ZONA */
.zona-filters {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
  flex-wrap: wrap;
}

.zona-btn {
  background: rgba(0, 75, 135, 0.08);
  border: 1px solid rgba(0, 75, 135, 0.2);
  padding: 0.6rem 1.25rem;
  border-radius: 20px;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zona-btn:hover {
  background: rgba(0, 75, 135, 0.15);
  border-color: var(--brand-primary);
  transform: translateY(-2px);
}

.zona-btn.active {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
  transform: scale(1.05);
}

/* =========================================================================
   GRID DE OBRAS
   ========================================================================= */
.obras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.obra-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s ease,
              border-color 0.3s ease;
  border: 2px solid var(--brand-primary);
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Clases para filtrado - fade simple */
.obra-card.card-hiding {
  animation: cardFadeOut 0.5s ease forwards;
}

.obra-card.card-hidden {
  display: none;
}

.obra-card.card-showing {
  animation: cardFadeIn 0.5s ease forwards;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cardFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.obra-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0, 75, 135, 0.15);
  border-color: var(--brand-primary);
}

.obra-card.featured {
  border: 2px solid var(--brand-primary);
}


.obra-image-placeholder {
  width: 100%;
  height: 220px;
  background: linear-gradient(135deg, rgba(0, 75, 135, 0.08) 0%, rgba(0, 75, 135, 0.15) 100%);
  border: 2px dashed rgba(0, 75, 135, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
  font-size: 0.95rem;
  font-weight: 500;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
}

/* Cuando hay imagen, ocultar el borde punteado del placeholder */
.obra-image-placeholder:has(img) {
  border: none;
}

.obra-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  display: block;
}

/* Ajuste específico para Zona Centro - mostrar más abajo */
.obra-card[data-zona="centro"] .obra-image-placeholder img {
  object-position: center 80%;
}

.obra-info {
  padding: 1.5rem;
}

.obra-info h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  font-weight: 600;
}

.obra-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.zona-centro {
  background: rgba(255, 183, 77, 0.15);
  color: #b37400;
}

.zona-altiplano {
  background: rgba(239, 83, 80, 0.15);
  color: #b71c1c;
}

.zona-patagonia {
  background: rgba(66, 165, 245, 0.15);
  color: #0277bd;
}

.zona-chiloe {
  background: rgba(102, 187, 106, 0.15);
  color: #2e7d32;
}

.obra-gran-formato {
  background: rgba(0, 75, 135, 0.15);
  color: var(--brand-primary);
}

.obra-mediacion {
  background: rgba(156, 39, 176, 0.15);
  color: #7b1fa2;
}

.obra-duracion {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.obra-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-ver-mas {
  background: transparent;
  border: 1px solid var(--brand-primary);
  color: var(--brand-primary);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  font-family: var(--font-button);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-ver-mas:hover {
  background: var(--brand-primary);
  color: white;
  transform: translateY(-2px);
}

/* =========================================================================
   MODAL A PANTALLA COMPLETA CON CARRUSEL
   ========================================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.modal-overlay.active {
  display: block;
  opacity: 1;
}

.modal-content {
  background: var(--porcelain);
  max-width: 900px;
  margin: 2rem auto;
  border-radius: 16px;
  position: relative;
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes modalSlideIn {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 44px;
  height: 44px;
  background: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.modal-close:hover {
  transform: scale(1.1);
  background: var(--brand-primary);
  color: white;
}

.modal-close svg {
  width: 22px;
  height: 22px;
}

.modal-body {
  padding: 2.5rem 2rem 2rem;
}

.modal-header {
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-size: 2.4rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  line-height: 1.2;
}

.modal-badge {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.modal-duracion {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-left: 1rem;
}

/* CARRUSEL DE FOTOS */
.modal-carousel {
  position: relative;
  margin: 1.5rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.carousel-main {
  width: 100%;
  height: 400px;
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.carousel-slide.active {
  opacity: 1;
}

.carousel-slide img,
.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-placeholder {
  color: var(--brand-primary);
  font-size: 1rem;
  text-align: center;
  padding: 2rem;
  font-weight: 500;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 10;
}

.carousel-nav:hover {
  background: var(--brand-primary);
  color: white;
  transform: translateY(-50%) scale(1.1);
}

.carousel-nav.prev {
  left: 15px;
}

.carousel-nav.next {
  right: 15px;
}

.carousel-nav svg {
  width: 22px;
  height: 22px;
}

.carousel-thumbnails {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  overflow-x: auto;
  border-top: 1px solid rgba(0, 75, 135, 0.1);
}

.carousel-thumb {
  width: 70px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  flex-shrink: 0;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-thumb:hover {
  border-color: var(--brand-primary);
  transform: scale(1.05);
}

.carousel-thumb.active {
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0, 75, 135, 0.3);
}

.carousel-thumb img,
.carousel-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.carousel-thumb-placeholder {
  font-size: 0.65rem;
  color: var(--brand-primary);
  text-align: center;
  padding: 0.25rem;
  font-weight: 500;
}

/* INFORMACIÓN DEL MODAL */
.modal-info {
  margin-top: 2rem;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.modal-info h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--brand-primary);
}

.modal-info p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid rgba(0, 75, 135, 0.1);
}

.detail-item {
  text-align: left;
}

.detail-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.detail-value {
  font-size: 1.1rem;
  color: var(--text-main);
  font-weight: 600;
}

.modal-cta {
  margin-top: 2rem;
  text-align: center;
}

.modal-cta .btn-primary {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
}

/* Responsive del modal */
@media (max-width: 900px) {
  .modal-overlay {
    padding: 1rem 0.5rem;
  }

  .modal-content {
    margin: 1rem auto;
    border-radius: 12px;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .modal-body {
    padding: 2rem 1.5rem 1.5rem;
  }

  .modal-header h2 {
    font-size: 1.8rem;
  }

  .carousel-main {
    height: 250px;
  }

  .carousel-nav {
    width: 38px;
    height: 38px;
  }

  .carousel-nav.prev {
    left: 10px;
  }

  .carousel-nav.next {
    right: 10px;
  }

  .carousel-thumbnails {
    padding: 0.75rem;
    gap: 0.4rem;
  }

  .carousel-thumb {
    width: 55px;
    height: 40px;
  }

  .carousel-thumb-placeholder {
    font-size: 0.6rem;
  }

  .modal-info {
    padding: 1.5rem;
  }

  .modal-details {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .modal-cta .btn-primary {
    width: 100%;
    padding: 0.9rem 1.5rem;
  }
}

/* =========================================================================
   PÁGINA DE CONSULTA - FORMULARIO
   ========================================================================= */
.consulta-form-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.form-container {
  background: white;
  padding: 3rem 2.5rem;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 75, 135, 0.08);
}

.obra-info-banner {
  background: rgba(0, 75, 135, 0.08);
  border-left: 4px solid var(--brand-primary);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.obra-info-banner h3 {
  font-size: 1.4rem;
  color: var(--brand-primary);
  margin: 0;
}

.consulta-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.9rem 1.2rem;
  border: 2px solid rgba(0, 75, 135, 0.15);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-serif);
  transition: all 0.3s ease;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 75, 135, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.checkbox-group {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 0.2rem;
  cursor: pointer;
}

.checkbox-group label {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 2rem;
  border-top: 2px solid rgba(0, 75, 135, 0.1);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

/* Responsive del formulario */
@media (max-width: 768px) {
  .form-container {
    padding: 2rem 1.5rem;
  }

  .consulta-form {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    text-align: center;
  }
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 900px) {
  .biblioteca-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tab-btn {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid transparent;
  }

  .tab-btn.active {
    border-bottom-color: var(--brand-primary);
  }

  .zona-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
  }

  .zona-btn {
    white-space: nowrap;
  }

  .obras-grid {
    grid-template-columns: 1fr;
  }

  .modal-header h2 {
    font-size: 2.2rem;
  }

  .carousel-main {
    height: 300px;
  }

  .carousel-nav {
    width: 40px;
    height: 40px;
  }

  .carousel-nav.prev {
    left: 10px;
  }

  .carousel-nav.next {
    right: 10px;
  }

  .carousel-thumbnails {
    padding: 1rem;
  }

  .carousel-thumb {
    width: 60px;
    height: 45px;
  }

  .modal-info {
    padding: 1.5rem;
  }

  .modal-details {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   PANEL DE DESARROLLO - AJUSTE DE IMÁGENES
   ========================================================================= */
.dev-panel {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid #e94560;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  color: white;
  font-family: 'Courier New', monospace;
}

.dev-panel-header h4 {
  color: #e94560;
  font-size: 1.2rem;
  margin: 0 0 0.5rem 0;
  font-family: 'Courier New', monospace;
}

.dev-hint {
  color: #a0a0a0;
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
  font-family: 'Courier New', monospace;
}

.dev-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.dev-position-display {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(233, 69, 96, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dev-label {
  color: #a0a0a0;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
}

.dev-value {
  color: #e94560;
  font-size: 1rem;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  background: rgba(233, 69, 96, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.btn-dev {
  background: #e94560;
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-dev:hover {
  background: #ff6b6b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-dev-secondary {
  background: transparent;
  color: #a0a0a0;
  border: 1px solid rgba(160, 160, 160, 0.3);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.btn-dev-secondary:hover {
  background: rgba(160, 160, 160, 0.1);
  border-color: #a0a0a0;
  color: white;
}

.dev-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  min-height: 1.2rem;
}

/* Estilos para imágenes arrastrables en el carrusel */
.carousel-image {
  cursor: grab;
  transition: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.carousel-image:active {
  cursor: grabbing;
}

.carousel-image.dragging {
  cursor: grabbing;
  z-index: 100;
}

/* Responsive del panel de desarrollo */
@media (max-width: 768px) {
  .dev-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dev-position-display {
    justify-content: center;
  }
  
  .btn-dev,
  .btn-dev-secondary {
    width: 100%;
    text-align: center;
  }
}

/* =========================================================================
   MODAL DE ÉXITO - FORMULARIO CONSULTA
   ========================================================================= */
.success-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.success-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.success-modal-content {
  background: var(--porcelain, #FDFEFC);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: successSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes successSlideIn {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.success-modal-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 1.5rem;
}

.success-modal-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.success-modal-text {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.success-modal-content .btn {
  min-width: 140px;
}

/* Responsive del modal de éxito */
@media (max-width: 500px) {
  .success-modal-content {
    padding: 2rem 1.5rem;
  }

  .success-modal-logo {
    width: 60px;
    height: 60px;
  }

  .success-modal-title {
    font-size: 1.5rem;
  }

  .success-modal-text {
    font-size: 1rem;
  }
}
