/* Pittsburgh Sleep Quality Quiz (PSQI) Styles */

.psqi-quiz-wrapper {
    max-width: 900px;
    margin: 60px auto;
    padding: 0 20px;
}

.psqi-quiz-container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* Intro Card - Stato iniziale */
.psqi-intro-card {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 60px 40px;
    text-align: center;
    color: white;
}

.psqi-intro-icon {
    font-size: 80px;
    margin-bottom: 24px;
    display: block;
    animation: psqiFloat 3s ease-in-out infinite;
}

@keyframes psqiFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.psqi-intro-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 20px 0;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.psqi-intro-text {
    font-size: 16px;
    margin: 0 auto 32px auto;
    opacity: 0.95;
    font-weight: 400;
    line-height: 1.7;
    max-width: 550px;
}

.psqi-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: white;
    color: #6366f1;
    border: none;
    padding: 18px 40px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.psqi-start-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.psqi-start-btn:active {
    transform: translateY(0) scale(0.98);
}

.psqi-start-btn-icon {
    font-size: 20px;
}

/* Quiz Content */
.psqi-quiz-content {
    animation: psqiFadeIn 0.4s ease-out;
}

.psqi-quiz-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 28px 32px;
    text-align: center;
    color: white;
}

.psqi-quiz-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.psqi-quiz-subtitle {
    font-size: 16px;
    margin: 0;
    opacity: 0.95;
    font-weight: 400;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Progress bar */
.psqi-quiz-progress {
    padding: 12px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.psqi-quiz-progress-info {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 6px;
    text-align: center;
}

.psqi-quiz-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.psqi-quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 20px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* Form */
.psqi-quiz-form {
    padding: 40px 32px;
}

/* Steps */
.psqi-quiz-step {
    display: none;
}

.psqi-quiz-step-active {
    display: block;
    animation: psqiFadeIn 0.3s ease-in-out;
}

@keyframes psqiFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section title */
.psqi-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.psqi-section-icon {
    font-size: 28px;
}

.psqi-section-intro {
    font-size: 16px;
    color: #6b7280;
    margin: 0 0 24px 0;
    padding: 16px;
    background: #f3f4f6;
    border-radius: 12px;
    border-left: 4px solid #6366f1;
}

/* Question group */
.psqi-question-group {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Form group */
.psqi-form-group {
    margin-bottom: 24px;
}

.psqi-form-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    line-height: 1.5;
}

.psqi-form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s;
    background: white;
    box-sizing: border-box;
}

.psqi-form-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.psqi-textarea {
    resize: vertical;
    min-height: 80px;
}

.psqi-form-hint {
    display: block;
    font-size: 13px;
    color: #9ca3af;
    margin-top: 6px;
    font-style: italic;
}

/* Radio group */
.psqi-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.psqi-radio-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
}

.psqi-radio {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.psqi-radio:hover {
    background: white;
    border-color: #6366f1;
}

.psqi-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.psqi-radio input[type="radio"]:checked + .psqi-radio-mark {
    background: #6366f1;
    border-color: #6366f1;
}

.psqi-radio input[type="radio"]:checked + .psqi-radio-mark::after {
    opacity: 1;
    transform: scale(1);
}

.psqi-radio input[type="radio"]:checked ~ .psqi-radio-text {
    color: #1f2937;
    font-weight: 600;
}

.psqi-radio-mark {
    width: 22px;
    height: 22px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
    background: white;
}

.psqi-radio-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.2s;
}

.psqi-radio-text {
    font-size: 15px;
    color: #374151;
    transition: all 0.2s;
}

/* Radio cards (for quality rating) */
.psqi-radio-card {
    flex: 1;
    min-width: 140px;
    padding: 0;
    background: transparent;
    border: none;
}

.psqi-radio-card input[type="radio"]:checked + .psqi-radio-card-content {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
    color: white;
}

.psqi-radio-card input[type="radio"]:checked + .psqi-radio-card-content .psqi-radio-card-text {
    color: white;
}

.psqi-radio-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    transition: all 0.2s;
    text-align: center;
}

