/* Estilos generales */

:root {
    --warmpastel: #ffddcd;
    --brown: #634430;
    --lightbrown: #8a5537;
    --mediumbrown: #412a1b;
    --darkbrown: #2B1B0E;
}

@font-face {
    font-family: 'Brittany Signature';
    src: url('./fonts/BrittanySignature.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'EB Garamond';
    src: url('./fonts/EBGaramond-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Open Sans';
    src: url('./fonts/Open-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

a {
    text-decoration: none;
    color: var(--brown)
}

body {
    display: grid;
    min-height: 100dvh;
    grid-template-rows: auto 1fr auto;
}

header {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    /* NEW: Creates positioning context */
    z-index: 1000;
    /* NEW: Keeps header above content */
}

.ul_list {
    list-style-type: none;
    padding-left: 0;
    /* Also remove default padding */
}

.ul_list a:hover {
    text-decoration: underline;
}

/* Container for buttons */
.button-links-container {
    display: flex;
    flex-wrap: wrap;
    line-height: 2.5;
}

/* Estilos enlaces */
/* Enlaces internos */
.button-links {
    color: var(--darkbrown);
    padding: 0rem 0.4rem;
    margin: 0.2rem 0;
    border-radius: 10px;
    white-space: normal;
    background: var(--warmpastel);
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
    display: inline-block;     /* ensure it acts like a button */
    max-width: 100%;           /* limit width to container */
    word-wrap: break-word;     /* break long words if necessary */
}

.button-links:hover {
    border-color: var(--mediumbrown);
}

/* Enlaces compra */
.button-buy {
    color: var(--warmpastel);
    border: 1px solid var(--darkbrown);
    background-color: var(--mediumbrown);
    padding: 0.5rem;
    border-radius: 16px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    display: inline-block; /* if it’s a button or link */
}

.button-buy:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    cursor: pointer; /* indicates clickable */
}

/* Estilos logo */
.logo-img {
    height: 70px;
    /* Default for large screens */
    width: auto;
    max-width: 100%;
    /* Ensures it does not overflow */
    display: block;
}

@media (max-width: 767px) {
    .logo-img {
        height: 60px;
    }
}

@media (max-width: 414px) {
    .logo-img {
        height: 50px;
    }
}

/* Estilos header (768px o superior) */
@media (min-width: 768px) {
    header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        padding: 0 1rem;
        margin-top: 1rem;
        padding-bottom: 1rem;
    }

    .logo {
        justify-self: start;
    }

    .main-nav {
        display: flex;
        justify-content: flex-end;
        gap: 1rem;
        padding-right: 1rem;
    }

    .header-actions {
        justify-self: end;
        /* align-items: center;
        justify-content:center; */
    }

    .mobile-menu-toggle {
        display: none;
    }

    .mobile-nav {
        display: none;
    }
}

/* Estilos header mÃ³vil (767px e inferior) */
@media (max-width: 767px) {
    header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
    }
}

.header-actions {
    display: flex;
    /* gap: 0.1rem; */
}

/* Estilos home */

.book-title-home {
  font-family: 'Open Sans';
  font-size: 1.2rem;
  font-weight: 600;
}

.book-title-home a:hover {
  text-decoration: underline;
}

.book-author-home {
  font-size:1.2rem;
}

.book-author-home a:hover {
  text-decoration: underline;
}

/* Slideshow container */
.slideshow-container {
  position: relative;
  max-width: 100%;
  margin: auto;
}

/* Next & previous buttons */
.prev, .next {
  z-index: 10; /* Higher than slides */
  background-color: var(--warmpastel-alpha, rgba(255, 179, 71, 0.5));
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -22px;
  padding: 16px;
  color: rgb(0, 0, 0);
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  user-select: none;
  /* opacity:40%; */
}

/* Position the "next button" to the right */
.next {
  right: 0;
  border-radius: 12px 0 0 12px;
  margin-right:-1rem;
}

.prev {
  border-radius: 0 12px 12px 0;
  margin-left:-1rem;
}

/* On hover, add a black background color with a little bit see-through */
.prev:hover, .next:hover {
  color: white;
  background-color: var(--lightbrown);
}

/* Caption text */
.text {  
  font-size: 15px;
  padding: 8px 12px;
  bottom: 8px;
  width: 100%;  
}

/* The dots/bullets/indicators */
.dot {
  cursor: pointer;
  height: 15px;
  width: 15px;
  margin: 0 2px;
  background-color: var(--lightbrown);
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.6s ease;
}

.active, .dot:hover {
  background-color: var(--darkbrown);
}

/* Fading animation */
.fade {
  animation-name: fade;
  animation-duration: 1.5s;
}

@keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
}

.slide-container {
  display:flex;
  flex-direction:row;
  flex: 0 0 50%;
  box-sizing: border-box;
  padding:0.2rem;
  align-items: center;
}

@media(min-width: 541px) {
  .slide-container img {
    width: 50%;
    height: auto;
  }
}

