/* Stili per l'editing inline */

.editable-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.edit-icon {
    display: none;
    position: absolute;
    top: -10px;
    right: -10px;
    background: #AD9551;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 100;
    transition: all 0.3s;
}

.edit-icon:hover {
    background: #8f7a42;
    transform: scale(1.1);
}

.admin-mode .editable-wrapper:hover .edit-icon {
    display: flex;
}

.editable-wrapper:hover {
    outline: 2px dashed #AD9551;
    outline-offset: 5px;
}

/* Modal per editing */
.edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.edit-modal.show {
    display: flex;
}

.edit-modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #AD9551;
}

.edit-modal-header h3 {
    margin: 0;
    color: #AD9551;
}

.modal-close {
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

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

.edit-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.edit-form-group input[type="text"],
.edit-form-group input[type="email"],
.edit-form-group input[type="number"],
.edit-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.edit-form-group input:focus,
.edit-form-group textarea:focus {
    outline: none;
    border-color: #AD9551;
}

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

.image-upload-wrapper {
    margin-top: 15px;
}

.current-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
}

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

.btn-save-edit {
    background: #AD9551;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-save-edit:hover {
    background: #8f7a42;
}

.btn-cancel-edit {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-cancel-edit:hover {
    background: #5a6268;
}

/* Admin toolbar */
.admin-toolbar {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 999;
    gap: 10px;
    align-items: center;
}

.admin-toolbar span {
    margin-right: 10px;
}

.admin-mode .admin-toolbar {
    display: flex;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .admin-toolbar {
        bottom: 10px;
        right: 10px;
        left: 10px;
        padding: 10px;
        font-size: 12px;
    }
    
    .admin-toolbar span {
        width: 100%;
        margin-bottom: 10px;
        text-align: center;
    }
    
    .admin-toolbar-btn {
        font-size: 12px;
        padding: 6px 10px;
        flex: 1;
    }
}

.admin-toolbar-btn {
    background: #AD9551;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.3s;
}

.admin-toolbar-btn:hover {
    background: #8f7a42;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(173, 149, 81, 0.3);
}

.admin-toolbar-btn.logout {
    background: #dc3545;
}

.admin-toolbar-btn.logout:hover {
    background: #c82333;
}

/* Loading spinner */
.edit-loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 10001;
    text-align: center;
}

.edit-loading.show {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #AD9551;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Success message */
.success-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 10002;
    display: none;
    animation: slideInRight 0.3s ease-out;
}

.success-toast.show {
    display: block;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Image Gallery */
.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.gallery-image-item {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    background: #f9f9f9;
    transition: all 0.3s;
}

.gallery-image-item:hover {
    border-color: #AD9551;
    box-shadow: 0 5px 15px rgba(173, 149, 81, 0.2);
}

.gallery-image-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.gallery-image-info {
    margin-bottom: 10px;
}

.gallery-image-label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
    display: block;
    margin-bottom: 5px;
}

.gallery-image-path {
    font-size: 12px;
    color: #999;
    font-family: monospace;
    word-break: break-all;
}

.gallery-image-actions {
    display: flex;
    gap: 10px;
}

.btn-change-image {
    flex: 1;
    background: #AD9551;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-change-image:hover {
    background: #8f7a42;
}

.gallery-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.gallery-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Change image form in modal */
.change-image-form {
    margin-top: 20px;
}

.image-upload-preview {
    max-width: 100%;
    max-height: 200px;
    margin: 15px 0;
    border-radius: 8px;
    display: none;
}

.image-upload-preview.show {
    display: block;
}

