/* Modal Styles for QR Consult */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 1rem 1rem 0 0;
}

.modal-title-text {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    background: #ef4444;
    color: white;
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

.modal-intro-text {
    font-size: 1.125rem;
    color: #6b7280;
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 2rem;
}

.choice-container-flex {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.choice-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.choice-card:hover,
.choice-card:focus {
    border-color: #2563eb;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    outline: 2px solid #dbeafe;
    outline-offset: 2px;
}

.choice-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    transition: left 0.5s ease;
}

.choice-card:hover::before {
    left: 100%;
}

.choice-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.choice-card-text {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}

/* Quiz Container */
.modal-hidden {
    display: none;
}

#quiz-container {
    padding: 2rem;
}

.progress-container {
    margin-bottom: 2rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fg {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #0ea5e9);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text-label {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.question-area-box {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    border-left: 4px solid #2563eb;
}

.question-text-p {
    font-size: 1.125rem;
    font-weight: 500;
    color: #1f2937;
    margin: 0;
    line-height: 1.5;
}

.answer-area-box {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.answer-btn {
    background: white;
    border: 2px solid #2563eb;
    color: #2563eb;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.answer-btn:hover,
.answer-btn:focus {
    background: #2563eb;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    outline: 2px solid #dbeafe;
    outline-offset: 2px;
}

.answer-btn[data-answer="true"]:hover {
    background: #059669;
    border-color: #059669;
}

.answer-btn[data-answer="false"]:hover {
    background: #d97706;
    border-color: #d97706;
}

/* Results Container */
.result-container-box {
    padding: 2rem;
}

.modal-back-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #6b7280;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.modal-back-btn:hover,
.modal-back-btn:focus {
    background: #dbeafe;
    color: #2563eb;
    border-color: #2563eb;
    outline: 2px solid #dbeafe;
    outline-offset: 2px;
}

.result-header-box {
    text-align: center;
    margin-bottom: 1.5rem;
}

.result-title-h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    text-align: center;
}

.result-subtitle-p {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

.result-description-p {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.result-footer {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border-left: 4px solid #0ea5e9;
}

.result-footer p {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.result-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.result-link:hover,
.result-link:focus {
    text-decoration: underline;
    outline: 2px solid #dbeafe;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1.5rem;
    }
    
    .choice-container-flex {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }
    
    .answer-area-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .answer-btn {
        width: 100%;
    }
    
    #quiz-container,
    .result-container-box {
        padding: 1.5rem;
    }
}

/* Animation for modal appearance */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(40px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-overlay.active .modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Focus trap for modal */
.modal-overlay.active {
    contain: layout style paint;
}