﻿/* ═══════════════════════════════════════════════════════════════
   VISIO — Styles communs (médecin + patient)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Animations ─── */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Header ─── */
.visio-header {
    height: 56px;
    background: rgba(15, 31, 53, 0.95);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    z-index: 10;
}

.visio-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.visio-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--calm);
    box-shadow: 0 0 0 3px rgba(46, 125, 91, 0.25);
    animation: pulse 1.5s infinite;
}

    .visio-header-dot.disconnected {
        background: var(--urgent);
        box-shadow: 0 0 0 3px rgba(200, 49, 61, 0.25);
        animation: none;
    }

.visio-header-patient {
    font-weight: 600;
    color: #fff;
}

.visio-header-location {
    color: #8a96a3;
    font-size: 13px;
}

.visio-header-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ─── Status badges ─── */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

    .status-badge.connected {
        background: rgba(46, 125, 91, 0.2);
        color: #5fb88a;
    }

    .status-badge.connecting {
        background: rgba(180, 120, 10, 0.2);
        color: #d4a12e;
    }

    .status-badge.disconnected {
        background: rgba(200, 49, 61, 0.2);
        color: #e8838c;
    }

/* ─── Timer ─── */
.visio-timer {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: #c7d2da;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

/* ─── Zone vidéo ─── */
#remote-videos {
    position: absolute;
    inset: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    #remote-videos:empty::before {
        content: 'En attente du médecin...';
        color: #66727e;
        font-size: 16px;
        font-family: 'Inter', sans-serif;
    }

    #remote-videos .video-tile {
        position: relative;
        width: 100%;
        height: 100%;
        border-radius: 12px;
        overflow: hidden;
        background: #1a2332;
    }

        #remote-videos .video-tile video {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

/* ─── Vidéo locale (PiP) ─── */
.local-video-wrapper {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 240px;
    height: 160px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: #1a2332;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 5;
    transition: all 0.2s;
}

    .local-video-wrapper:hover {
        border-color: var(--teal);
    }

#local-video,
#local-video .video-tile {
    width: 100%;
    height: 100%;
}

    #local-video video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transform: scaleX(-1);
    }

/* ─── Badge "Vous" ─── */
.video-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    pointer-events: none;
}

/* ─── Contrôles ─── */
.visio-controls {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 20px;
    background: rgba(15, 31, 53, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    z-index: 10;
}

.visio-ctrl-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

    .visio-ctrl-btn:hover {
        background: rgba(255, 255, 255, 0.18);
        transform: translateY(-2px);
    }

    .visio-ctrl-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        transform: none;
    }

    .visio-ctrl-btn svg {
        width: 22px;
        height: 22px;
        stroke: currentColor;
        stroke-width: 2;
        fill: none;
    }

    .visio-ctrl-btn.off {
        background: var(--urgent);
    }

        .visio-ctrl-btn.off:hover {
            background: #a8232d;
        }

    .visio-ctrl-btn.active {
        background: var(--teal);
    }

    .visio-ctrl-btn.hangup {
        width: 64px;
        height: 52px;
        border-radius: 26px;
        background: var(--urgent);
    }

        .visio-ctrl-btn.hangup:hover {
            background: #a8232d;
        }

        .visio-ctrl-btn.hangup svg {
            transform: rotate(135deg);
        }

/* ─── Overlay d'erreur ─── */
.visio-error-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 40px 20px;
    background: #0a0e14;
}

.error-card {
    max-width: 480px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.error-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(200, 49, 61, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

    .error-icon-wrapper svg {
        width: 40px;
        height: 40px;
        max-width: 40px;
        max-height: 40px;
        stroke: #e8838c;
        stroke-width: 2;
        fill: none;
        display: block;
    }

.error-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.3;
    text-align: center;
}

.error-message {
    font-size: 15px;
    color: #9aa7b3;
    line-height: 1.6;
    margin: 0;
    max-width: 380px;
    text-align: center;
}

.error-retry-btn {
    padding: 12px 28px;
    font-size: 14px;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.error-hint {
    font-size: 13px;
    color: #66727e;
    margin: 0;
    font-style: italic;
    text-align: center;
    max-width: 400px;
}

/* ─── Spinner ─── */
.spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
}

/* ─── Overlay de reconnexion ─── */
.visio-reconnecting {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 20, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
}

.reconnecting-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(14, 124, 123, 0.3);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ─── Attente du patient / médecin ─── */
.visio-waiting {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #8a96a3;
    pointer-events: none;
}

.waiting-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #233551, #101d31);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 40px;
    font-weight: 700;
    color: #cfe0ec;
    margin-bottom: 8px;
}

