/* --- BOX-SIZING UNIVERSALE --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.3;
    margin: 0;
    background: linear-gradient(to right, #f2f2f2, #fafafa);
    color: #222;
}

/* --- HEADER --- */
header {
    position: relative;
    background: url('immagine1.jpg') center 40%/cover no-repeat;
    color: white;
    border-bottom: 4px solid #7b1113;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 40px;
    min-height: 180px;
    overflow: hidden;
    flex-wrap: wrap;
}

header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.20);
    z-index: 0;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1300px;
}

/* --- TITOLO CENTRALE --- */
.header-center {
    text-align: center;
    flex: 1;
}

.header-center h1 {
    margin: 0;
    font-size: 2.8em;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.4);
}

.header-center p {
    font-size: 1.2em;
    margin-top: 6px;
    font-style: italic;
    color: #f8f8f8;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

/* --- RIQUADRO DESTRA (omini + testo storico) --- */
.header-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(128, 0, 32, 0.60);
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 350px;
    box-shadow: 0 0 12px rgba(0,0,0,0.25);
    justify-content: flex-end;
}

.header-right img {
    width: 60px;
    height: auto;
    border-radius: 6px;
}

.header-right p {
    font-size: 0.7em;
    line-height: 1.35em;
    color: #f0f0f0;
    margin: 0;
    text-align: left;
}

/* --- NAV --- */
nav {
    background-color: #7b1113;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 5px 15px;
    font-size: 1.4em;
    transition: color 0.3s, transform 0.2s;
}

nav a:hover {
    color: #ffdede;
    transform: scale(1.08);
}

/* --- RICERCA --- */
.search-form {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.search-form input {
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    outline: none;
    font-size: 1em;
}

.search-form button {
    background-color: #8c1a1a;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 5px;
    font-size: 1em;
    transition: background 0.3s, transform 0.2s;
}

.search-form button:hover {
    background-color: #5b0e0e;
    transform: scale(1.05);
}

/* --- STRUTTURA PRINCIPALE --- */
.main-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

.sidebar-left,
.sidebar-right {
    padding: 15px;
    border-radius: 12px;
    background: linear-gradient(to bottom, #fdfdfd 0%, #f4f4f4 100%);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* --- LIBRI NELLA SIDEBAR (stile migliorato) --- */

.libro {
    margin-bottom: 18px;
    padding: 10px 12px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
    transition: transform 0.2s, box-shadow 0.2s;
}

.libro:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.titolo-libro {
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
    color: #7b1113;
    font-size: 1.03em;
    text-decoration: none;
}

.titolo-libro:hover {
    text-decoration: underline;
    color: #5b0e0e;
}

.info-libro {
    font-size: 0.9em;
    color: #333;
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
}

.info-libro .autore {
    font-style: italic;
    color: #444; /* leggermente più chiaro del titolo */
}

.info-libro .editore {
    font-weight: 600;
    color: #444;
}


/* Titoli interni */
.sidebar-left h3,
.sidebar-right h3 {
    font-size: 1.1em;
    border-bottom: 2px solid #7b1113;
    padding-bottom: 6px;
    text-align: center;
    color: #7b1113;
    margin-bottom: 15px;
}

/* Card interne unificate */
.sidebar-left p.titolo,
.sidebar-right p.titolo {
    margin: 10px 0;
    font-weight: 500;
    background: white;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Hover */
.sidebar-left p.titolo:hover,
.sidebar-right p.titolo:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Link unificati */
.sidebar-left p.titolo a,
.sidebar-right p.titolo a {
    color: #7b1113;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.sidebar-left p.titolo a:hover,
.sidebar-right p.titolo a:hover {
    color: #5b0e0e;
    text-decoration: underline;
}

/* Date */
.sidebar-left .date,
.sidebar-right .date {
    font-size: 0.85em;
    color: #666;
}

/* Posizioni diverse */
.sidebar-left { width: 20%; }
.sidebar-right { width: 24%; }

/* ---------------------------------------------------------------- */

/* --- CONTENUTO CENTRALE --- */
.content-center {
    width: 56%;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

h2 {
    text-align: center;
    margin-bottom: 15px;
    color: #7b1113;
    font-size: 2em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- SEZIONI LIBRI --- */
.sezione-libri-autore,
.sezione-libri-utili {
    margin-top: 10px;
    padding: 0px;
    border: none;
    background-color: transparent;
    box-shadow: none;
}

.sezione-libri-autore h3,
.sezione-libri-utili h3 {
    color: #7b1113;
    font-size: 1.6em;
    text-align: center;
    margin-bottom: 10px;
    display: inline-block;
    padding-bottom: 5px;
}


.book-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    padding: 15px;
    text-align: center;
    width: 100%;
    max-width: 850px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.book-card h3 {
    color: #7b1113;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.book-card iframe {
    display: block;
    width: 100%;
    height: 600px;
    border: none;
    border-radius: 8px;
}

/* --- FOOTER --- */
footer {
    text-align: center;
    background: #7b1113;
    color: white;
    padding: 20px 0;
    margin-top: 60px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* --- IMMAGINI E IFRAME FLUIDI --- */
img, iframe {
    max-width: 100%;
    height: auto;
}

/* --- MEDIA QUERY --- */
@media (max-width: 900px) and (min-width: 601px) {
    .main-container {
        flex-wrap: wrap;
        gap: 20px;
    }

    .sidebar-left { width: 100%; margin-bottom: 20px; }
    .content-center { width: 65%; }
    .sidebar-right { width: 30%; }

    .book-card iframe { height: 500px; }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .header-right {
        margin-top: 10px;
        background: rgba(0, 0, 0, 0.5);
        text-align: center;
        max-width: 90%;
    }
}

@media (max-width: 600px) {
    .main-container {
        flex-wrap: wrap;
        gap: 15px;
    }

    .sidebar-left, 
    .content-center, 
    .sidebar-right {
        width: 100%;
        margin-bottom: 15px;
        padding: 10px;
    }

    nav a { font-size: 1.1em; margin: 5px 8px; }

    .header-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .header-center h1 { font-size: 1.6em; }
    .header-right { display: none; }

    .book-card iframe { height: 500px; }
}

/* --- PULSANTI LETTURA LIBRO --- */
.controls .nav-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
}

.controls .zoom-btn, 
.controls .fullscreen-btn {
    width: 42px;
    height: 42px;
    font-size: 18px;
}

@media (max-width: 900px) {
    .controls .nav-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
}

@media (max-width: 600px) {
    .controls .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .controls .zoom-btn, 
    .controls .fullscreen-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
}

