/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Playfair+Display:wght@400;700&display=swap');

@font-face {
    font-family: 'Democratica';
    src: url('/static/fonts/Democratica.woff') format('woff'),
         url('/static/fonts/Democratica.ttf') format('truetype');
    font-weight: normal;
}
@font-face {
    font-family: 'Democratica';
    src: url('/static/fonts/Democratica-Bold.ttf') format('truetype');
    font-weight: bold;
}

/* === VARIABLES === */
:root {
    --primary:       #006D77;
    --primary-light: #E8F4F5;
    --primary-dark:  #004E56;
    --coral:         #E29578;
    --coral-dark:    #C4724F;
    --yellow:        #F4D35E;
    --teal-light:    #83C5BE;
    --text:          #1B2A4A;
    --text-muted:    #5E6E82;
    --bg:            #FFFBF5;
    --bg-alt:        #F0F7F8;
    --border:        #DDE8EA;
    --header-bg:     #006D77;
    --footer-bg:     #1B2A4A;
    /* aliases para carro20.css */
    --granate:       #E29578;
    --dark-blue:     #1B2A4A;
    --font-body:     'DM Sans', system-ui, sans-serif;
    --font-brand:    'Democratica', Georgia, serif;
    --font-editorial:'Playfair Display', Georgia, serif;
}

/* === BASE === */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
ul { list-style: none; margin: 0; padding: 0; }

/* === TIPOGRAFÍA === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-brand);
    color: var(--text);
    line-height: 1.25;
    margin-bottom: 0.75rem;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.2rem; }

.titulo_seccion {
    font-family: var(--font-brand);
    font-size: 1.4rem;
    color: var(--text);
    border-left: 4px solid var(--coral);
    padding-left: 0.75rem;
    margin-bottom: 1.75rem;
    margin-top: 0.5rem;
}

/* === HEADER === */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 2rem;
    background: var(--header-bg);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 500;
    gap: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-logo .logo {
    height: 100px;
    width: auto;
    display: block;
}

header .tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* === NAV DESKTOP === */
nav.menu .navbar-nav {
    display: flex;
    flex-direction: row;
    gap: 1.75rem;
    align-items: center;
}

nav.menu .navbar-nav li a {
    color: rgba(255,255,255,0.85);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s, color 0.2s;
}

nav.menu .navbar-nav li a:hover {
    color: var(--yellow);
    border-bottom-color: var(--yellow);
}

/* === NAV MOBILE (panel lateral) === */
@media (max-width: 1199px) {
    .collapse-horizontal.navbar-collapse {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 0;
        overflow: hidden;
        z-index: 1000;
        transition: width 0.3s ease;
        display: block !important;
    }

    .collapse-horizontal.navbar-collapse.show {
        width: 280px;
    }

    .desplegable {
        background: var(--bg);
        height: 100%;
        width: 280px;
        padding: 1.5rem 1.25rem;
        overflow-y: auto;
        border-right: 1px solid var(--border);
    }

    .desplegable .navbar-nav {
        flex-direction: column;
        gap: 0;
    }

    .desplegable .navbar-nav li a {
        display: block;
        padding: 0.75rem 0;
        font-size: 1rem;
        letter-spacing: 0.04em;
        border-bottom: 1px solid var(--border);
    }

    .layer {
        position: fixed;
        top: 0; left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
        z-index: 999;
    }

    .navbar-collapse.show ~ .layer {
        opacity: 1;
        pointer-events: all;
    }
}

.desplegable .logo_menu {
    height: 40px;
}

.navbar-toggler {
    border: 1px solid rgba(255,255,255,0.3);
    background: none;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
}
.navbar-toggler:focus { box-shadow: none; }
.navbar-toggler .navbar-toggler-icon {
    filter: invert(1);
}

/* === ICONOS HEADER === */
#user_header a,
#cart_header > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1.5px solid rgba(255,255,255,0.3);
    transition: background 0.2s, border-color 0.2s;
}

#user_header a:hover,
#cart_header > a:hover {
    background: var(--yellow);
    border-color: var(--yellow);
}

#user_header a:hover img,
#cart_header > a:hover img {
    filter: brightness(0);
}

#user_header .icon,
#cart_header .icon {
    width: 18px;
    height: 18px;
    filter: invert(1);
    display: block;
}

#cart_header > a {
    position: relative;
}

#cart_header > a .length {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--coral);
    color: #fff;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* === LÍNEA DECORATIVA === */
.linea_inglesa {
    display: block;
    width: 100%;
    height: 4px;
    object-fit: cover;
    background: linear-gradient(90deg, var(--primary) 0%, var(--teal-light) 40%, var(--coral) 70%, var(--yellow) 100%);
    border: none;
    opacity: 0.85;
}

