/* ── AI Suggested Fields ── */
.ai-suggested-field {
    background-color: rgba(78, 96, 162, 0.05) !important;
    border-radius: 10px; /* Adjusted to 10px to match input field radius */
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(78, 96, 162, 0.04);
}

/* Target MudBlazor's inner outlined border to fix double border bug */
.ai-suggested-field .mud-input-outlined-border {
    border: 1.5px dashed #849CC6 !important; /* aiAccent */
}

/* Target label color when not focused */
.ai-suggested-field .mud-input-label {
    color: #4E60A2 !important; /* primary */
}

/* Hover effect for AI fields */
.ai-suggested-field:hover .mud-input-outlined-border {
    border-color: #4E60A2 !important; /* primary */
}

/* Focus states */
.ai-suggested-field:focus-within {
    background-color: #ffffff !important;
}
.ai-suggested-field:focus-within .mud-input-outlined-border {
    border-style: solid !important;
    border-color: #1E285A !important; /* logoMid */
    border-width: 2px !important;
}

.ai-suggestion-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent !important;
    border: none !important;
    color: var(--mud-palette-primary, #1E285A) !important;
    padding: 2px 0;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: none !important;
}

.ai-row-highlight {
    background-color: rgba(132, 156, 198, 0.08) !important;
}

/* Apply the starting accent border only to the first cell of the row (fixes vertical borders in RTL) */
tr:has(> .ai-row-highlight) td:first-child {
    border-right: 4px solid #849CC6 !important; /* aiAccent */
}

/* ── Sidebar ── */
.wl-sidebar-wrap {
    height: calc(100vh - 88px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wl-sidebar-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--mud-palette-divider);
    flex-shrink: 0;
}

.wl-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* ── Patient card in sidebar ── */
.wl-pt-card {
    border-right: 4px solid transparent;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 5px;
}

.wl-pt-card:hover {
    background: var(--mud-palette-action-default-hover);
    transform: translateX(-2px);
}

.wl-pt-card.is-sel {
    border-right-color: var(--mud-palette-primary) !important;
    background: var(--mud-palette-action-default-hover);
}

.wl-queue-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .76rem;
    flex-shrink: 0;
    color: #fff;
}

/* ── Patient header (always visible) ── */
.ph-card {
    border-bottom: 3px solid var(--mud-palette-primary);
    transition: all 0.3s ease;
}

.ph-vitals-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ph-vitals-container::-webkit-scrollbar {
    display: none;
}

.ph-vital {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    padding: 6px 8px;
    text-align: center;
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    height: 76px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden;
    flex-shrink: 0 !important;
    background: var(--mud-palette-background-grey, rgba(0, 0, 0, 0.02));
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.ph-vital:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.05);
    transform: translateY(-2px);
}

.ph-vital .vl {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    display: block;
    margin-bottom: 2px;
    line-height: 1.1;
    white-space: nowrap;
}

.ph-vital .vv {
    font-size: 1.05rem;
    font-weight: 800;
    display: block;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--mud-palette-text-primary);
}

.ph-vital .vu {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    display: block;
    margin-top: 2px;
    line-height: 1.1;
    white-space: nowrap;
}

/* ── Patient header actions ── */
.ph-actions-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 8px;
}

.ph-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.ph-action-btn {
    font-weight: 700 !important;
    border-radius: 8px !important;
    font-size: 0.78rem !important;
    padding: 6px 10px !important;
    height: 36px !important;
    min-height: 36px !important;
    letter-spacing: normal !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ph-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
}

.ph-action-btn .mud-button-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    white-space: nowrap;
}

.ph-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
    transition: all 0.2s ease;
}

.ph-count-badge.has-count {
    background: #ff9800 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 4px rgba(255, 152, 0, 0.4);
}

@media (max-width: 768px) {
    .ph-actions-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .ph-action-btn {
        height: 34px !important;
        min-height: 34px !important;
        font-size: 0.75rem !important;
        padding: 4px 6px !important;
    }
}

/* ── Active visit animation ── */
.active-visit-card {
    border-right: 5px solid var(--mud-palette-success);
    background: rgba(76,175,80,.08);
    animation: pg 2s infinite;
}

@keyframes pg {
    0%, 100% {
        box-shadow: 0 0 0 rgba(76,175,80,.15);
    }

    50% {
        box-shadow: 0 0 18px rgba(76,175,80,.30);
    }
}