@media(max-width: 669px) {
  .slide-container {
    flex-direction: column;
  }
  .slide-container img {
    width: 100%;
  }
  
}

/* Fix for slide-container overlapping buttons */
.mySlides {
  position: relative;
  z-index: 1; /* Lower than buttons */
}

/* Estilos novedades */

.content-novedades {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items:first baseline;
  justify-content:center;
  padding: 1.4rem 0;
}

.item-novedades {
  display:flex;
  flex-direction:column;
  text-align: center;
  align-items:first baseline;
  padding: 0.4rem;
}

@media(min-width: 474px) {
    .item-novedades {
        max-width: 170px;
    }
}

@media(max-width:474px) {
    .item-novedades {
        width: 100% !important;
    }
}

.item-novedades:hover {
  background-color: var(--warmpastel);
  border-radius: 12px;
}

 .item-novedades img { 
  max-width: none !important; /* Override any max-width */
  width: 100%; /* Default to container width */
  height: auto;
 } 

 @media (min-width: 540px) and (max-width: 713px) {
  .item-novedades-img {
    width: 150px !important;
    max-height: 150px !important;
  }
}

/* Estilos contenido artÃ­culos */
.content-box {
    font-family: 'EB Garamond';
    font-size: 1.15rem;
}

.content-title {
    text-align: center;
}

@media (max-width: 414px) {
    .content-title {
        margin-top: 1.2rem;
    }

    .content-body-list {
        font-size: 1.2rem;
    }
}

@media(min-width: 415px) {
    .content-box {
        position: relative;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(0, 0, 0, 0.1);
        padding: 1rem;
        margin: 2rem auto;
        max-width: 800px;
    }

    .content-title {
        font-family: 'Brittany Signature', cursive, sans-serif;
        font-size: 1.8rem;
        position: absolute;
        top: -1.5rem;
        left: 50%;
        transform: translateX(-50%);
        /* Simplified centering */
        background: white;
        padding: 0 1.5rem;
        /* Increased side padding */
        font-weight: 500;
        white-space: nowrap;
        /* Prevent text wrapping */
    }

    .content-body-list {
        font-size: 1.2rem;
        margin-top: 2rem;
    }
}

@media (max-width: 767px) {
    .content-box {
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .content-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 484px) {
    .content-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 414px) {
    .content-box {
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(0, 0, 0, 0.1);
        padding: 0.4rem;
        margin: 1rem 0.3rem;
        /* max-width: 90%; */
    }

    .content-title {
        font-family: 'Brittany Signature', cursive, sans-serif;
        font-size: 1.2rem;
        padding: 0 0.4rem;
        font-weight: 500;
    }

    .content-body-list {
        margin-top: 2rem;
    }
}

/* Estilos lista de libros */
.book-container {
    color: var(--brown);
}

.book-container-book-title {
    text-align: center;
}

@media(max-width:413px) {
    .book-container {
        display: flex;
        flex-direction: column;
        margin-bottom: 2rem;
    }

    .book-container-image img {
        display: block;
        /* This removes any default inline spacing */
        margin: 0 auto;
        /* This centers the image horizontally */
        max-width: 100%;
        /* Ensures the image doesn't overflow its container */
    }

    .book-container-details {
        margin-left: 0.4rem;
    }
}

@media (min-width: 414px) {
    .book-container {
        display: flex;
        flex-direction: row;
        margin: 1rem 0;
        /* padding:0.2rem; */
        /* border-radius:1rem; */
    }

    .book-container:hover {
        background-color: #f7dfc2;
    }

    .book-container-image {
        flex: 0 0 auto;
        /* Only take up as much space as needed by the image */
        display: flex;
        /* Optional: center image vertically/horizontally if needed */
        align-items: center;
        justify-content: center;
    }

    .book-container-details {
        flex: 1;
        /* Take up the remaining space */
        display: flex;
        flex-direction: column;
        padding: 0.2rem;
    }

    .book-container-details a {
        text-decoration: none;
    }

    .book-container-book-title {
        padding: 0.8rem 0;
    }
}

/* Mostrar libro */

.content-body-book {
    gap: 1rem;
}

@media(min-width: 665px) {
    .content-body-book {
        display: flex;
        flex-direction: row;
        margin-top: 1.4rem;
    }

    .content-body-image img {
        max-width: 100%;
    }
}

@media (max-width: 664px) {
    .content-body-image {
        width: 100% !important;
        /* Use % instead of vw */
        max-width: 100%;
        margin: 1rem 0;
        padding: 0 1rem;
        /* Match parent padding */
        box-sizing: border-box;
    }

    .content-body-image img {
        width: 100% !important;
        max-width: 100%;
        height: auto;
        display: block;
    }
}

@media(min-width: 665px) {
    .content-body-image img {
        max-width: 250px;
    }
}

.book-description {
    margin: 1rem 0;
}

/* Tabla de tiendas */

.book-shops {
    font-family: 'Open Sans';
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0 0 0;
}

.book-shops th,
.book-shops td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

/* Stack vertically on small screens */
@media (max-width: 600px) {
    .book-shops thead {
        display: none;
    }

    /* Hide headers */
    .book-shops tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #ddd;
    }

    .book-shops td {
        display: block;
        text-align: right;
    }

    .book-shops td::before {
        content: attr(book-shops-data-label);
        /* Show labels from data-label */
        float: left;
        font-weight: bold;
    }
}