.visio-waiting p {
    font-size: 16px;
    color: #c7d2da;
    margin: 0;
}

.visio-waiting small {
    font-size: 13px;
    color: #66727e;
}


/* ═══════════════════════════════════════════════════════════════
   PAGE PATIENT — Layout spécifique
   ═══════════════════════════════════════════════════════════════ */

.visio-patient-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    background: #0a0e14;
    color: #fff;
    overflow: hidden;
}

    /* Zone vidéo patient (centrage total) */
    .visio-patient-layout .visio-main {
        flex: 1;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        padding: 16px;
        background: #0a0e14;
    }


/* ═══════════════════════════════════════════════════════════════
   PAGE MÉDECIN — Layout spécifique (2 colonnes)
   ═══════════════════════════════════════════════════════════════ */

.visio-medecin-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    height: 100vh;
    background: #0a0e14;
    color: #fff;
    overflow: hidden;
}

/* Colonne vidéo */
.visio-video-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

    /* Zone vidéo médecin (pas de centrage par défaut) */
    .visio-video-column .visio-main {
        flex: 1;
        position: relative;
        overflow: hidden;
        background: #0a0e14;
    }


/* ═══════════════════════════════════════════════════════════════
   COLONNE NOTES (page médecin)
   ═══════════════════════════════════════════════════════════════ */

.visio-notes-column {
    display: flex;
    flex-direction: column;
    background: var(--card);
    color: var(--text);
    overflow: hidden;
}

.notes-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FAFBFC;
    flex-shrink: 0;
}

.notes-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--teal-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notes-rdv-id {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--muted);
}

.notes-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.notes-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notes-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.notes-patient-info {
    padding: 12px 14px;
    background: var(--paper);
    border-radius: 8px;
}

.patient-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.patient-location {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.notes-readonly {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.readonly-label {
    font-size: 13px;
    color: var(--muted);
}

.readonly-value {
    font-size: 13px;
}

.notes-readonly-motif {
    padding: 12px 14px;
    background: var(--paper);
    border-left: 3px solid var(--teal);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}

.notes-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
}

.notes-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    resize: vertical;
    min-height: 80px;
    background: #fff;
    color: var(--text);
}

    .notes-textarea:focus {
        outline: 2px solid var(--teal);
        outline-offset: 1px;
        border-color: var(--teal);
    }

.notes-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.notes-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--line);
    background: #FAFBFC;
    flex-shrink: 0;
}

.full-width {
    width: 100%;
    justify-content: center;
}


/* ═══════════════════════════════════════════════════════════════
   MODALE DE FIN (page médecin)
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 31, 53, 0.6);
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 480px;
    max-width: 92vw;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(15, 31, 53, 0.4);
    z-index: 1001;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
    background: #FAFBFC;
}

.modal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    margin: 0;
}

.modal-body {
    padding: 20px 24px;
}

.end-summary {
    margin-top: 16px;
    padding: 14px;
    background: var(--paper);
    border-radius: 8px;
    font-size: 13px;
}

    .end-summary ul {
        margin: 8px 0 0 0;
        padding-left: 20px;
    }

    .end-summary li {
        margin: 4px 0;
        color: var(--muted);
    }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    background: #FAFBFC;
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .visio-medecin-layout {
        grid-template-columns: 1fr 360px;
    }

    .local-video-wrapper {
        width: 180px;
        height: 120px;
    }
}

@media (max-width: 900px) {
    .visio-medecin-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    .visio-notes-column {
        max-height: 40vh;
    }
}

@media (max-width: 768px) {
    .local-video-wrapper {
        width: 120px;
        height: 80px;
        bottom: 12px;
        right: 12px;
    }

    .visio-ctrl-btn {
        width: 46px;
        height: 46px;
    }

        .visio-ctrl-btn.hangup {
            width: 56px;
            height: 46px;
        }
}