/**
 * Health Risk Prediction Modal System
 * Modern multi-step modal for Oncology and Cardiovascular risk assessments
 */

/* Ensure modal backdrop is visible */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-backdrop.show {
    opacity: 1;
}

.health-risk-modal .modal-dialog {
    max-width: 900px;
    margin: 1.75rem auto;
}

.health-risk-modal .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.health-risk-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    padding: 24px 32px;
    border-bottom: none;
}

.health-risk-modal .modal-header.oncology {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.health-risk-modal .modal-header.cardiovascular {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.health-risk-modal .modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.health-risk-modal .modal-title i {
    font-size: 1.75rem;
}

.health-risk-modal .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.health-risk-modal .btn-close:hover {
    opacity: 1;
}

/* Progress Stepper */
.progress-stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 48px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 80px;
    position: relative;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 60%;
    width: 100%;
    height: 2px;
    background: #dee2e6;
    z-index: 0;
}

.progress-step.active:not(:last-child)::after,
.progress-step.completed:not(:last-child)::after {
    background: #667eea;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6c757d;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.progress-step.active .step-circle {
    background: #667eea;
    border-color: #667eea;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.progress-step.completed .step-circle {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.step-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
}

.progress-step.active .step-label {
    color: #667eea;
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: #28a745;
}

/* Modal Body */
.health-risk-modal .modal-body {
    padding: 32px 48px;
    min-height: 400px;
    max-height: calc(100vh - 400px);
    overflow-y: auto;
}

.modal-step {
    display: none;
}

.modal-step.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    margin-bottom: 24px;
}

.step-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-header p {
    color: #718096;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.form-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-label.required::after {
    content: ' *';
    color: #e53e3e;
}

.form-control,
.form-select {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: white;
    background-position: right 12px center;
    background-repeat: no-repeat;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #718096;
}

/* Checkbox and Radio Styles */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-checkbox,
.custom-radio {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-checkbox:hover,
.custom-radio:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.custom-checkbox input[type="checkbox"],
.custom-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #667eea;
}

.custom-checkbox input[type="checkbox"]:checked + label,
.custom-radio input[type="radio"]:checked + label {
    font-weight: 600;
}

.custom-checkbox.checked,
.custom-radio.checked {
    background: #f0f4ff;
    border-color: #667eea;
}

/* Range Slider */
.range-slider {
    width: 100%;
    margin: 16px 0;
}

.range-slider input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #48bb78 0%, #ecc94b 50%, #f56565 100%);
    outline: none;
    -webkit-appearance: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid #667eea;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid #667eea;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.range-value {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    margin-top: 12px;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #718096;
}

/* Summary Page Styles */
.summary-overview {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.summary-overview h4 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.summary-overview p {
    font-size: 1.05rem;
    opacity: 0.95;
    margin-bottom: 0;
}

.summary-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.summary-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
    cursor: pointer;
}

.summary-section-header h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-toggle {
    color: #667eea;
    transition: transform 0.3s ease;
}

.summary-toggle.collapsed {
    transform: rotate(-90deg);
}

.summary-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.summary-item {
    padding: 8px 0;
}

.summary-item-label {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 4px;
}

.summary-item-value {
    font-size: 0.95rem;
    color: #2d3748;
    font-weight: 500;
}

/* Payment Page */
.payment-summary {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.payment-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #cbd5e0;
    margin-bottom: 16px;
}

.payment-summary-header h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.payment-price {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
}

.payment-price-old {
    font-size: 1.25rem;
    color: #a0aec0;
    text-decoration: line-through;
    margin-right: 12px;
}

.payment-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.payment-features li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #4a5568;
}

.payment-features li i {
    color: #48bb78;
    font-size: 1.1rem;
}

.payment-method-selector {
    margin-top: 24px;
}

.payment-method {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.payment-method:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.payment-method.selected {
    background: #f0f4ff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.payment-method input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
}

.payment-method-info {
    flex: 1;
}

.payment-method-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.payment-method-desc {
    font-size: 0.85rem;
    color: #718096;
}

/* Modal Footer */
.health-risk-modal .modal-footer {
    padding: 20px 48px;
    border-top: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 0 0 16px 16px;
}

.btn-primary-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary-gradient:active {
    transform: translateY(0);
}

.btn-secondary-outline {
    background: white;
    border: 2px solid #e2e8f0;
    color: #4a5568;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn-secondary-outline:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* Who Is This For Page */
.beneficiary-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.beneficiary-option {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.beneficiary-option:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    transform: translateY(-4px);
}

.beneficiary-option.selected {
    background: linear-gradient(135deg, #f0f4ff 0%, #e6f2ff 100%);
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.beneficiary-option i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 16px;
    display: block;
}

.beneficiary-option h5 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 8px;
}

.beneficiary-option p {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
}

/* Loading and Processing States */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.processing-content {
    background: white;
    padding: 48px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
}

.processing-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
}

.processing-subtext {
    font-size: 0.95rem;
    color: #718096;
}

/* Responsive Design */
@media (max-width: 768px) {
    .health-risk-modal .modal-dialog {
        margin: 1rem auto;
        max-width: 95%;
        height: 80vh;
    }
    
    .health-risk-modal .modal-content {
        max-height: 80vh;
        border-radius: 16px;
    }
    
    .health-risk-modal .modal-header {
        padding: 16px 20px;
    }
    
    .health-risk-modal .modal-body {
        padding: 20px;
        max-height: calc(80vh - 50px);
        overflow-y: auto;
    }
    
    .health-risk-modal .modal-footer {
        padding: 16px 20px;
    }
    
    .progress-stepper {
        padding: 16px 12px;
        overflow-x: auto;
        gap: 8px;
    }
    
    .progress-step {
        min-width: 70px;
        flex: 0 0 auto;
    }
    
    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .step-label {
        font-size: 0.65rem;
        line-height: 1.2;
        max-width: 70px;
        word-wrap: break-word;
    }
    
    .summary-content {
        grid-template-columns: 1fr;
    }
    
    .beneficiary-selector {
        grid-template-columns: 1fr;
    }

    .summary-overview {
        padding: 12px;
    }
}

/* Print Styles for PDF */
@media print {
    .health-risk-modal .modal-header,
    .health-risk-modal .modal-footer,
    .progress-stepper {
        display: none;
    }
}

/* Accordion Styles for Combined Assessment */
.accordion-button {
    padding: 16px 20px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: none;
}

.accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: #667eea;
}

