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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #00B5E2 0%, #0095C8 100%); /* Pantone 7711C */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 1200px;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Language Selector */
.logo-container {
    text-align: center;
    margin-bottom: 50px;
}

.logo-container .logo-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    margin-bottom: 20px;
}

.logo-container h1 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
    display: none; /* Nascosto quando c'è il logo */
}

.logo-container h1.no-logo {
    display: block; /* Mostra se non c'è logo */
}

.logo-container p {
    color: #666;
    font-size: 1.1em;
}

.flags-container {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}

.flag-option {
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease;
}

.flag-option:hover {
    transform: scale(1.1);
}

.flag-wrapper {
    width: 180px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
    transition: box-shadow 0.3s ease;
}

.flag-option:hover .flag-wrapper {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.flag {
    width: 100%;
    height: 100%;
}

.flag-option span {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
}

/* Flipbook Container */
#flipbook-container {
    max-width: 95vw;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.btn-back, .btn-download {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-back {
    background: #6c757d;
    color: white;
}

.btn-back:hover {
    background: #5a6268;
    transform: translateX(-5px);
}

.btn-download {
    background: #28a745;
    color: white;
}

.btn-download:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Flipbook Wrapper */
.flipbook-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    margin-bottom: 30px;
}

#loading {
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #00B5E2; /* Pantone 7711C */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#flipbook {
    width: 800px;
    height: 600px;
    margin: 0 auto;
}

#flipbook .page {
    width: 400px;
    height: 600px;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

#flipbook .page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mobile Viewer Styles */
.mobile-viewer {
    width: 100% !important;
    height: auto !important;
    margin: 0 0 15px 0 !important;
    display: block !important;
}

.mobile-page {
    width: 100%;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    margin-bottom: 15px;
}

.mobile-page img {
    width: 100%;
    height: auto;
    max-height: 52vh;
    object-fit: contain;
    display: block;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.btn-nav {
    padding: 12px 30px;
    background: #00B5E2; /* Pantone 7711C */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-nav:hover {
    background: #0095C8; /* Pantone 7711C più scuro */
    transform: scale(1.05);
}

.btn-nav:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#page-info {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 5px;
        align-items: flex-start;
    }

    .container {
        padding: 15px;
        margin: 10px 0;
    }

    .logo-container {
        margin-bottom: 30px;
    }

    .logo-container h1 {
        font-size: 1.6em;
    }

    .logo-container p {
        font-size: 0.9em;
    }

    .flags-container {
        gap: 25px;
    }

    .flag-wrapper {
        width: 130px;
        height: 90px;
    }

    .flag-option span {
        font-size: 1em;
    }

    /* Flipbook container mobile */
    #flipbook-container {
        padding: 10px;
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .header {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 15px;
        flex-wrap: nowrap;
    }

    .btn-back, .btn-download {
        flex: 1;
        padding: 10px 12px;
        font-size: 0.85em;
        white-space: nowrap;
    }

    .flipbook-wrapper {
        min-height: auto;
        max-height: 60vh;
        padding: 10px;
        margin-bottom: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #flipbook {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 55vh !important;
        margin-bottom: 15px;
    }

    #flipbook .page {
        width: 100% !important;
        height: auto !important;
        max-height: 55vh;
        display: flex !important;
        align-items: center;
        justify-content: center;
        margin-bottom: 10px;
    }

    #flipbook .page img {
        width: 100%;
        height: auto;
        max-height: 52vh;
        object-fit: contain;
    }

    .controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
        margin-top: 20px;
        padding-top: 15px;
        border-top: 2px solid #f0f0f0;
    }

    .btn-nav {
        flex: 1;
        padding: 12px 20px;
        font-size: 0.9em;
        min-width: 80px;
    }

    #page-info {
        font-size: 0.95em;
        white-space: nowrap;
        min-width: 100px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo-container h1 {
        font-size: 1.4em;
    }

    .flag-wrapper {
        width: 110px;
        height: 75px;
    }

    .flag-option span {
        font-size: 0.95em;
    }

    .btn-back, .btn-download {
        padding: 8px 10px;
        font-size: 0.8em;
    }

    .flipbook-wrapper {
        max-height: 45vh;
        padding: 5px;
        margin-bottom: 15px;
    }

    #flipbook,
    #flipbook .page,
    #flipbook .page img,
    .mobile-page img {
        max-height: 42vh !important;
    }

    .controls {
        margin-top: 15px;
        padding-top: 12px;
    }

    .btn-nav {
        padding: 10px 15px;
        font-size: 0.85em;
    }

    #page-info {
        font-size: 0.85em;
        min-width: 80px;
    }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .flipbook-wrapper {
        max-height: 70vh;
    }

    #flipbook,
    #flipbook .page,
    #flipbook .page img {
        max-height: 70vh !important;
    }
}