.psqi-radio-card-content:hover {
    background: white;
    border-color: #6366f1;
    transform: translateY(-2px);
}

.psqi-radio-card-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.psqi-radio-card-text {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* Email section */
.psqi-quiz-email-box {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 2px solid #c4b5fd;
    border-radius: 20px;
    padding: 32px;
    text-align: center;
}

.psqi-email-title {
    font-size: 20px;
    font-weight: 700;
    color: #4c1d95;
    margin: 0 0 8px 0;
}

.psqi-email-subtitle {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 16px 0;
}

.psqi-quiz-optional-badge {
    display: inline-block;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    border: 2px solid #f59e0b;
}

.psqi-quiz-email-choice {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.psqi-quiz-email-choice .psqi-radio {
    background: white;
}

.psqi-quiz-email-fields {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #c4b5fd;
    text-align: left;
}

.psqi-quiz-email-fields .psqi-form-group {
    margin-bottom: 16px;
}

.psqi-quiz-privacy-note {
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    margin-top: 16px;
    line-height: 1.5;
}

/* Navigation */
.psqi-quiz-navigation {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.psqi-quiz-btn {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.psqi-quiz-btn-prev {
    background: #f3f4f6;
    color: #374151;
}

.psqi-quiz-btn-prev:hover {
    background: #e5e7eb;
    transform: translateX(-2px);
}

.psqi-quiz-btn-next {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    margin-left: auto;
}

.psqi-quiz-btn-next:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.psqi-quiz-btn-submit {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 18px;
    padding: 18px 32px;
}

.psqi-quiz-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.psqi-btn-icon {
    font-size: 24px;
}

/* Loader */
.psqi-quiz-loader {
    text-align: center;
    padding: 60px;
}

.psqi-quiz-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: psqiSpin 0.8s linear infinite;
}

@keyframes psqiSpin {
    to {
        transform: rotate(360deg);
    }
}

.psqi-quiz-loader p {
    color: #6b7280;
    font-size: 16px;
}

/* Results */
.psqi-quiz-results {
    padding: 60px 32px;
    text-align: center;
}

.psqi-quiz-results-content {
    max-width: 600px;
    margin: 0 auto;
}

.psqi-quiz-results-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.psqi-quiz-results-title {
    font-size: 32px;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 32px 0;
}

.psqi-quiz-results-score {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    padding: 32px;
    border-radius: 20px;
    margin-bottom: 24px;
    border: 2px solid #c4b5fd;
}

.psqi-quiz-score-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.psqi-quiz-score-value {
    font-size: 72px;
    font-weight: 800;
    color: #6366f1;
    line-height: 1;
    margin-bottom: 8px;
}

.psqi-quiz-score-max {
    font-size: 18px;
    color: #6b7280;
    font-weight: 500;
}

.psqi-quiz-results-interpretation {
    font-size: 20px;
    font-weight: 700;
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.psqi-quiz-results-interpretation.good {
    background: #d1fae5;
    color: #065f46;
}

.psqi-quiz-results-interpretation.poor {
    background: #fee2e2;
    color: #991b1b;
}

.psqi-quiz-results-message {
    font-size: 16px;
    color: #374151;
    line-height: 1.6;
    padding: 20px;
    background: white;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

/* Components detail */
.psqi-quiz-components {
    text-align: left;
    background: #f9fafb;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.psqi-quiz-components h4 {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 16px 0;
}

.psqi-components-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psqi-component-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.psqi-component-name {
    font-size: 14px;
    color: #374151;
}

.psqi-component-score {
    font-size: 14px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    color: white;
}

.psqi-component-score.score-0 {
    background: #22c55e;
}

.psqi-component-score.score-1 {
    background: #eab308;
}

.psqi-component-score.score-2 {
    background: #f97316;
}

.psqi-component-score.score-3 {
    background: #ef4444;
}

/* Retry button */
.psqi-quiz-btn-retry {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    margin-top: 16px;
    padding: 16px 32px;
    font-size: 16px;
}

.psqi-quiz-btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* ========== Sezione Domanda Risultati ========== */
.psqi-results-question {
    padding: 60px 32px;
    text-align: center;
    background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 100%);
}

.psqi-results-question-icon {
    font-size: 72px;
    margin-bottom: 20px;
    display: block;
    animation: psqiFloat 3s ease-in-out infinite;
}

.psqi-results-question-title {
    font-size: 28px;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.psqi-results-question-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0 0 32px 0;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.psqi-results-question-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.psqi-quiz-btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 18px 36px;
    font-size: 17px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}

.psqi-quiz-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.45);
}

.psqi-quiz-btn-secondary {
    background: white;
    color: #6366f1;
    padding: 18px 36px;
    font-size: 17px;
    font-weight: 700;
    border: 2px solid #6366f1;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.psqi-quiz-btn-secondary:hover {
    background: #f5f3ff;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

/* ========== Sezione Solo Email ========== */
.psqi-email-only {
    padding: 80px 32px;
    text-align: center;
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 100%);
}

.psqi-email-only-icon {
    font-size: 80px;
    margin-bottom: 24px;
    display: block;
}

.psqi-email-only-title {
    font-size: 32px;
    font-weight: 800;
    color: #065f46;
    margin: 0 0 16px 0;
}

.psqi-email-only-text {
    font-size: 18px;
    color: #374151;
    margin: 0 0 32px 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

.psqi-email-only-check {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    max-width: 400px;
    margin: 0 auto 32px auto;
}

.psqi-email-only-check-icon {
    font-size: 28px;
}

.psqi-email-only-check span {
    font-size: 16px;
    color: #374151;
    font-weight: 500;
}

/* ========== Box Congratulazioni nei Risultati ========== */
.psqi-quiz-congrats-box {
    background: linear-gradient(135deg, #d1fae5, #ecfdf5);
    border: 2px solid #10b981;
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.psqi-congrats-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.psqi-congrats-text {
    font-size: 17px;
    color: #065f46;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
}

.psqi-congrats-text strong {
    display: block;
    font-size: 19px;
    margin-bottom: 4px;
}

/* Responsive per nuove sezioni */
@media (max-width: 768px) {
    .psqi-results-question,
    .psqi-email-only {
        padding: 40px 20px;
    }
    
    .psqi-results-question-title,
    .psqi-email-only-title {
        font-size: 24px;
    }
    
    .psqi-results-question-buttons {
        flex-direction: column;
    }
    
    .psqi-quiz-btn-primary,
    .psqi-quiz-btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .psqi-quiz-congrats-box {
        flex-direction: column;
        text-align: center;
    }
    
    .psqi-congrats-text {
        text-align: center;
    }
}

/* Messages */
.psqi-quiz-messages {
    margin-bottom: 24px;
}

.psqi-quiz-message {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
}

.psqi-quiz-message-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.psqi-quiz-message-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Footer */
.psqi-quiz-footer {
    padding: 32px;
    text-align: center;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.psqi-quiz-logo {
    max-width: 200px;
    height: auto;
    transition: transform 0.2s;
}

.psqi-quiz-logo-main {
    max-width: 150px;
}

.psqi-quiz-logo-powered {
    max-width: 120px;
}

.psqi-quiz-powered-by {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.psqi-quiz-powered-by span {
    font-size: 12px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.psqi-quiz-logo:hover {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .psqi-quiz-wrapper {
        margin: 30px auto;
        padding: 0 16px;
    }
    
    .psqi-quiz-header {
        padding: 32px 24px;
    }
    
    .psqi-quiz-title {
        font-size: 24px;
    }
    
    .psqi-quiz-subtitle {
        font-size: 14px;
    }
    
    .psqi-quiz-form {
        padding: 24px 20px;
    }
    
    .psqi-section-title {
        font-size: 18px;
    }
    
    .psqi-radio-horizontal {
        flex-direction: column;
    }
    
    .psqi-radio-card {
        min-width: 100%;
    }
    
    .psqi-quiz-navigation {
        flex-direction: column;
    }
    
    .psqi-quiz-btn-next {
        margin-left: 0;
    }
    
    .psqi-quiz-score-value {
        font-size: 56px;
    }
    
    .psqi-quiz-email-box {
        padding: 24px 16px;
    }
}
