* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: #fff;
}

/* HEADER */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    gap: 15px;
    position: relative;
    /*
    justify-content: flex-start;
    */

}

.logo img {
    height: 50px;
}

.menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-left a {
    margin-right: 20px;
}

.menu-right {
    display: flex;
    align-items: center;
}

.menu-right > * {
    margin-left: 15px;
}

.menu a {
    text-decoration: none;
    color: #000;
    font-size: 14px;
}

.menu .icon {
    font-size: 18px;
}

.header-bar {
    height: 40px;
    background: #2f80c1;
}

a {
	color:inherit;
	text-decoration:none;
}

a:hover{
	text-decoration:none;
	color:inherit;
}

a:visited{
	color:inherit;
}

a:active{
	color:inherit;
}

.menu a{
	color:#00326e;
}
/* CONTENT */
.content {
    min-height: 500px;
    padding: 40px;
}

/* FOOTER */
.footer {
    background: #111;
    color: #fff;
    padding: 30px 40px;
}

.footer-container {
    display: flex;
    justify-content: space-between;
}

.footer-left p {
    margin-bottom: 8px;
    font-size: 14px;
}

.footer-right a {
    display: block;
    color: #fff;
    text-decoration: none;
    margin-bottom: 8px;
    font-size: 14px;
}

.search-container {
    display: flex;
    align-items: center;
    position: relative;
}

#search-input {
    width: 0;
    opacity: 0;
    padding: 6px 10px;
    border-radius: 20px;
    border: 1px solid #ccc;
    outline: none;
    transition: all 0.3s ease;
    font-size: 14px;
}

#search-input.active {
    width: 200px;
    opacity: 1;
    margin-right: 8px;
}

.search-container .icon {
    font-size: 16px;
    color: #333;
}



.resultados {
    padding: 40px;
}

.grid-resultados {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 25px;
}

.resultado-item {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.resultado-item:hover {
    transform: translateY(-4px);
}

.resultado-imagen {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4; /* mantiene altura visual coherente */
    overflow: hidden;
}

.resultado-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* se adapta al ancho sin deformarse */
    display: block;
}

.resultado-hover {
    position: absolute;
    bottom: -50px;
    left: 0;
    width: 100%;
    height: 50px;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: bottom 0.3s ease;
}