/* ── History cards ── */
.history-card {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.08) !important;
}

/* ── Misc ── */
.exam-section-title {
    font-weight: 700;
    font-size: .95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.info-row-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 6px 8px;
}

.info-row-wrap .info-item {
    font-size: .86rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(var(--mud-palette-primary-rgb), 0.08);
}

.info-row-wrap .info-item b {
    font-weight: 700;
}

@media (max-width: 600px) {
    .info-row-wrap {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 4px;
    }
    .info-row-wrap .info-item {
        font-size: 0.8rem;
        width: 100%;
        justify-content: space-between;
    }
}

/* ── Custom History Tabs ── */
.history-tabs .mud-tabs-toolbar {
    border-radius: 8px;
    padding: 4px;
}

.history-tabs .mud-tab {
    border-radius: 6px;
    margin: 0 4px;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7) !important;
}

.history-tabs .mud-tab .mud-icon-root {
    color: rgba(255, 255, 255, 0.7) !important;
}

.history-tabs .mud-tab-active {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    font-weight: bold;
    box-shadow: none;
}

.history-tabs .mud-tab-active .mud-icon-root {
    color: white !important;
}

/* ── Exam Top Navigation Bar (Fluid Responsive Single Row) ── */
.exam-nav-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap !important;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 4px 10px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.exam-nav-toolbar::-webkit-scrollbar {
    height: 5px;
}

.exam-nav-toolbar::-webkit-scrollbar-thumb {
    background: rgba(25, 118, 210, 0.35);
    border-radius: 4px;
}

.exam-nav-toolbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
}

.exam-nav-btn {
    height: 48px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    min-width: 145px !important;
    padding: 0 16px !important;
    font-size: 0.88rem !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.25) !important;
    transition: all 0.2s ease-in-out !important;
}

.exam-nav-btn.is-history-active {
    font-weight: 800 !important;
    background-color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* ── Blue Nav Steps Container & White Active Tab Style ── */
.nav-steps-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--mud-palette-primary);
    padding: 5px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(25, 118, 210, 0.25);
    flex-shrink: 0;
    white-space: nowrap;
}

.step-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    border: none;
    outline: none;
    background-color: transparent;
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    flex-shrink: 0;
}

.step-nav-btn .mud-icon-root {
    color: #ffffff;
    transition: color 0.2s ease-in-out;
}

.step-nav-btn:hover:not(.is-active) {
    background-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.step-nav-btn.is-active {
    background-color: #ffffff !important;
    color: var(--mud-palette-primary) !important;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.step-nav-btn.is-active .mud-icon-root {
    color: var(--mud-palette-primary) !important;
}

/* ── Responsive Scaling for Medium/Small Screens ── */
@media (max-width: 1250px) {
    .exam-nav-toolbar {
        gap: 6px;
    }
    .exam-nav-btn {
        height: 42px !important;
        min-width: 115px !important;
        font-size: 0.8rem !important;
        padding: 0 10px !important;
    }
    .nav-steps-container {
        padding: 4px;
        gap: 3px;
    }
    .step-nav-btn {
        height: 34px;
        padding: 0 9px;
        font-size: 0.78rem;
    }
}

@media (max-width: 960px) {
    .exam-nav-toolbar {
        justify-content: flex-start !important; /* Prevents RTL start clipping */
        gap: 6px;
        padding-bottom: 8px;
    }
    .exam-nav-btn {
        height: 38px !important;
        min-width: 100px !important;
        font-size: 0.76rem !important;
        padding: 0 8px !important;
    }
    .step-nav-btn {
        height: 32px;
        padding: 0 7px;
        font-size: 0.75rem;
    }
    .step-nav-btn .mud-icon-root {
        font-size: 1rem !important;
    }
}

@media (max-width: 600px) {
    .exam-nav-btn {
        height: 36px !important;
        min-width: 90px !important;
        font-size: 0.72rem !important;
        padding: 0 6px !important;
    }
    .step-nav-btn {
        height: 30px;
        padding: 0 6px;
        font-size: 0.72rem;
    }
}

/* ── Full Screen Cards ── */
.waiting-card {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease;
    height: 100%;
    border-radius: 12px;
    border-top: 4px solid var(--mud-palette-primary);
}

.waiting-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08) !important;
    border-top-color: var(--mud-palette-secondary) !important;
}