/* PaginaciÃ³n */
.pagination-container {
    font-family: 'Open Sans';
    margin: 1rem 0;
    align-items: center;
    text-align: center;
    line-height: 2rem;
}

.pagination-info {
    font-weight: 700;
}

.pagination-links a {
    color: var(--darkbrown);
    padding: 0.4rem;
    border-radius: 2px;
    border: 1px solid var(--brown);
}

.pagination-links a:hover {
    box-shadow: 0 4px 8px 2px rgba(99, 68, 48, 0.2);
}

/* InformaciÃ³n de la api */
.infoapi {
    font-family: 'Open Sans';
    margin: 2rem 0;
    font-style: italic;
}

.infoapi a:hover {
    text-decoration: underline;
}

/* Mobile menu overflow control */
@media (max-width: 767px) {
    body.menu-open {
        overflow: hidden;
        /* Prevents page scrolling when menu is open */
    }

    body.menu-open main {
        position: relative;
        z-index: 1;
        /* Ensures content stays below menu */
    }
}

/* Hamburger menu styles */
.mobile-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: none;
    /* Hidden by default (shown in mobile via media query) */
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--brown);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Hamburger animation when active */
.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Add these styles to your existing CSS */
.mobile-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: none;
    /* Will be shown on mobile via media query */
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--brown);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

.mobile-nav {
    font-weight: 700;
    font-size: 1.2rem !important;
    font-family: 'Open Sans';
    text-align: center;
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--lightbrown);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* z-index: 1000; */
    padding: 1rem 0;
    flex-direction: column;
    gap: 1rem;
    margin-left: 1rem;
    border-radius: 10px;
}

.mobile-nav a {
    color: white;
    font-size: 1.2rem !important;
}

.mobile-nav a:hover {
    text-decoration: underline;
}

.mobile-nav.active {
    display: flex;
}

@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
    }

    /* Add this to be extra sure */
    .mobile-nav,
    .mobile-nav a {
        font-size: 1.2rem !important;
    }

}

/* Estilos ventana modal bÃºsqueda */

.search-modal-hidden {
    display: none;
}

.search-modal {
    font-family: 'Open Sans';
    position: fixed;
    /* Stay fixed on screen */
    top: 0;
    left: 0;
    width: 100vw;
    /* Full viewport width */
    height: 100vh;
    /* Full viewport height */
    background-color: rgba(0, 0, 0, 0.4);
    /* Black with opacity for dimming */
    display: flex;
    justify-content: center;
    align-items: baseline;
    z-index: 1000;
    /* On top of other content */
    max-width: 100%;
}

.search-modal-content {
    position: relative;
    /* Needed for absolute positioning close button */
    /* display:flex;
  flex-direction:column;
  gap:1rem; */
    margin-top: 10rem;
    background-color: white;
    padding: 3rem 2rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 80%;
    overflow: auto;
}

.search-modal-close {
    position: absolute;
    top: 0px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2.8rem;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s;
}

.search-modal-close:hover {
    color: var(--brown);
}

@media(min-width:768px) {
    #searchText {
        width: 400px;
        /* or any width you prefer */
    }
}

@media(max-width:767px) {
    #searchText {
        width: 90%;
        max-width: 100%;
        /* or any width you prefer */
        min-width: 10rem;
    }
}

.search-input {
    margin-bottom: 0.6rem;
}

.search-button {
    margin-top: 1rem;
}

.search-button button {
    background: var(--mediumbrown);
    /* background color */
    color: #fff;
    /* text color */
    padding: 0.5em 1.5em;
    /* vertical and horizontal padding */
    border: none;
    /* remove border */
    border-radius: 4px;
    /* slightly rounded corners */
    font-size: 1rem;
    /* font size */
    cursor: pointer;
    transition: background 0.2s;
}

.search-button button:hover {
    background: var(--darkbrown);
    /* darker on hover */
}

@media(max-width: 747px){
    .search-icon img {
        margin-top:0.2rem;
    }

}

.search-icon

.search-field-options {
    color: var(--brown);
    gap: 1rem;
    row-gap: 1rem;
}

.search-field-options label {
    cursor: pointer;
    user-select: none;
    margin-right: 1rem;
    display: inline-block; /* Esto asegura que no se separe cada opción con su punto de selección al cambiar de línea */
}

#searchText {
    width: 300px;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100%;
}

/* Estilos resultados de bÃºsqueda */

.search-header {
    font-family: 'Open sans';
    margin: 1rem 0;
}

/* Estilos footer */

.content-footer {
    font-size:1rem;
    color: white;
    font-family: 'Open Sans';
    text-align: center;
    padding: 1rem;
    background-color: var(--lightbrown);
}

.content-footer a {
    color: var(--warmpastel);
}