/**
 * Stencil File Pre-Verification CSS
 *
 * Stili per il sistema di pre-verifica intelligente dei file
 */

/* =======================================
   POPUP PRE-VERIFICA PRINCIPALE
   ======================================= */

#csdf-preverification-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.csdf-preverification-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

/* =======================================
   HEADER POPUP
   ======================================= */

.csdf-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.csdf-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.csdf-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csdf-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* =======================================
   CONTENUTO POPUP
   ======================================= */

.csdf-popup-content {
    padding: 30px;
}

/* =======================================
   SEZIONE ANALISI
   ======================================= */

.preverification-analysis {
    text-align: center;
    padding: 20px;
}

.analysis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.analysis-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* =======================================
   PREVIEW CONTAINER
   ======================================= */

.preverification-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.preview-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 2px solid #e9ecef;
}

#csdf-preverification-canvas {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

.preview-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* =======================================
   MESSAGGI ANALISI
   ======================================= */

.analysis-message {
    text-align: left;
}

.analysis-summary h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.analysis-details p {
    margin: 8px 0;
    font-size: 14px;
    color: #495057;
}

.analysis-details strong {
    color: #2c3e50;
}

.status-good {
    color: #28a745;
    font-weight: 600;
}

.status-neutral {
    color: #6c757d;
    font-weight: 600;
}

.recommendation {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #bbdefb;
}

.rec-good {
    color: #1565c0;
    margin: 0;
    font-size: 14px;
}

.rec-neutral {
    color: #5d4e75;
    margin: 0;
    font-size: 14px;
}

/* =======================================
   ERRORI ANALISI
   ======================================= */

.analysis-error {
    text-align: center;
    padding: 30px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    color: #c53030;
}

.analysis-error h4 {
    margin-bottom: 15px;
    color: #c53030;
}

.analysis-error p {
    margin-bottom: 20px;
    color: #4a5568;
}

/* =======================================
   AZIONI POPUP
   ======================================= */

.preverification-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.preverification-actions .button {
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.preverification-actions .button-primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.preverification-actions .button-primary:hover {
    background: linear-gradient(135deg, #218838 0%, #1abc9c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.preverification-actions .button-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.preverification-actions .button-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #383d41 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.preverification-actions .button:last-child {
    background: #dc3545;
    color: white;
}

.preverification-actions .button:last-child:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* =======================================
   RESPONSIVE DESIGN
   ======================================= */

@media (max-width: 768px) {
    .csdf-preverification-container {
        width: 95%;
        margin: 20px;
    }

    .preverification-preview {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .csdf-popup-content {
        padding: 20px;
    }

    .preverification-actions {
        flex-direction: column;
        gap: 10px;
    }

    .preverification-actions .button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .csdf-popup-header {
        padding: 15px 20px;
    }

    .csdf-popup-header h3 {
        font-size: 18px;
    }

    #csdf-preverification-canvas {
        max-width: 100%;
        height: auto;
    }
}

/* =======================================
   ANIMAZIONI
   ======================================= */

.csdf-preverification-container {
    animation: slideInFromTop 0.4s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =======================================
   NOTIFICHE
   ======================================= */

.csdf-notice {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

.csdf-notice h4 {
    color: #1565c0;
    margin-bottom: 10px;
}

.csdf-notice p {
    color: #424242;
    margin: 0;
}

/* =======================================
   MIGLIORAMENTI VISUALI
   ======================================= */

.preverification-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, #e9ecef, transparent);
    transform: translateX(-50%);
    pointer-events: none;
}

.preview-container {
    position: relative;
    overflow: hidden;
}

.preview-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    border-radius: 10px;
    pointer-events: none;
}

/* =======================================
   INDICATORI DI STATO
   ======================================= */

.confidence-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.confidence-high {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.confidence-medium {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #faeeba;
}

.confidence-low {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}