* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.search-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#domanda {
    flex: 1;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#domanda:focus {
    outline: none;
    border-color: #667eea;
}

#cercaBtn {
    padding: 15px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

#cercaBtn:hover {
    background: #5a6fd8;
}

#cercaBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.suggestion-tag {
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e1e5e9;
}

.suggestion-tag:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.results-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.results-container h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.risultato {
    background: #f8f9fa;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.risultato:hover {
    transform: translateX(5px);
}

.risultato-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 10px;
}

.posizione {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
}

.metadati {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.metadato-tag {
    background: #e9ecef;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
}

.contenuto {
    line-height: 1.6;
    color: #555;
}

.similarita {
    text-align: right;
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

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

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

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #f5c6cb;
}

footer {
    margin-top: auto;
    text-align: center;
    padding: 20px;
    color: white;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stats span {
    background: rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
}