/* === CONTENIDO PRINCIPAL === */
.contenido {
    padding-top: 2rem;
    padding-bottom: 4rem;
    min-height: 60vh;
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

/* Sidebar izquierda */
.izquierda {
    width: 200px;
    flex-shrink: 0;
}

/* Contenido principal (ocupa el resto) */
.main_content {
    flex: 1;
    min-width: 0;
}

.separador { height: 3rem; }

/* === FOOTER === */
footer {
    background: var(--footer-bg);
    border-top: 4px solid var(--coral);
    padding: 3rem 0 2rem;
}

.footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
}

.footer-col h3 {
    font-family: var(--font-brand);
    font-size: 0.72rem;
    font-weight: bold;
    color: var(--yellow);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.footer-col p,
.footer-col a {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.9;
    display: block;
}

.footer-col a:hover { color: var(--yellow); }

.footer-col .imagen { align-self: center; }

.logo_footer {
    max-height: 80px;
    width: auto;
}

.redes_sociales {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.redes_sociales img { width: 24px; height: 24px; }
.redes_sociales p { margin: 0; font-size: 0.8rem; }

/* === PORTADA: LIBROS EN CARRUSEL === */
.owl-libros .item { padding: 0 0.5rem; }

.owl-libros .item .imagen {
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
}

.owl-libros .item .imagen img {
    height: 240px;
    width: auto;
    max-width: 100%;
    display: block;
    transition: transform 0.35s ease;
}

.owl-libros .item:hover .imagen img { transform: scale(1.04); }

.owl-libros .item .textos {
    padding: 0.65rem 0.1rem 0;
}

.owl-libros .item .textos h3 {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 0.2rem;
}

.owl-libros .item .textos h3 a { color: var(--text); }
.owl-libros .item .textos h3 a:hover { color: var(--primary); }
.owl-libros .item .textos a { font-size: 0.78rem; color: var(--text-muted); }

.owl-libros .item .pvp {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    padding-top: 0.35rem;
}

/* === PORTADA: ACTIVIDADES === */
.actividades {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.actividades .textos time {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.actividades .textos time img { width: 14px; opacity: 0.6; }

.actividades .textos h4 {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    margin: 0.35rem 0 0.5rem;
}

.actividades .textos h4 a { color: var(--text); }
.actividades .textos h4 a:hover { color: var(--primary); }

.actividades .textos p { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0; }
.actividades .textos hr { border-color: var(--border); margin: 1rem 0; }

/* === PORTADA: GUÍAS DE LECTURA === */
.guias h3 { font-size: 1.1rem; }
.guias h3 a { color: var(--text); }
.guias h3 a:hover { color: var(--primary); }
.guias .textos p { font-size: 0.875rem; color: var(--text-muted); }

/* === BOTONES === */
.btn-primary {
    background-color: var(--coral) !important;
    border-color: var(--coral) !important;
    color: #fff !important;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: 4px;
    transition: background-color 0.2s, transform 0.15s;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--coral-dark) !important;
    border-color: var(--coral-dark) !important;
    box-shadow: none !important;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    font-size: 0.875rem;
    border-radius: 4px;
    font-weight: 500;
}

.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    color: #fff !important;
}

/* === FORMULARIOS === */
.form--control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.45rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text);
    transition: border-color 0.2s;
    background: var(--bg);
    width: 100%;
}

.form--control:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* === BÚSQUEDA RÁPIDA === */
.busqueda_rapida {
    display: flex;
    gap: 0;
}

.busqueda_rapida input {
    width: 200px;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: 4px 0 0 4px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    outline: none;
    transition: background 0.2s;
}

.busqueda_rapida input::placeholder { color: rgba(255,255,255,0.5); }
.busqueda_rapida input:focus { background: rgba(255,255,255,0.25); }

.busqueda_rapida button {
    border-radius: 0 4px 4px 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    background: var(--yellow);
    border: none;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.busqueda_rapida button:hover { background: #e8c545; }

/* === RESPONSIVE === */
@media (max-width: 1199px) {
    header {
        padding: 0.875rem 1.25rem;
        gap: 1rem;
    }

    .actividades { grid-template-columns: 1fr; }
    .actividades .imagen { display: none; }
}

@media (max-width: 767px) {
    header {
        padding: 0.75rem 1rem;
    }

    .header-logo .logo { height: 70px; }

    .footer {
        grid-template-columns: 1fr 1fr;
    }

    .footer-col.imagen {
        grid-column: 1 / -1;
        text-align: center;
    }
}
