/* =====================================================
   TELEHEALTH VIDEO PANEL — Floating panel in Encounter Workspace
   ===================================================== */

/* Base floating panel */
.telehealth-video-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 420px;
    height: 340px;
    background: #1a1a2e;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Panel header — draggable */
.telehealth-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(135deg, #16213e, #0f3460);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.telehealth-panel-header:active {
    cursor: grabbing;
}

.telehealth-panel-title {
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
}

.telehealth-panel-title i {
    color: #4fc3f7;
}

.telehealth-panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    padding: 2px 8px;
    background: #4CAF50;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 10px;
    animation: telehealthPulse 2s ease-in-out infinite;
}

@keyframes telehealthPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.telehealth-panel-controls {
    display: flex;
    align-items: center;
}

.telehealth-panel-controls .btn-link {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.telehealth-panel-controls .btn-link:hover {
    color: #fff !important;
}

.telehealth-panel-controls .btn-link[title="End Call"]:hover {
    color: #ef5350 !important;
}

/* Panel body */
.telehealth-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

/* Patient waiting banner — shown when patient is in waiting room */
.telehealth-waiting-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(135deg, #1b5e20, #2e7d32);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    animation: telehealthSlideDown 0.3s ease-out;
}

@keyframes telehealthSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.telehealth-waiting-info {
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
}

.telehealth-waiting-info i {
    color: #81c784;
    font-size: 1.1rem;
}

.telehealth-waiting-banner .btn-success {
    padding: 3px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    background: #43a047;
    border-color: #43a047;
    white-space: nowrap;
}

.telehealth-waiting-banner .btn-success:hover {
    background: #66bb6a;
    border-color: #66bb6a;
}

/* Video container — holds Jitsi iframe */
.telehealth-video-container {
    flex: 1;
    position: relative;
    min-height: 0;
    background: #0a0a0a;
}

.telehealth-video-container iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

.telehealth-video-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
}

.telehealth-video-loading .spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Connecting overlay — shown after Admit until participant video appears */
.telehealth-connecting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 30, 0.92);
    z-index: 5;
    gap: 12px;
}

.telehealth-connecting-overlay .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    color: #4fc3f7;
}

.telehealth-connecting-overlay p {
    color: #b0bec5;
    font-size: 0.9rem;
    margin: 0;
}

/* Minimized state */
.telehealth-panel-minimized {
    height: auto !important;
    width: 280px;
}

.telehealth-panel-minimized .telehealth-panel-body {
    display: none;
}

/* Expanded state — near full screen */
.telehealth-panel-expanded {
    width: calc(100vw - 40px) !important;
    height: calc(100vh - 40px) !important;
    top: 20px !important;
    left: 20px !important;
    right: auto !important;
    bottom: auto !important;
    border-radius: 8px;
}


/* =====================================================
   TELEHEALTH PATIENT WAITING ROOM — Join page styles
   ===================================================== */

.telehealth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.telehealth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 480px;
    width: 100%;
    overflow: hidden;
}

.telehealth-header {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff;
    padding: 24px 30px;
    text-align: center;
}

.telehealth-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
}

.telehealth-body {
    padding: 30px;
}

.telehealth-info-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.telehealth-info-row:last-child {
    border-bottom: none;
}

.telehealth-info-row i {
    color: #3b82f6;
    font-size: 1.2rem;
    width: 32px;
    flex-shrink: 0;
}

.telehealth-info-row .info-label {
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.telehealth-info-row .info-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
}

/* Waiting room pulse animation */
.telehealth-waiting-pulse {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    padding: 16px;
    background: #f0f9ff;
    border-radius: 12px;
    border: 1px solid #bfdbfe;
}

.telehealth-pulse-dot {
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border-radius: 50%;
    animation: telehealthWaitingPulse 1.5s ease-in-out infinite;
}

.telehealth-pulse-dot:nth-child(2) {
    animation-delay: 0.3s;
}

.telehealth-pulse-dot:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes telehealthWaitingPulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.telehealth-waiting-text {
    color: #3b82f6;
    font-weight: 500;
    font-size: 0.95rem;
}

/* In-call state — full screen Jitsi */
.telehealth-in-call {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
}

.telehealth-in-call #jitsiPatientContainer {
    width: 100%;
    height: 100%;
}

.telehealth-in-call #jitsiPatientContainer iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* Error state */
.telehealth-error-icon {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 16px;
}

/* =====================================================
   DASHBOARD — Telehealth badges
   ===================================================== */

.badge-telehealth {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 768px) {
    .telehealth-video-panel {
        width: calc(100vw - 20px);
        height: 280px;
        bottom: 10px;
        right: 10px;
    }

    .telehealth-panel-expanded {
        width: 100vw !important;
        height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0;
    }

    .telehealth-card {
        border-radius: 12px;
        margin: 10px;
    }
}


/* =========================================================
   Telehealth AI Scribe Bar
   ========================================================= */

.telehealth-scribe-container {
    margin-bottom: 12px;
}

.telehealth-scribe-disclaimer {
    flex-basis: 100%;
    border-top: 1px solid rgba(0,0,0,0.08);
    margin-top: 4px;
    padding-top: 5px;
}

.telehealth-scribe-disclaimer small {
    font-size: 11px;
    line-height: 1.4;
    color: #6c757d;
}

.telehealth-scribe-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 100%);
    border: 1px solid #b8d8f0;
    flex-wrap: wrap;
}

.telehealth-scribe-bar.scribe-recording {
    background: linear-gradient(135deg, #e8f8e8 0%, #f0fdf0 100%);
    border-color: #6dc96d;
    animation: scribePulse 2s ease-in-out infinite;
}

.telehealth-scribe-bar.scribe-paused {
    background: linear-gradient(135deg, #fef9e7 0%, #fff8e1 100%);
    border-color: #f0c040;
}

.telehealth-scribe-bar.scribe-processing {
    background: linear-gradient(135deg, #f3e8fd 0%, #f8f0ff 100%);
    border-color: #b088d0;
}

@keyframes scribePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0); }
}

.telehealth-scribe-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #1565c0;
    font-size: 0.85rem;
    white-space: nowrap;
}

.telehealth-scribe-brand i {
    font-size: 1rem;
}

.telehealth-scribe-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.telehealth-scribe-controls .btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 20px;
}

.btn-telehealth-start {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: #fff;
    border: none;
}

.btn-telehealth-start:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    color: #fff;
}

.telehealth-scribe-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: #555;
}

.telehealth-scribe-timer {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
}

.telehealth-scribe-level {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.telehealth-scribe-level-bar {
    width: 3px;
    background: #4caf50;
    border-radius: 1px;
    transition: height 0.1s ease;
}

.telehealth-scribe-processing {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #7b1fa2;
    font-size: 0.75rem;
}

.telehealth-scribe-source-badges {
    display: flex;
    gap: 6px;
    align-items: center;
}

.telehealth-source-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.telehealth-source-badge.doctor {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.telehealth-source-badge.patient {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.telehealth-source-badge.disconnected {
    text-decoration: line-through;
    opacity: 0.5;
}

.telehealth-scribe-segments {
    font-size: 0.75rem;
    color: #777;
    white-space: nowrap;
}

/* Mobile adjustments for scribe bar */
@media (max-width: 768px) {
    .telehealth-scribe-bar {
        padding: 8px 10px;
        gap: 8px;
    }

    .telehealth-scribe-brand {
        font-size: 0.78rem;
    }
}

