.thesis-container {
    display: flex;
    flex-wrap: wrap;      /* le card vanno a capo quando serve */
    gap: 15px;            /* spazio tra le copertine */
    justify-content: flex-start; /* allinea a sinistra, puoi mettere center o space-between */
}

.thesis-card {
    flex: 0 0 auto;       /* mantiene la sua larghezza */
    width: 200px;         /* puoi scegliere la dimensione */
}

.card-inner {
    position: relative;
    width: 100%;
    padding-bottom: 150%; /* proporzione card */
    transform-style: preserve-3d;
    transition: transform 0.8s;
}

/*.thesis-card:hover .card-inner {*/
/*    transform: rotateY(180deg);*/
/*}*/

.card-front, .card-back {
    position: absolute;
    top:0; left:0;
    width:100%; height:100%;
    border-radius: 1rem;
    backface-visibility: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.card-front {
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:1.2rem;
    font-weight:bold;
    color:white;
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg,#111,#333);
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    padding:1rem;
}

.overlay-content h3 {
    color:white;
    margin-bottom:1rem;
}

.picker-group {
    margin:0.5rem 0;
}
.picker-group label {
    color:white;
    display:block;
    margin-bottom:0.25rem;
}
.picker-group input[type=color] {
    width:40px;
    height:40px;
    border:none;
    cursor:pointer;
    border-radius:0.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Modal */
.modal {
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.7);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:9999;
}
.modal.hidden {
    display:none;
}
.modal-content {
    background:white;
    padding:2rem;
    border-radius:1rem;
    max-width:400px;
    text-align:center;
    animation: pop 0.3s ease;
}
@keyframes pop {
    from { transform:scale(0.8); opacity:0; }
    to { transform:scale(1); opacity:1; }
}
.preview {
    display:flex;
    justify-content:center;
    gap:1rem;
    margin:1rem 0;
}
.front-preview {
    width:100px;
    height:150px;
    border-radius:0.5rem;
    box-shadow:0 4px 10px rgba(0,0,0,0.3);
}
.spine-preview {
    width:30px;
    height:150px;
    border-radius:0.5rem;
    box-shadow:0 4px 10px rgba(0,0,0,0.3);
}
.modal-content button {
    background:linear-gradient(135deg,#4f46e5,#9333ea);
    border:none;
    padding:0.75rem 1.5rem;
    border-radius:0.5rem;
    color:white;
    font-weight:bold;
    cursor:pointer;
    transition:opacity 0.2s;
}
.modal-content button:hover {
    opacity:0.85;
}

.cover-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1rem 0 0.5rem;
}

.cover-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.thesis-card {
    position: relative;
    width: 200px;
    height: 300px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    background: #f9f9f9;
}

.card-front {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s;
}

.thesis-card:hover .card-front {
    transform: scale(1.05);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    transition: opacity 0.3s;
}

.thesis-card:hover .card-overlay {
    opacity: 1;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    position: relative;
}

#wiva-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

#front-colors-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.front-color-item {
    width: 100px;
    cursor: pointer;
    text-align: center;
}

.front-color-thumb {
    width: 100%;
    height: 100px;
    border-radius: 6px;
    border: 2px solid #ddd;
    margin-bottom: 5px;
    transition: transform 0.2s, border-color 0.2s;
    background-color: #f5f5f5;
    background-size: cover;
    background-position: center;
}

.front-color-item:hover .front-color-thumb {
    transform: scale(1.05);
    border-color: #333;
}

.front-color-label {
    font-size: 0.85rem;
    display: block;
    color: #333;
}

.overlay-slot {
    position: absolute;
    inset: 0;
    pointer-events: none; /* così non blocca il mouse */
}

.cover-overlay svg {
    width: 100%;
    height: 100%;
    display: block;
}

.svg-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.svg-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mask-image: url('/wp-content/uploads/2025/02/colmetal.svg');
    mask-repeat: no-repeat;
    mask-size: cover;
    -webkit-mask-image: url('/wp-content/uploads/2025/02/colmetal.svg');
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: cover;
}

/* Stili per i filtri - Material Design */
.wiva-filters {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.wiva-filters select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 1rem 3rem 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f46e5'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.5em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
}

.wiva-filters select:hover {
    border-color: #4f46e5;
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.15);
    transform: translateY(-1px);
}

.wiva-filters select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25), 0 0 0 3px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.wiva-filters select:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

/* Wrapper card con pulsanti */
.thesis-card-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Pulsanti icona */
.card-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.card-actions button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-zoom {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.btn-zoom:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-cart {
}

.btn-cart:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Modal zoom */
.modal-zoom-content {
    background: transparent;
    padding: 0;
    border-radius: 0;
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.zoom-container {
    position: relative;
    width: 400px;
    height: 600px;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.zoom-overlay-slot {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.zoom-overlay-slot .cover-overlay {
    width: 100%;
    height: 100%;
}

.zoom-overlay-slot .cover-overlay svg {
    width: 100%;
    height: 100%;
    display: block;
}

#wiva-zoom-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#wiva-zoom-close:hover {
    transform: scale(1.1);
}