/**
 * CSS per Endpoint WooCommerce - Caricamenti Taglio Laser
 * Design moderno e responsive per una UI eccezionale
 */

.imorder-caricamenti-container {
    max-width: 1200px;
    margin: 0 auto;
    /* padding: 20px; */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header Section */
.caricamenti-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 16px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.caricamenti-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.caricamenti-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0 0 30px;
    font-weight: 300;
}

/* Statistiche Cards */
.caricamenti-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.25);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.action-card .button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.action-card .button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Filtri Section */
.caricamenti-filters {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.filter-row-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e1e8ef;
    border-radius: 10px;
    font-size: 15px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    appearance: none;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6,9 12,15 18,9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 45px;
}

/* Griglia Caricamenti */
.caricamenti-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Default: 4 colonne per shortcode */
    gap: 20px;
    margin-bottom: 40px;
    min-height: 400px;
}

/* Endpoint WooCommerce: 2 colonne */
.imorder-endpoint-layout .caricamenti-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.upload-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

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

.upload-preview {
    width: 100%;
    aspect-ratio: 1; /* Rende l'immagine quadrata */
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow: hidden;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cambiato da contain a cover per riempire l'area quadrata */
    transition: all 0.3s ease;
}

.upload-card:hover .upload-preview img {
    transform: scale(1.05);
}

.upload-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.2), transparent);
}

/* Badge per stato e tipo file */
.upload-badges {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.status-badge,
.file-type-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.status-badge.status-ordered {
    background: rgba(72, 187, 120, 0.9);
    color: white;
}

.status-badge.status-saved {
    background: rgba(99, 102, 241, 0.9);
    color: white;
}

.file-type-badge.vector {
    background: rgba(139, 69, 19, 0.9);
    color: white;
}

.file-type-badge.raster {
    background: rgba(147, 51, 234, 0.9);
    color: white;
}


.upload-id {
    font-size: 0.8rem;
    color: #a0aec0;
    font-weight: 600;
    background: #f7fafc;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Card con stato evidenziato */
.upload-card.status-ordered {
    border-left: 4px solid #48bb78;
}

.upload-card.status-saved {
    border-left: 4px solid #6366f1;
}

.upload-info {
    padding: 15px 20px 20px;
}



.upload-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 0.9rem;
    color: #2d3748;
    font-weight: 500;
}

.upload-price {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 8px;
    text-align: center;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}


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

.btn-load {
    flex: 1;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
}

.btn-load:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-delete {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Loading States */
.loading-spinner {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #718096;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.no-uploads {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #718096;
}

.no-uploads h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #4a5568;
}

.no-uploads p {
    font-size: 1rem;
    margin-bottom: 25px;
}

.no-uploads .button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.no-uploads .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Carica altro */
.caricamenti-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.load-more-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.load-more-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.pagination-info {
    color: #718096;
    font-size: 0.9rem;
    text-align: center;
}

/* Responsive Design */
@media (min-width: 1400px) {
    /* Shortcode: 4 colonne anche su schermi grandi */
    .imorder-shortcode-layout .caricamenti-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
    
    /* Endpoint: rimane 2 colonne anche su schermi grandi */
    .imorder-endpoint-layout .caricamenti-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    /* Shortcode: 3 colonne su tablet */
    .imorder-shortcode-layout .caricamenti-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    /* Endpoint: 2 colonne su tablet */  
    .imorder-endpoint-layout .caricamenti-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .imorder-caricamenti-container {
        padding: 15px;
    }
    
    .caricamenti-header {
        padding: 30px 20px;
    }
    
    .caricamenti-header h2 {
        font-size: 2rem;
    }
    
    .caricamenti-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px 15px;
    }
    
    .caricamenti-filters {
        padding: 20px;
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .caricamenti-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .upload-meta {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .upload-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .caricamenti-header h2 {
        font-size: 1.8rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .caricamenti-stats {
        grid-template-columns: 1fr;
    }
    
    .pagination-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-card {
    animation: fadeInUp 0.6s ease forwards;
}

.upload-card:nth-child(1) { animation-delay: 0.1s; }
.upload-card:nth-child(2) { animation-delay: 0.2s; }
.upload-card:nth-child(3) { animation-delay: 0.3s; }
.upload-card:nth-child(4) { animation-delay: 0.4s; }

/* Tooltip per azioni */
.btn-delete {
    position: relative;
}

.btn-delete::after {
    content: 'Elimina';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.btn-delete:hover::after {
    opacity: 1;
}

/* Effetti speciali per hover */
.upload-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px;
    pointer-events: none; /* FONDAMENTALE: permette i click sui contenuti sottostanti */
}

.upload-card:hover::before {
    opacity: 1;
}

/* Colorazione differenziata per tipo configuratore */
.upload-card.tipo-laser {
    background: linear-gradient(to bottom, #fff3e0 0%, white 15%) !important;
    border-left: 4px solid #ff9800 !important;
}

.upload-card.tipo-plotter {
    background: linear-gradient(to bottom, #e8f5e9 0%, white 15%) !important;
    border-left: 4px solid #4caf50 !important;
}

/* Override per stato ordinato */
.upload-card.status-ordered.tipo-laser {
    background: linear-gradient(to bottom, #fff8e1 0%, white 15%) !important;
    border-left: 4px solid #ff9800 !important;
}

.upload-card.status-ordered.tipo-plotter {
    background: linear-gradient(to bottom, #e8f5e9 0%, white 15%) !important;
    border-left: 4px solid #4caf50 !important;
}

/* Override per stato saved */
.upload-card.status-saved.tipo-laser {
    background: linear-gradient(to bottom, #fff3e0 0%, white 15%) !important;
    border-left: 4px solid #ff9800 !important;
}

.upload-card.status-saved.tipo-plotter {
    background: linear-gradient(to bottom, #e8f5e9 0%, white 15%) !important;
    border-left: 4px solid #4caf50 !important;
}