* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin: 0 auto 30px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    backdrop-filter: blur(10px);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.btn-logout:active {
    transform: translateY(0);
}

/* Input Mode Toggle */
.input-mode-toggle {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.toggle-container {
    position: relative;
    display: inline-flex;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.toggle-btn {
    position: relative;
    z-index: 2;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.toggle-btn:hover {
    color: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.toggle-btn.active {
    color: #667eea;
}

.toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 2px);
    height: calc(100% - 8px);
    background: white;
    border-radius: 8px;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toggle-container:has(.toggle-btn:nth-child(2).active) .toggle-slider {
    left: calc(50% + 2px);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Results Panel */
.results-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    height: 85vh;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

#resultsContainer {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 60px;
    min-height: min-content;
}

/* Floating scroll-to-top button */
.results-scroll-top {
    position: fixed;
    right: calc(50% - 680px + 20px);
    bottom: 30px;
    z-index: 1000;
    padding: 12px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.results-scroll-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    background: #5568d3;
}

/* Global scroll-to-top FAB */
.scroll-top-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1500;
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 24px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scroll-top-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
}

/* Input Panel */
.input-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    height: 85vh;
    min-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Input Mode Containers */
.input-mode {
    flex: 1;
    overflow-y: auto;
}

/* JSON Error Container */
.json-error-container {
    background: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.json-error-container .error-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.json-error-container .error-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.json-error-container .error-message {
    flex: 1;
}

.json-error-container .error-message strong {
    color: #e74c3c;
    display: block;
    margin-bottom: 4px;
}

.json-error-container .error-message p {
    color: #c0392b;
    margin: 0;
    font-size: 0.95rem;
}

.btn-close-error {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.2s;
}

.btn-close-error:hover {
    color: #c0392b;
}

/* Paste Textarea */
.paste-textarea {
    width: 100%;
    height: 300px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.3s;
    line-height: 1.6;
}

.paste-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.paste-textarea::placeholder {
    color: #999;
}

/* Extract Error Container */
.extract-error-container {
    background: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

.extract-error-container .error-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.extract-error-container .error-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.extract-error-container .error-message {
    flex: 1;
}

.extract-error-container .error-message strong {
    color: #e74c3c;
    display: block;
    margin-bottom: 4px;
}

.extract-error-container .error-message p {
    color: #c0392b;
    margin: 0;
    font-size: 0.95rem;
}

/* Preview Subsections */
.preview-subsection {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.preview-subsection h3 {
    font-size: 1.1rem;
    color: #667eea;
    margin-bottom: 12px;
    font-weight: 600;
}

.preview-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Preview Medication Cards */
.preview-med-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}

.preview-med-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.preview-med-number {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.preview-med-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    margin-bottom: 6px;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}

/* Small Lab Grid */
.lab-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.lab-grid-small .form-group {
    margin-bottom: 0;
}

.lab-grid-small label {
    font-size: 0.85rem;
}

.lab-grid-small input {
    font-size: 0.9rem;
    padding: 6px 8px;
}

/* Collapsible Section */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapsible-header:hover {
    color: #5568d3;
}

#labToggleIcon {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

#labToggleIcon.rotated {
    transform: rotate(-90deg);
}

/* Small Add Button */
.btn-add-small {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-add-small:hover {
    background: #5568d3;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h2 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
}

.required {
    color: #e74c3c;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background-color: #f5f5f5;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 1rem;
    color: #333;
}

/* Medication Cards */
.medication-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    position: relative;
}

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

.medication-number {
    font-weight: 600;
    color: #667eea;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-remove:hover {
    background: #c0392b;
}

.med-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

/* Buttons */
.btn-add {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    width: 100%;
    transition: background-color 0.2s;
}

.btn-add:hover {
    background: #5568d3;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

/* Results Panel */
.results-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    height: 85vh;
    min-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Ensure alerts stack vertically */
#resultsContainer {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    flex: 1;
    overflow-y: auto;
}

.results-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.empty-state {
    text-align: center;
    color: #999;
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 15px;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 1rem;
}

/* Alert Summary */
.alert-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.alert-summary h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.summary-counts {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1.1rem;
}

.summary-counts span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Alert Cards */
.alert-card {
    background: white;
    border-left: 5px solid;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 0; /* gap handles spacing */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.alert-card.high {
    border-left-color: #e74c3c;
    background: #fff5f5;
}

.alert-card.moderate {
    border-left-color: #f39c12;
    background: #fffbf0;
}

.alert-card.low {
    border-left-color: #3498db;
    background: #f0f8ff;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.severity-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.high {
    background: #e74c3c;
    color: white;
}

.severity-badge.moderate {
    background: #f39c12;
    color: white;
}

.severity-badge.low {
    background: #3498db;
    color: white;
}

.rule-id {
    color: #999;
    font-size: 0.9rem;
}

.alert-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.alert-section {
    margin-bottom: 15px;
}

.alert-section h4 {
    font-size: 1rem;
    color: #667eea;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.alert-section p {
    color: #555;
    line-height: 1.6;
}

.evidence-list {
    list-style: none;
    padding: 0;
}

.evidence-list li {
    padding: 6px 0;
    color: #555;
}

.evidence-list li strong {
    color: #333;
}

.medication-list {
    list-style: none;
    padding-left: 20px;
    margin-top: 5px;
}

.medication-list li {
    padding: 4px 0;
    color: #667eea;
    font-weight: 500;
}

.medication-list li::before {
    content: "💊 ";
    margin-right: 5px;
}

.duplicate-group {
    margin-top: 8px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 4px;
}

.duplicate-group strong {
    color: #667eea;
    text-transform: capitalize;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
}

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

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

/* Responsive */
@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .input-panel,
    .results-panel {
        max-height: none;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .med-row {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar styling */
.input-panel::-webkit-scrollbar,
.results-panel::-webkit-scrollbar {
    width: 8px;
}

.input-panel::-webkit-scrollbar-track,
.results-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.input-panel::-webkit-scrollbar-thumb,
.results-panel::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.input-panel::-webkit-scrollbar-thumb:hover,
.results-panel::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}
/* Labs Modal Styling */
.btn-add-labs {
    background-color: #667eea;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-add-labs:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    z-index: 1;
}

.modal-content {
    position: relative;
    z-index: 2;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f9f9f9;
}

.lab-panel {
    margin-bottom: 30px;
}

.lab-panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.lab-field {
    display: flex;
    flex-direction: column;
}

.lab-field label {
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.lab-field input {
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.lab-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Responsive design for modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .lab-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }

    .modal-header,
    .modal-footer {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 15px 20px;
    }

    .lab-field label {
        font-size: 0.85rem;
    }

    .lab-field input {
        font-size: 0.85rem;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        max-height: 95vh;
    }

    .lab-grid {
        grid-template-columns: 1fr;
    }
}

/* ====================================
   RISK SCORE CARD STYLES
   ==================================== */

.risk-score-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-left: 6px solid #ddd;
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes highlight-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 8px 24px rgba(255, 193, 7, 0.6);
        transform: scale(1.01);
    }
}

/* Risk level color variations */
.risk-score-card.risk-minimal {
    border-left-color: #4caf50;
    background: linear-gradient(to right, #f1f8f4, white);
}

.risk-score-card.risk-low {
    border-left-color: #8bc34a;
    background: linear-gradient(to right, #f5f9f0, white);
}

.risk-score-card.risk-moderate {
    border-left-color: #ffc107;
    background: linear-gradient(to right, #fffbf0, white);
}

.risk-score-card.risk-high {
    border-left-color: #ff9800;
    background: linear-gradient(to right, #fff8f0, white);
}

.risk-score-card.risk-critical {
    border-left-color: #f44336;
    background: linear-gradient(to right, #fff5f5, white);
}

.risk-header {
    margin-bottom: 24px;
}

.risk-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1a237e;
    font-weight: 600;
}

/* Risk Score Display */
.risk-score-display {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.05);
}

.risk-score-circle {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border: 8px solid #ddd;
    flex-shrink: 0;
}

.risk-score-circle.risk-minimal {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9, white);
}

.risk-score-circle.risk-low {
    border-color: #8bc34a;
    background: linear-gradient(135deg, #f1f8e9, white);
}

.risk-score-circle.risk-moderate {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fff9c4, white);
}

.risk-score-circle.risk-high {
    border-color: #ff9800;
    background: linear-gradient(135deg, #ffe0b2, white);
}

.risk-score-circle.risk-critical {
    border-color: #f44336;
    background: linear-gradient(135deg, #ffcdd2, white);
}

.risk-score-number {
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    color: #1a237e;
}

.risk-score-max {
    font-size: 24px;
    font-weight: 500;
    color: #666;
    margin-top: -8px;
}

.risk-level-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risk-icon {
    font-size: 48px;
}

.risk-level-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
    width: fit-content;
}

.risk-level-badge.risk-minimal {
    background: #4caf50;
    color: white;
}

.risk-level-badge.risk-low {
    background: #8bc34a;
    color: white;
}

.risk-level-badge.risk-moderate {
    background: #ffc107;
    color: #333;
}

.risk-level-badge.risk-high {
    background: #ff9800;
    color: white;
}

.risk-level-badge.risk-critical {
    background: #f44336;
    color: white;
}

.risk-description {
    font-size: 1rem;
    color: #555;
    margin: 0;
    line-height: 1.6;
}

/* Risk Sections */
.risk-section {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.risk-section h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: #1a237e;
    font-weight: 600;
}

/* Risk Factors Breakdown */
.risk-factors-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.risk-factor-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-factor-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.factor-name {
    font-weight: 600;
    color: #333;
}

.factor-score {
    font-weight: 700;
    color: #1a237e;
    background: rgba(26, 35, 126, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.risk-factor-bar {
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.risk-factor-fill {
    height: 100%;
    background: linear-gradient(90deg, #1a237e, #3f51b5);
    border-radius: 12px;
    transition: width 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

.risk-factor-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%);
    }
}

/* Active Clinical Flags */
.flags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.flag-badge {
    display: inline-block;
    padding: 6px 14px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #90caf9;
}

/* High-Risk Combinations */
.high-risk-combos {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.combo-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.2);
}

.combo-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.combo-text {
    font-size: 0.95rem;
    color: #333;
    font-weight: 500;
    flex: 1;
}

/* Priority Alerts */
.priority-alerts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.priority-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #1a237e;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.priority-item:hover {
    background: #e8eaf6;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.2);
}

.priority-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #1a237e;
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.priority-alert-id {
    font-weight: 600;
    color: #1a237e;
    font-size: 1rem;
    flex: 1;
}

.priority-arrow {
    font-size: 1.2rem;
    color: #1a237e;
    font-weight: 700;
}

/* Responsive Design for Risk Score Card */
@media (max-width: 768px) {
    .risk-score-card {
        padding: 16px;
    }

    .risk-score-display {
        flex-direction: column;
        gap: 20px;
        padding: 16px;
    }

    .risk-score-circle {
        width: 120px;
        height: 120px;
    }

    .risk-score-number {
        font-size: 56px;
    }

    .risk-score-max {
        font-size: 20px;
    }

    .risk-icon {
        font-size: 36px;
    }

    .risk-level-badge {
        font-size: 1rem;
        padding: 6px 16px;
    }

    .risk-section {
        padding: 12px;
    }

    .combo-warning {
        padding: 10px 12px;
    }

    .priority-item {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .risk-header h2 {
        font-size: 1.2rem;
    }

    .risk-score-circle {
        width: 100px;
        height: 100px;
        border-width: 6px;
    }

    .risk-score-number {
        font-size: 48px;
    }

    .risk-score-max {
        font-size: 18px;
    }

    .risk-description {
        font-size: 0.9rem;
    }

    .flags-list {
        gap: 6px;
    }

    .flag-badge {
        font-size: 0.85rem;
        padding: 5px 12px;
    }

    .combo-text {
        font-size: 0.85rem;
    }

    .priority-number {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .priority-alert-id {
        font-size: 0.9rem;
    }
}