.patient-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px 16px;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .patient-details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px 10px;
    }
}

@media (max-width: 400px) {
    .patient-details-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.detail-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-label {
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
}

.detail-value {
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Step Actions Navigation Footer ── */
.step-actions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--mud-palette-divider);
}

@media (max-width: 600px) {
    .step-actions-footer {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .step-actions-footer .mud-button-root {
        width: 100%;
    }
}

/* ── Full Width Live Audio Spectrum Visualizer Container (Supports Light & Dark Theme) ── */
.full-width-eq-container {
    width: 100%;
    background-color: var(--mud-palette-background-grey, rgba(0, 0, 0, 0.03));
    border: 1px solid var(--mud-palette-lines-default, rgba(0, 0, 0, 0.12));
    border-radius: 12px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

/* ── Live Sound Equalizer Visualizer ── */
.audio-equalizer-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.92);
    max-width: 0;
    overflow: hidden;
    pointer-events: none;
}

.audio-equalizer-wrapper.is-active {
    opacity: 1;
    transform: scale(1);
    max-width: 320px;
    pointer-events: auto;
}

.eq-pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ef4444;
    box-shadow: 0 0 10px #ef4444;
    animation: eq-pulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes eq-pulse {
    0%, 100% {
        transform: scale(0.85);
        opacity: 0.7;
        box-shadow: 0 0 4px #ef4444;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
        box-shadow: 0 0 12px #ef4444;
    }
}

.eq-bars {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.eq-bar {
    width: 3.5px;
    height: 6px;
    border-radius: 4px;
    background: linear-gradient(180deg, #ef4444 0%, #a855f7 100%);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    transition: height 0.3s ease, background 0.3s ease;
}

.audio-equalizer-wrapper.is-active .eq-bar {
    animation: eq-wave 1.1s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1)  { animation-duration: 0.7s;  animation-delay: 0.05s; }
.eq-bar:nth-child(2)  { animation-duration: 1.0s;  animation-delay: 0.25s; }
.eq-bar:nth-child(3)  { animation-duration: 0.6s;  animation-delay: 0.12s; }
.eq-bar:nth-child(4)  { animation-duration: 1.2s;  animation-delay: 0.40s; }
.eq-bar:nth-child(5)  { animation-duration: 0.8s;  animation-delay: 0.18s; }
.eq-bar:nth-child(6)  { animation-duration: 0.95s; animation-delay: 0.32s; }
.eq-bar:nth-child(7)  { animation-duration: 1.15s; animation-delay: 0.08s; }
.eq-bar:nth-child(8)  { animation-duration: 0.65s; animation-delay: 0.22s; }
.eq-bar:nth-child(9)  { animation-duration: 1.05s; animation-delay: 0.35s; }
.eq-bar:nth-child(10) { animation-duration: 0.75s; animation-delay: 0.15s; }
.eq-bar:nth-child(11) { animation-duration: 0.9s;  animation-delay: 0.28s; }
.eq-bar:nth-child(12) { animation-duration: 1.1s;  animation-delay: 0.04s; }

@keyframes eq-wave {
    0% {
        height: 4px;
        opacity: 0.4;
        transform: scaleY(1);
    }
    50% {
        height: 22px;
        opacity: 1;
        transform: scaleY(1.1);
    }
    100% {
        height: 7px;
        opacity: 0.7;
        transform: scaleY(0.9);
    }
}

.eq-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: #dc2626;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

@keyframes mic-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* ── Clinical Questions Left Drawer ── */
.clinical-questions-drawer {
    z-index: 1250 !important;
    border-right: 1px solid var(--mud-palette-lines-default, #e2e8f0) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15) !important;
}

/* Ensure no dimming overlay / scrim darkens the screen when questions drawer is open */
.clinical-questions-drawer ~ .mud-drawer-overlay,
.clinical-questions-drawer ~ .mud-overlay {
    background-color: transparent !important;
    backdrop-filter: none !important;
    pointer-events: none !important;
}

.clinical-questions-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cq-question-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(2, 136, 209, 0.2) !important;
}

.cq-question-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 136, 209, 0.12) !important;
}

.medical-examinations-embedded {
    animation: fadeInTab 0.2s ease-in-out;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



