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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-attachment: fixed;
    background-size: cover;
    background-image:  url(assets/Pollock-1775577044188.png);
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    padding: 0;
    
}

.backgroundColor{
    display: flex;
    justify-content: center;
    align-items: center;
    padding:20px;
    width : 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eeaa7 0%, #764ba7 100%);
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 900px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

#choice-container{
    text-align: center;
}

#artistChoice {
    height: 50px;
}

/* questi per l'altezza non stanno funzionando, da indagare meglio */
.select2-container .select2-selection--single {
    height: 100px;
}
.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 100px;
}
.select2-container .select2-selection--single .select2-selection__arrow {
    height: 100px;
}

.canvas-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

#mondrianCanvas {
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    background: white;
    max-width: 100%;
    height: auto;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.generate-btn,
.download-btn,
.send-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

.send-btn {
    background: #a75f28;
    color: white;
}

.send-btn:hover {
    background: #884c21;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

.settings {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    color: #555;
    font-weight: 500;
    min-width: 100px;
}

.setting-group input[type="range"] {
    width: 150px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.setting-group span {
    color: #667eea;
    font-weight: bold;
    min-width: 30px;
}

/* Gallery Form Styles */
.gallery-form {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    margin-top: 20px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #555;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 1rem;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.cancel-btn {
    background: #6c757d;
    color: white;
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.cancel-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 117, 125, 0.3);
}

/* Animation for form appearance */
.gallery-form.show {
    animation: slideDown 0.3s ease-out;
}

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

/* View Gallery Button */
.view-gallery-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    margin-left: 15px;
}

.view-gallery-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 15px;

    width: 80%;
    max-height: 90%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.title-buttons{
    display: flex;
    flex-flow: row nowrap;
    gap:10px;
    align-items: bottom;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 300;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Gallery List Styles */
/* .gallery-list {
    display: grid;
    gap: 20px;
} */

.gallery-list {
    display: flex;
    flex-flow: row wrap; /*più esplicativo*/
    gap: 20px;
}

.gallery-item {
    width : 30%;
    display: flex;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.gallery-item-preview {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 20px;
    flex-shrink: 0;
}

.gallery-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gallery-item-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.gallery-item-author {
    color: #666;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.gallery-item-comment {
    color: #888;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Artwork Detail Modal */
.artwork-modal {
    max-width: 1200px;
}

.artwork-container {
    display: flex;
    gap: 30px;
}

.artwork-image {
    flex: 1;
    max-width: 60%;
}

.artwork-image img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.artwork-details {
    flex: 1;
    max-width: 40%;
}

.detail-group {
    margin-bottom: 20px;
}

.detail-group label {
    display: block;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.detail-group p {
    color: #333;
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.detail-btn {
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    width: 100%;
    margin-top: 20px;
}

.detail-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 53, 0.3);
}

.modify-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.modify-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 117, 125, 0.3);
}

.modify-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Modify Controls */
.modify-controls {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
}

.modify-setting-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.modify-setting-group label {
    color: #495057;
    font-weight: 600;
    min-width: 120px;
}

.modify-setting-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.modify-setting-group input[type="range"] {
    flex: 1;
}

.modify-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.keep-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 10px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.keep-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 10px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(220, 53, 69, 0.3);
}

/* Heart animation */
.heart-animation {
    display: inline-block;
    margin-left: 10px;
    font-size: 1.2em;
    color: #e74c3c;
    animation: heartBeat 1.5s ease-in-out;
}

@keyframes heartBeat {
    0% { transform: scale(0); opacity: 0; }
    15% { transform: scale(1.2); opacity: 1; }
    30% { transform: scale(0.9); opacity: 1; }
    45% { transform: scale(1.1); opacity: 1; }
    60% { transform: scale(0.95); opacity: 1; }
    75% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner-text {
    color: white;
    font-size: 1.2rem;
    margin-left: 20px;
    font-weight: 300;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    #mondrianCanvas {
        width: 100%;
        height: auto;
    }

    .settings {
        flex-direction: column;
        gap: 15px;
    }

    .setting-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #choice-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .view-gallery-btn {
        margin-left: 0;
        width: 200px;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .artwork-container {
        flex-direction: column;
    }
    
    .artwork-image,
    .artwork-details {
        max-width: 100%;
    }
    
    .gallery-item {
        flex-direction: column;
        text-align: center;
        min-width: 122px;
    }
    
    .gallery-item-preview {
        margin: 0 auto 15px auto;
    }
}