/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f8f9fa 0%, #dee2e6 50%, #e9ecef 100%);
    min-height: 100vh;
    position: relative;
}

/* Aggiunge un pattern sottile di sfondo */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.03) 0%, transparent 50%),
                      radial-gradient(circle at 80% 20%, rgba(120, 119, 198, 0.03) 0%, transparent 50%),
                      radial-gradient(circle at 40% 80%, rgba(120, 119, 198, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Header */
header {
    text-align: center;
    padding: 14rem 1rem;
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.5)), 
                linear-gradient(135deg, #6c757d 0%, #495057 50%, #343a40 100%);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

/* Header con immagine personalizzata */
header#mainHeader {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
                               rgba(255,255,255,0.1) 0%, 
                               transparent 20%, 
                               transparent 80%, 
                               rgba(255,255,255,0.05) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Aggiunge un effetto sottile di movimento */
header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
                               transparent 40%, 
                               rgba(255,255,255,0.03) 50%, 
                               transparent 60%);
    animation: subtle-shine 15s infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes subtle-shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.header-content {
    position: relative;
    z-index: 3;
}

header h1, header p {
    position: relative;
    z-index: 3;
}

.header-image {
    display: none;
}

.header-text {
    color: white;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

header h1 {
    font-size: 3rem;
    color: white;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}

header p {
    font-size: 1.3rem;
    color: white;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.7);
    font-weight: 500;
}

/* Header Actions */
.header-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Main container */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Admin Header */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.breadcrumb-item {
    color: white;
}

.breadcrumb-item.active {
    font-weight: bold;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
}

.admin-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.admin-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Admin Stats Section */
.admin-stats {
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.stats-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6c757d, #495057);
}

.stats-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.stats-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stats-card h3 {
    color: #333;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    flex: 1;
}

.info-btn {
    background: #6c757d;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-btn:hover {
    background: #5a6268;
    transform: scale(1.1);
}

/* Storage Card Styles */
.storage-display {
    margin-bottom: 1rem;
}

.size-main {
    text-align: center;
    margin-bottom: 1.5rem;
}

.size-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #495057;
    display: block;
}

.storage-progress {
    margin-bottom: 1rem;
}

.progress-bar {
    background: #e9ecef;
    border-radius: 25px;
    height: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 25px;
    transition: width 1.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

/* Storage Details */
.storage-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    animation: slideDown 0.3s ease;
}

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

.storage-details h4 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.category-breakdown {
    display: grid;
    gap: 0.5rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #dee2e6;
}

.category-name {
    font-weight: 500;
    color: #495057;
}

.category-size {
    font-weight: 600;
    color: #495057;
}

/* Animated Counter */
.animated-counter {
    display: inline-block;
}