.accordion-item {
    margin-bottom: 12px;
}

.accordion-body {
    background: #fafafa;
}

/* Sticky Accordion Header */
.sticky-accordion-header.active-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sticky-accordion-header.active-sticky .accordion-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.sticky-accordion-header.active-sticky .accordion-button::after {
    filter: brightness(0) invert(1);
}

/* Assessment Progress Bar */
.assessment-progress-bar {
    background: #e2e8f0;
    border-radius: 20px;
    height: 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.assessment-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
    border-radius: 20px;
    transition: width 0.5s ease;
    position: relative;
}

.assessment-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.assessment-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #2d3748;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    z-index: 10;
}

/* Section Status Icons */
.section-status-icon {
    transition: all 0.3s ease;
}

.completion-badge {
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Enhanced File Upload Section */
.file-upload-wrapper {
    background: #f8f9fa;
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.file-upload-wrapper:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.file-upload-wrapper.has-files {
    border-style: solid;
    border-color: #48bb78;
    background: #f0fdf4;
}

/* File Upload Styles */
.file-upload-wrapper {
    position: relative;
}

.file-upload-wrapper input[type="file"] {
    cursor: pointer;
}

.file-upload-wrapper input[type="file"]::file-selector-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.file-upload-wrapper input[type="file"]::file-selector-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 250px;
}

.file-preview-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.file-preview-item i.fa-file-image,
.file-preview-item i.fa-file-pdf,
.file-preview-item i.fa-file-word,
.file-preview-item i.fa-file {
    font-size: 1.5rem;
    min-width: 24px;
}

.file-preview-item i.fa-file-image {
    color: #667eea;
}

.file-preview-item i.fa-file-pdf {
    color: #e53e3e;
}

.file-preview-item i.fa-file-word {
    color: #3182ce;
}

.file-preview-item i.fa-file {
    color: #718096;
}

.file-preview-item .file-name {
    flex: 1;
    font-weight: 500;
    color: #2d3748;
}

.file-preview-item .file-size {
    color: #718096;
    font-size: 0.8rem;
    padding: 2px 8px;
    background: #f7fafc;
    border-radius: 4px;
}

.file-preview-item .remove-file {
    color: #e53e3e;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: all 0.2s ease;
}

.file-preview-item .remove-file:hover {
    color: #c53030;
    transform: scale(1.2);
}

.file-upload-summary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e6f2ff 100%);
    border-radius: 8px;
    text-align: center;
    color: #2d3748;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid #cbd5e0;
}

.file-upload-summary i {
    color: #667eea;
    margin-right: 8px;
}

/* Success Checkmark Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.success-checkmark .check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid #48bb78;
}

.success-checkmark .check-icon::before {
    top: 3px;
    left: -2px;
    width: 30px;
    transform-origin: 100% 50%;
    border-radius: 100px 0 0 100px;
}

.success-checkmark .check-icon::after {
    top: 0;
    left: 30px;
    width: 60px;
    transform-origin: 0 50%;
    border-radius: 0 100px 100px 0;
    animation: rotate-circle 4.25s ease-in;
}

.success-checkmark .check-icon::before,
.success-checkmark .check-icon::after {
    content: '';
    height: 100px;
    position: absolute;
    background: #fff;
    transform: rotate(-45deg);
}

.success-checkmark .check-icon .icon-line {
    height: 5px;
    background-color: #48bb78;
    display: block;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
}

.success-checkmark .check-icon .icon-line.line-tip {
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
    animation: icon-line-tip 0.75s;
}

.success-checkmark .check-icon .icon-line.line-long {
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
    animation: icon-line-long 0.75s;
}

@keyframes rotate-circle {
    0% { transform: rotate(-45deg); }
    5% { transform: rotate(-45deg); }
    12% { transform: rotate(-405deg); }
    100% { transform: rotate(-405deg); }
}

@keyframes icon-line-tip {
    0% { width: 0; left: 1px; top: 19px; }
    54% { width: 0; left: 1px; top: 19px; }
    70% { width: 50px; left: -8px; top: 37px; }
    84% { width: 17px; left: 21px; top: 48px; }
    100% { width: 25px; left: 14px; top: 45px; }
}

@keyframes icon-line-long {
    0% { width: 0; right: 46px; top: 54px; }
    65% { width: 0; right: 46px; top: 54px; }
    84% { width: 55px; right: 0px; top: 35px; }
    100% { width: 47px; right: 8px; top: 38px; }
}