.resultado-hover button {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.resultado-item:hover .resultado-hover {
    bottom: 0;
}

.resultado-info {
    padding: 12px;
    text-align: center;
}

.resultado-autor {
    font-size: 12px;
    font-weight: 600;
    color: #444;
}

.resultado-titulo {
    font-size: 13px;
    font-weight: 700;
    margin: 4px 0;
}

.resultado-isbn {
    font-size: 11px;
    color: #777;
}

.resultado-precio {
    font-size: 14px;
    font-weight: 700;
    margin-top: 6px;
}

.paginacion {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.paginacion a {
    padding: 6px 10px;
    margin: 0 4px;
    text-decoration: none;
    color: #2f80c1;
    border: 1px solid #2f80c1;
    font-size: 13px;
}

.titularpaginacion {    padding: 6px 10px;
    margin: 0 4px;
    text-decoration: none;
    color: #2f80c1;
    border: 1px solid #2f80c1;
    font-size: 13px;
}

.paginacion a.active,
.paginacion a:hover {
    background: #2f80c1;
    color: #fff;
}


/* =========================
   RESPONSIVE RESULTADOS
   ========================= */

/* Tablet grande */
@media (max-width: 1199px) {
    .grid-resultados {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablet / móvil horizontal */
@media (max-width: 991px) {
    .menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #fff;
        display: none;
        flex-direction: column;
        z-index: 999;
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    }

    .menu.active {
        display: flex;
    }
    .hamburger {
        display: block;
    }
}

/* Móvil */
@media (max-width: 575px) {
    .grid-resultados {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .resultados {
        padding: 20px;
    }
}

/* Móvil pequeño */
@media (max-width: 360px) {
    .grid-resultados {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575px) {

    .resultado-autor {
        font-size: 11px;
    }

    .resultado-titulo {
        font-size: 12px;
    }

    .resultado-isbn {
        font-size: 10px;
    }

    .resultado-precio {
        font-size: 13px;
    }
}

@media (max-width: 991px) {
    .resultado-hover {
        bottom: 0;
        position: static;
        background: #000;
    }

    .resultado-hover button {
        padding: 10px 0;
        width: 100%;
    }
}

@media (max-width: 991px) {
    .menu {
        flex-wrap: wrap;
    }

    .menu-left {
        width: 100%;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .menu-left a {
        margin-bottom: 8px;
        font-size: 13px;
    }

    .menu-right {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }
}

@media (max-width: 575px) {
    #search-input.active {
        width: 100%;
        margin-right: 0;
    }

    .search-container {
        width: 100%;
    }
}

@media (max-width: 575px) {
    .paginacion a {
        padding: 6px 8px;
        font-size: 12px;
    }
}

/* =========================
   HAMBURGER
   ========================= */

.hamburger {
    display: none;
    width: 30px;
    cursor: pointer;
    z-index: 1000; /* MUY IMPORTANTE */
}

.hamburger span {
    display: block;
    height: 3px;
    background: #000;
    margin: 6px 0;
    transition: all 0.3s ease;
}

/* Transformación a X */
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

@media (max-width: 991px) {

    .hamburger {
        display: block;
    }

    .menu {
        display: none;
        width: 100%;
        flex-direction: column;
        background: #fff;
        padding: 15px 0;
        border-top: 1px solid #ddd;
    }

    .menu.active {
        display: flex;
    }

    .menu-left,
    .menu-right {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        padding: 0 20px;
    }

    .menu-left a,
    .menu-right a {
        padding: 10px 0;
        font-size: 14px;
        width: 100%;
    }

    .menu-right {
        border-top: 1px solid #eee;
        margin-top: 10px;
    }

    .search-container {
        width: 100%;
    }

    #search-input {
        width: 100%;
    }
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.ficha-libro{
	display:flex;
	gap:40px;
	max-width:1200px;
	margin:auto;
	padding:40px;
}

.ficha-portada img{
	width:260px;
	height:auto;
	box-shadow:0 6px 14px rgba(0,0,0,0.25);
}

.ficha-info{
	flex:1;
}

.ficha-info h1{
	font-size:32px;
	margin-bottom:10px;
}

.ficha-lateral{
	width:220px;
}

.titulo-bloque {
	font-weight:bold;
	margin-bottom:10px;
	font-size:14px;
	letter-spacing:1px;
}

.tag-thema{
	border:1px solid #ccc;
	border-radius:20px;
	padding:6px 14px;
	display:inline-block;
	margin-bottom:8px;
	font-size:13px;
}

.autor {
	color:#555;
	margin-bottom:25px;
}

.autor-linea {
	margin-bottom:4px;
}

.autor-rol {
	color:#777;
	font-size:14px;
	margin-right:5px;
}

.autor-nombre {
	font-weight:600;
	text-decoration:none;
}

.autor-nombre:hover {
	text-decoration:underline;
}

.botones{
	display:flex;
	gap:15px;
	margin-bottom:30px;
}

.btn-carrito{
	background:black;
	color:white;
	padding:14px 28px;
	border:none;
	border-radius:6px;
	cursor:pointer;
}

.btn-fragmento{
	background:white;
	border:1px solid #999;
	padding:14px 28px;
	border-radius:6px;
	cursor:pointer;
}

.user-name {
	background:#2f80c1;
	border:1px solid #999;
	padding: 5px 14px;
	border-radius:6px;
	color: #fff;
	font-weight:600;
}

.btn-disconnect {	background: #fb4d4d;
	color: #fff !important;
	padding: 8px 8px;
	font-size: 16px !important;
	border-radius:16px;
}

.btn-login {
	background: #2f80c1;
	color: #fff !important;
	padding: 7px 7px;
	font-size: 16px !important;
	border-radius:18px;
}

.promocional {	margin-bottom:30px;
	line-height:1.2;
	color:#444;
	font-weight:600;
	background-color: #f4f4f4;
	padding: 12px 12px;
	border-radius: 6px;
}

.resumen{
	margin-bottom:30px;
	line-height:1.6;
}

.datos{
	margin-top:20px;
}

.fila{
	display:flex;
	margin-bottom:12px;
}

.label{
	width:220px;
	font-weight:bold;
	color:#555;
}

.valor{
	flex:1;
}

.precio {
	font-size:28px;
	font-weight:700;
	margin-bottom:25px;
	color:#111;
}

.breadcrumbs {
	font-size:14px;
	margin-bottom:20px;
	color:#2f80c1;
}

.breadcrumbs a {
	color:#256aa3;
}

.breadcrumbs a:hover {
	text-decoration:underline;
}

#search-input{
	display:none;
}


@media (max-width:768px){
	.ficha-libro {
		flex-direction:column;
	}

	.ficha-portada {
		text-align:center;
	}

	.ficha-lateral {
		width:auto;
	}

	.ficha-portada img {
		width:220px;
	}

	.label {
		width:150px;
	}

}

.carrito-icon {
	position:relative;
	display: inline-block;
}

#carrito-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: red;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 50%;
}

.mensajes-icon {
	position:relative;
	display: inline-block;
}

#mensajes-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: red;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 50%;
}

.modal{
	display:none;
	position:fixed;
	z-index:9999;
	left:0;
	top:0;
	width:100%;
	height:100%;
	background:rgba(0,0,0,0.6);
}

.modal-content{
	background:#fff;
	width:500px;
	max-width:90%;
	margin:5% auto;
	padding:20px;
	border-radius:10px;
	position:relative;
	box-shadow:0 10px 30px rgba(0,0,0,0.3);
	animation:fadeIn 0.3s ease;
}

.cerrar{
	position:absolute;
	top:10px;
	right:15px;
	font-size:22px;
	cursor:pointer;
}

@keyframes fadeIn{
	from{transform:translateY(-20px); opacity:0;}
	to{transform:translateY(0); opacity:1;}
}

.modal-body{
	display:flex;
	gap:20px;
}

.modal-body img{
	border-radius:6px;
}

.modal-info{
	flex:1;
}

.modal-info h3{
	margin:0 0 5px;
	font-size:18px;
}

.modal-info p{
	margin:3px 0;
	font-size:14px;
	color:#555;
}

.precio{
	font-size:20px;
	color:#000;
	font-weight:bold;
	margin:10px 0;
}

.form-row{
	margin-bottom:10px;
}

.form-row input{
	width:100%;
	padding:6px;
	border:1px solid #ccc;
	border-radius:4px;
}

.btn-add{
	width:100%;
	background:#000;
	color:#fff;
	padding:10px;
	border:none;
	border-radius:6px;
	cursor:pointer;
	font-weight:bold;
}

.btn-add:hover{
	background:#333;
}

.form-carrito-ficha {
    margin-top: 20px;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    max-width: 400px;
}

.form-carrito-ficha form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: flex;
    flex-direction: column;
}

.form-row label {
    font-size: 13px;
    margin-bottom: 5px;
    color: #555;
}

.form-row input {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.btn-confirmar {
    background: #111;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-confirmar:hover {
    background: #333;
}

.msg-login {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
}

.carrito-container{
    display:flex;
    gap:30px;
}

.carrito-lista{
    flex:3;
}

.carrito-item{
    display:flex;
    align-items:center;
    border-bottom:1px solid #ddd;
    padding:15px 0;
    gap:15px;
}

.ci-img img{
    width:60px;
}

.ci-info{
    flex:2;
}

.ci-autor{
    font-size:13px;
    color:#666;
}

.ci-titulo{
    font-weight:bold;
}

.ci-ref {
    margin-top:5px;
    width:100%;
    padding:4px;
    font-size:12px;
    color:#666;
    font-style: italic;
}

.ci-precio, .ci-cantidad, .ci-subtotal{
    width:100px;
    text-align:center;
}

.ci-subtotal {	font-weight: bold;
}

.signo-dolar {	font-size:14px;
}

.carrito-resumen{
    flex:1;
    background:#f5f5f5;
    padding:20px;
    border-radius:16px;
}

.linea{
    display:flex;
    justify-content:space-between;
    margin-bottom:10px;
}

.linea.total{
    font-weight:bold;
    margin-top:20px;
}

.btn-finalizar{
    width:100%;
    background:black;
    color:white;
    padding:10px;
    border:none;
    margin-top:20px;
    cursor:pointer;
}



/* esto es lo nuevo */
.carrito-header,
.carrito-item {
    display: flex;
    grid-template-columns: 1fr 120px 120px 120px;
    align-items: center;
    gap: 15px;
}

.carrito-header {
    font-weight: bold;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.carrito-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.ci-info {
    display: grid;
    gap: 1px;
}

.ci-info img {
    width: 60px;
}

.cantidad-box {
    display: flex;
    border: 1px solid #ccc;
    width: 42px;
    height: 40px;
}

.cantidad-box input {
    width: 40px;
    border: none;
    text-align: center;
    font-size: 14px;
}

.cantidad-botones {
    display: flex;
    flex-direction: column;
    width: 30px;
    border-left: 1px solid #ccc;
}

.cantidad-botones div {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
}

.cantidad-botones div:hover {
    background: #f0f0f0;
}

.letras {
    margin:20px 0;
    font-size:20px;
}

.letras a {
    margin-right:8px;
    text-decoration:none;
    color:#2f80c1;
    font-weight:bold;
    font-size:20px;
}

.letras .off {
    color:#ccc;
    margin-right:8px;
}

.grid-editoriales {
    display:grid;
    grid-template-columns: repeat(4, 1fr);
    gap:10px;
    margin-bottom:30px;
}

.item-editorial a {
    text-decoration:none;
    color:#333;
}

.item-editorial a:hover {
    color:#2f80c1;
}

.thema-item {
    margin:5px 0;
}

/*
.thema-linea {
    display:flex;
    align-items:center;
    gap:8px;
}

.thema-linea a {
    text-decoration:none;
    color:#333;
}

.thema-linea a:hover {
    color:#8c1d18;
}

.toggle {
    cursor:pointer;
    font-weight:bold;
    width:15px;
    display:inline-block;
}

.thema-hijos {
    margin-left:20px;
    display:none;
}
*/
.thema-linea {
    padding:8px 10px;
    border-radius:6px;
    color:#fff;
    display:flex;
    align-items:center;
    gap:8px;
    margin:3px 0;
    box-shadow:0 1px 2px rgba(0,0,0,0.1);
}

/* Nivel 1 */
.nivel-1 > .thema-linea {
    background:#2f80c1;
}

/* Nivel 2 */
.nivel-2 > .thema-linea {
    background:#4a94cc;
}

/* Nivel 3 */
.nivel-3 > .thema-linea {
    background:#66a9d7;
}

/* Nivel 4 */
.nivel-4 > .thema-linea {
    background:#82bee2;
}

/* Nivel 5 */
.nivel-5 > .thema-linea {
    background:#9ed3ed;
}

/* texto enlaces */
.thema-linea a {
    color:#fff;
    text-decoration:none;
}

.thema-linea a:hover {
    text-decoration:underline;
}

.thema-hijos {
    margin-left:15px;
    display:none;
}

.form-registro {
    max-width:500px;
    margin:40px auto;
    padding:20px;
    border:1px solid #ddd;
    border-radius:8px;
    background:#fafafa;
}

.form-registro h2 {
    margin-bottom:15px;
}

.form-row {
    margin-bottom:15px;
}


.form-row label {
    display:block;
    margin-bottom:5px;
    font-weight:bold;
}

.form-row input,
.form-row textarea {
    width:100%;
    padding:8px;
    border:1px solid #ccc;
    border-radius:4px;
}

.form-row textarea {
    height:100px;
    resize:vertical;
}

.btn-submit {
    background:#2f80c1;
    color:#fff;
    border:none;
    padding:10px 15px;
    border-radius:5px;
    cursor:pointer;
}

.btn-submit:hover {
    background:#256aa3;
}

.mensaje-ok {
    color:green;
    margin-bottom:15px;
}

.mensaje-error {
    color:red;
    margin-bottom:15px;
}



.menu-item {
    position: relative;
    list-style: none;
}
/* oculto por defecto */
.submenu-edades {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 120px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 5px 0;
    z-index: 999;
}

/* items */
.submenu-edades li {
    list-style: none;
}

.submenu-edades li a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

/* hover */
.submenu-edades li a:hover {
    background: #2f80c1;
    color: #fff;
}

/* visible */
.menu-item.open .submenu-edades {
    display: block;
}

.admin-botones {
    display: inline;
    flex-direction: column;
    gap: 5px;
}

.btn-admin {
    border: none;
    padding: 4px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    color: #fff;
}

.btn-admin.incluir { background: #28a745; }
.btn-admin.excluir { background: #dc3545; }
.btn-admin.masdatos { background: #f39c12; }


.menu-item-tools {
    position: relative;
    list-style-type: none;
}

/* SUBMENÚ */
.submenu-tools {
    display: none;
    position: absolute;
    top: 100%;
    right: 0; /* alineado a la derecha (mejor para iconos) */
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    z-index: 999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

/* ITEMS */
.submenu-tools a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.submenu-tools a:last-child {
    border-bottom: none;
}

.submenu-tools a:hover {
    background: #2f80c1;
    color: #fff;
}

.menu-item-tools.open .submenu-tools {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