/* Header Management */
.header-manager {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Current Header */
.current-header {
    text-align: center;
}

.header-preview-container {
    position: relative;
    display: inline-block;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.header-preview-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

.header-preview-large {
    width: 100%;
    max-width: 400px;
    height: 120px;
    object-fit: cover;
    display: block;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.header-preview-container:hover .header-overlay {
    opacity: 1;
}

.preview-btn, .remove-header-btn-icon {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.preview-btn:hover {
    background: white;
    transform: scale(1.05);
}

.remove-header-btn-icon {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.remove-header-btn-icon:hover {
    background: #dc3545;
    transform: scale(1.05);
}

.header-info {
    margin-top: 1rem;
}

.header-status {
    color: #28a745;
    font-weight: 600;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* No Header State */
.no-header {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.no-header-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.no-header-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* Drag & Drop Upload Zone */
.header-upload-zone {
    border: 3px dashed #dee2e6;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.header-upload-zone:hover, .header-upload-zone.drag-over {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
    transform: translateY(-2px);
}

.upload-zone-content {
    position: relative;
    z-index: 2;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #007bff;
}

.header-upload-zone h4 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.header-upload-zone p {
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.browse-link {
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.header-upload-zone small {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Upload Preview */
.header-upload-preview {
    background: #e3f2fd;
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid #2196f3;
    animation: slideIn 0.3s ease;
}

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

.upload-preview-container {
    text-align: center;
}

#headerPreviewImg {
    width: 100%;
    max-width: 300px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.upload-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.confirm-upload-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.confirm-upload-btn:hover {
    background: linear-gradient(45deg, #218838, #1ea47b);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.cancel-upload-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.cancel-upload-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.upload-details {
    text-align: center;
    color: #495057;
    font-size: 0.9rem;
}

.upload-details p {
    margin: 0.25rem 0;
}

/* Anteprima header upload */
.header-upload-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.header-upload-preview p {
    margin: 0 0 10px 0;
    color: #1976d2;
    font-weight: 500;
}

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

.admin-modal-content {
    background: white;
    border-radius: 15px;
    max-width: 90%;
    max-height: 90%;
    width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease;
    overflow: hidden;
}

.admin-modal-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

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

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

.admin-modal-body {
    padding: 2rem;
    max-height: 400px;
    overflow-y: auto;
}

.admin-modal-footer {
    padding: 1rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Admin Buttons */
.admin-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.admin-btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.admin-btn-primary:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.admin-btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.admin-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.admin-btn-danger {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.admin-btn-danger:hover {
    background: linear-gradient(45deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

/* Info Content */
.info-content h4 {
    color: #495057;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.info-content p {
    color: #6c757d;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

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

/* Responsive adjustments per admin stats */
@media (max-width: 768px) {
    .admin-header {
        padding: 1.5rem;
    }
    
    .admin-title {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-card {
        padding: 1.5rem;
    }
    
    .stats-card-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .header-preview-large {
        max-width: 300px;
        height: 90px;
    }
    
    .header-upload-zone {
        padding: 1.5rem;
    }
    
    .upload-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .admin-modal-body {
        padding: 1rem;
    }
    
    .admin-modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Quick Actions */
.quick-actions {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.quick-actions h3 {
    color: #495057;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    text-align: center;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.action-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #007bff;
    color: #495057;
    text-decoration: none;
}

.action-card.logout-action:hover {
    border-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
}

.action-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.action-card h4 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.action-card p {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

/* Charts per statistiche */
.stats-chart {
    margin: 1rem 0;
}

.chart-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.chart-label {
    min-width: 80px;
    font-weight: 500;
    color: #495057;
}

.chart-bar {
    flex: 1;
    margin: 0 1rem;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.chart-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 0.8s ease;
}

.chart-value {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

/* Gallery Styles */
.gallery-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.gallery-header h2 {
    font-size: 2.5rem;
    color: #495057;
    margin-bottom: 1rem;
    font-weight: 700;
}

/* Filtri categoria */
.category-filters {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: #e9ecef;
    border-color: #6c757d;
}

.filter-btn.active {
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
    border-color: #6c757d;
}

.download-btn {
    display: inline-block;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.download-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #218838, #1ea47b);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    color: white;
    text-decoration: none;
}

.download-btn:disabled {
    background: linear-gradient(45deg, #6c757d, #5a6268);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.download-btn {
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.download-btn:disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading-shine 2s infinite;
}

@keyframes loading-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.gallery-container {
    margin-bottom: 2rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.no-photos {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.no-photos p {
    font-size: 1.2rem;
    color: #666;
}

/* Modal per immagini ingrandite */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    position: relative;
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 2rem;
}

.modal-content img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close:hover {
    opacity: 0.7;
}

/* Modal Actions */
.modal-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 1002;
}

.action-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.action-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.download-single-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.download-single-btn:hover {
    background: linear-gradient(45deg, #218838, #1ea47b);
}

.share-btn {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
}

.share-btn:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
}

/* Share Menu */
.share-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 1rem;
    background: white;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    min-width: 200px;
}

.share-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-option {
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.share-option:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.share-option.whatsapp:hover {
    background: #25d366;
    color: white;
}

.share-option.facebook:hover {
    background: #1877f2;
    color: white;
}

.share-option.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
    color: white;
}

.share-option.copy-link:hover {
    background: #6c757d;
    color: white;
}

/* Upload Form Styles */
.upload-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.upload-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #6c757d;
    border-radius: 8px;
    background: #f8f9fa;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="file"]:hover {
    border-color: #495057;
}

.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #6c757d;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.form-group select:hover, .form-group select:focus {
    border-color: #495057;
    outline: none;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.upload-btn {
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(214, 51, 132, 0.4);
}

/* Preview Container */
.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

/* Admin Gallery */
.existing-photos {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.existing-photos h3 {
    margin-bottom: 1rem;
    color: #495057;
}

.admin-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.admin-gallery-item {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.photo-actions {
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.photo-actions p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    word-break: break-all;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.delete-btn:hover {
    background: #c82333;
}

/* Messages */
.message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    white-space: pre-line;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Navigation Links */
.admin-link, .back-link {
    text-align: center;
    margin: 2rem 0;
}

.admin-link a, .back-link a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

.admin-link a:hover, .back-link a:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 14rem 1rem;
        background-attachment: scroll;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    header p {
        font-size: 1.1rem;
    }
    
    .header-actions {
        top: 15px;
        right: 15px;
    }
    
    .logout-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .gallery-header {
        padding: 1.5rem 1rem;
    }
    
    .gallery-header h2 {
        font-size: 2rem;
    }
    
    .download-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1.2rem;
    }
    
    .category-filters {
        gap: 0.3rem;
    }
    
    .filter-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    .upload-container, .existing-photos {
        padding: 1rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .modal-actions {
        bottom: 10px;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1.2rem;
    }
    
    .share-menu {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    header {
        padding: 3rem 1rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .gallery-header {
        padding: 1rem;
    }
    
    .gallery-header h2 {
        font-size: 1.8rem;
        margin-bottom: 0.8rem;
    }
    
    .download-btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
    
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .admin-gallery {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        bottom: 5px;
        gap: 0.3rem;
    }
    
    .action-btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
    
    .share-options {
        gap: 0.3rem;
    }
    
    .share-option {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
}

/* Stili per l'ottimizzazione delle immagini */
.optimization-indicator {
    background: linear-gradient(90deg, #28a745, #20c997);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
    margin: 0.5rem 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.optimized-badge {
    background: #28a745;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    display: inline-block;
    margin-left: 0.5rem;
}

/* Spinner per il caricamento */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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