* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9edf2 100%);
    min-height: 100vh;
    
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.8rem;
    color: #0f3b5c;
    margin-bottom: 0.5rem;
}

.header p {
    color: #4a6a85;
    font-size: 0.95rem;
}

.card {
    background: white;
    border-radius: 1.5rem;
    padding: 1.8rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.3rem;
    color: #1e4a76;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 1rem;
}

.mode-btn {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    border: none;
    background: transparent;
    border-radius: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    color: #4a6a85;
    transition: all 0.3s;
}

.mode-btn.active {
    background: #0f3b5c;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.2rem;
    position: relative;
}

label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.input-hint {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

button {
    background: #0f3b5c;
    color: white;
    border: none;
    padding: 0.9rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 2rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
    margin-top: 0.5rem;
}

button:hover {
    background: #1e4a76;
}

.result {
    background: #f8fafc;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 1rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    color: #2c3e50;
}

.result-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.result-value.highlight {
    color: #2563eb;
    font-size: 1.3rem;
}

.verdict {
    margin-top: 1.2rem;
    padding: 1rem;
    border-radius: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.verdict.correct {
    background: #d1fae5;
    color: #065f46;
}

.verdict.warning {
    background: #fed7aa;
    color: #9b2c1d;
}

.verdict.info {
    background: #dbeafe;
    color: #1e40af;
}

.verdict.danger {
    background: #fee2e2;
    color: #991b1b;
}

.footer-note {
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 1.5rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.comparison-card {
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.comparison-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.comparison-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.usura-alert {
    background: #fff3e0;
    border-left: 4px solid #f59e0b;
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

/* Help e tooltip - SOLO AL CLICK */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #e2e8f0;
    color: #4a6a85;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    transition: all 0.2s;
    position: relative;
}

.help-icon:hover,
.help-icon.active {
    background: #0f3b5c;
    color: white;
}

.tooltip-content {
    display: none;
    position: absolute;
    background: #1e293b;
    color: white;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    width: 260px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    top: 100%;
    left: 0;
    margin-top: 8px;
}

.tooltip-content.show {
    display: block;
}

/* Overlay per chiudere i tooltip */
.tooltip-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.tooltip-overlay.show {
    display: block;
}

/* Glossario */
.glossary-btn {
    background: #eef2ff;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    cursor: pointer;
    color: #1e4a76;
    margin-left: 0.5rem;
}

.glossary-panel {
    background: #f8fafc;
    border-radius: 1rem;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.glossary-panel h4 {
    color: #0f3b5c;
    margin-bottom: 0.5rem;
}

.glossary-term {
    font-weight: 700;
    color: #2563eb;
}

/* Demo button */
.demo-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: #475569;
    margin-top: 0.3rem;
    transition: all 0.2s;
}

.demo-btn:hover {
    background: #e2e8f0;
}

/* Educational box */
.edu-box {
    background: #fef9e6;
    border-left: 4px solid #f59e0b;
    padding: 0.8rem 1rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    font-size: 0.85rem;
}

.edu-box strong {
    color: #b45309;
}

/* FAQ */
.faq-item {
    margin-bottom: 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.faq-question {
    font-weight: 700;
    color: #0f3b5c;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-answer {
    display: none;
    padding-top: 0.5rem;
    color: #4a5568;
    font-size: 0.85rem;
    line-height: 1.4;
}

.faq-answer.show {
    display: block;
}

.faq-icon {
    font-size: 1.2rem;
}

/* Ottimizzazioni mobile */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
    }
    
    .card {
        padding: 1.2rem;
        border-radius: 1rem;
    }
    
    .mode-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    input {
        padding: 0.7rem 0.9rem;
        font-size: 16px;
    }
    
    button {
        padding: 0.8rem;
        font-size: 0.95rem;
    }
    
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .result-label {
        font-size: 0.85rem;
    }
    
    .result-value {
        font-size: 1rem;
        align-self: flex-end;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .help-icon {
        width: 22px;
        height: 22px;
        font-size: 14px;
    }
    
    .demo-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.7rem;
    }
    
    .faq-question {
        font-size: 0.9rem;
    }
    
    /* Tooltip su mobile - posizionamento centrale */
    .tooltip-content {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 300px;
        margin-top: 0;
        z-index: 1001;
    }
    
    .form-group {
        position: static;

    }
    
    body.tooltip-open {
        overflow: hidden;
    }
}