/* * VARIABILI CSS */
:root {
    --color-primary: #0a3d62;
    --color-primary-light: #3c6382;
    --color-secondary: #0c5ab3;
    --color-background: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #343a40;
    --color-text-muted: #6c757d;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition-speed: 0.3s;
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* * RESET E STILE GLOBALE */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* * BARRA DI NAVIGAZIONE */
.navbar {
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 10px 0;
    transition: background-color var(--transition-speed);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.6em;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.nav-item a {
    color: var(--color-text);
    text-decoration: none;
    padding: 15px 20px;
    font-weight: 500;
    position: relative;
    transition: color var(--transition-speed);
}

.nav-item a:hover {
    color: var(--color-secondary);
}

.nav-item a::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 20px;
    right: 20px;
    height: 2px;
    background-color: var(--color-secondary);
    transform: scaleX(0);
    transition: transform var(--transition-speed) ease-in-out;
}

.nav-item a:hover::after {
    transform: scaleX(1);
}

.hamburger {
    display: none;
    cursor: pointer;
}

/* * HERO SECTION */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    padding: 140px 20px 80px 20px;
    text-align: center;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    margin-top: 15px;
    opacity: 0.9;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    display: inline-block;
    background-color: var(--color-secondary);
    color: white;
    padding: 15px 35px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 30px;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* * SEZIONI */
main {
    padding-top: 0;
}

section {
    padding: 80px 0;
    border-bottom: 1px solid #e9ecef;
}

section:last-of-type {
    border-bottom: none;
}

.section-title {
    color: var(--color-primary);
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto 50px auto;
}

/* Search Bar Styling (Custom addition) */
.search-container {
    max-width: 600px;
    margin: 0 auto 40px auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    padding-right: 50px;
    font-family: var(--font-family);
    font-size: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(12, 90, 179, 0.1);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

/* * CATALOGO GRID */
.catalogo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.libro-card {
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    height: 100%;
}

.libro-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.libro-card-img-container {
    width: 100%;
    padding-top: 140%;
    /* Rapporto aspetto verticale */
    position: relative;
    background-color: #f1f3f5;
    overflow: hidden;
}

.libro-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Adatta l'immagine senza tagliarla */
    padding: 10px;
    transition: transform 0.5s;
}

.libro-card:hover img {
    transform: scale(1.05);
}

.libro-card-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.libro-card h3 {
    font-size: 1.1em;
    margin: 0 0 10px 0;
    color: var(--color-text);
    font-weight: 600;
    flex-grow: 1;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.libro-card .prezzo {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--color-primary);
    margin-top: 15px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: var(--color-text-muted);
    background: white;
    border-radius: var(--border-radius);
}

/* * SECTION CHI SIAMO & CONTATTI */
.about-content,
.contact-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content p,
.contact-info p {
    margin-bottom: 1.5em;
    font-size: 1.05rem;
}

.contact-info {
    background-color: var(--color-surface);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e9ecef;
}

.contact-info strong {
    color: var(--color-primary);
    font-weight: 600;
}

/* * FOOTER */
footer {
    text-align: center;
    padding: 60px 20px 40px;
    background-color: var(--color-primary);
    color: rgba(255, 255, 255, 0.8);
}

.footer-logo {
    font-size: 1.8em;
    font-weight: 700;
    color: white;
    text-decoration: none;
    margin-bottom: 20px;
    display: block;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.footer-links a:hover {
    color: white;
}

.footer-copyright {
    font-size: 0.9em;
    opacity: 0.6;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    margin-top: 20px;
}

/* * MODAL (Adapted) */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--color-surface);
    margin: 5% auto;
    width: 90%;
    max-width: 900px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-button {
    color: var(--color-text-muted);
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: var(--color-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .modal-body {
        flex-direction: row;
    }
}

.modal-cover {
    flex: 1;
    background-color: #f1f3f5;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.modal-cover img {
    max-width: 100%;
    max-height: 400px;
    box-shadow: var(--shadow-md);
    border-radius: 4px;
}

.modal-details {
    flex: 1.5;
    padding: 40px;
}

.modal-title {
    font-family: var(--font-family);
    font-size: 1.8rem;
    color: var(--color-primary);
    margin-bottom: 5px;
    line-height: 1.2;
}

.modal-author {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: 25px;
}

.modal-specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spec-value {
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 600;
}

.modal-description {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #495057;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Modal Actions Keys */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-buy {
    display: block;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn-buy:hover {
    opacity: 0.9;
}

.btn-universo {
    background-color: #E30613;
    /* Colore libreria universo approx */
    color: white;
}

.btn-ibs {
    background-color: #cc0000;
    color: white;
}

.btn-bookseller {
    display: block;
    text-align: center;
    padding: 12px;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: 8px;
    font-weight: 600;
    margin-top: 10px;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.btn-bookseller:hover {
    background-color: var(--color-primary);
    color: white;
}

/* * RESPONSIVE MOBILE */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: var(--color-surface);
        box-shadow: var(--shadow-sm);
        padding: 20px 0;
    }

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

    .nav-item {
        width: 100%;
        text-align: center;
    }

    .nav-item a {
        padding: 15px;
        display: block;
        width: 100%;
    }

    .nav-item a::after {
        display: none;
    }

    .hamburger {
        display: block;
    }

    .hero {
        padding-top: 140px;
        padding-bottom: 60px;
    }
}