/* =====================================================
 * MONITOR DA VIDA - POP-UP HOSPITALAR
 * ===================================================== */

/* Overlay de fundo */
.monitor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

/* Container principal do monitor */
.monitor-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    background: #000;
    border: 3px solid #00FF41;
    border-radius: 15px;
    color: #00FF41;
    font-family: 'Courier New', monospace;
    z-index: 10001;
    opacity: 0;
    overflow: hidden;
    box-shadow: 
        0 0 50px rgba(0, 255, 65, 0.5),
        inset 0 0 20px rgba(0, 255, 65, 0.1);
}

.monitor-popup.monitor-show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: monitorAppear 0.8s ease-out forwards;
}

.monitor-popup.monitor-hide {
    animation: monitorDisappear 0.5s ease-in forwards;
}

/* Animações do monitor */
@keyframes monitorAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes monitorDisappear {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
}

/* Header do monitor */
.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(90deg, #001a00, #003300);
    border-bottom: 2px solid #00FF41;
}

.monitor-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 10px #00FF41;
}

.monitor-icon {
    font-size: 20px;
    animation: pulse 2s ease-in-out infinite;
}

.monitor-code {
    background: #00FF41;
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}

.monitor-close {
    background: none;
    border: 2px solid #00FF41;
    color: #00FF41;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.monitor-close:hover {
    background: #00FF41;
    color: #000;
    box-shadow: 0 0 15px #00FF41;
}

/* Tela do monitor */
.monitor-screen {
    height: calc(100% - 80px);
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    background: 
        radial-gradient(circle at 20% 20%, rgba(0, 255, 65, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 255, 65, 0.05) 0%, transparent 50%);
}

/* Linha de batimento cardíaco */
.heartbeat-line {
    width: 100%;
    height: 60px;
    margin-bottom: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 60'%3E%3Cpath d='M0 30 L40 30 L45 10 L50 50 L55 30 L200 30' stroke='%2300FF41' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 200px 60px;
    animation: heartbeat-scroll 2s linear infinite;
    opacity: 0.8;
}

@keyframes heartbeat-scroll {
    0% { background-position-x: 0; }
    100% { background-position-x: 200px; }
}

/* Seções do monitor */
.monitor-section {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 8px;
    background: rgba(0, 255, 65, 0.02);
}

.section-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 255, 65, 0.3);
    text-shadow: 0 0 5px #00FF41;
}

/* Informações do paciente */
.patient-info {
    display: grid;
    gap: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.info-label {
    font-weight: bold;
    min-width: 100px;
    opacity: 0.8;
}

.info-value {
    flex: 1;
    text-align: right;
    font-size: 16px;
}

/* Sinais vitais */
.vital-signs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.vital-item {
    text-align: center;
    padding: 15px;
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 8px;
    background: rgba(0, 255, 65, 0.05);
}

.vital-label {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 8px;
}

.vital-value {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
}

/* Informações do equipamento */
.equipment-info {
    display: grid;
    gap: 8px;
}

.equipment-item {
    padding: 8px 0;
    border-bottom: 1px dotted rgba(0, 255, 65, 0.2);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.equipment-item:last-child {
    border-bottom: none;
}

/* Relatório médico */
.medical-report {
    background: rgba(0, 255, 65, 0.05);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #00FF41;
    max-height: 200px;
    overflow-y: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.report-text {
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: pre-wrap;
}

/* Galeria de mídias */
.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.media-item {
    position: relative;
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 255, 65, 0.05);
}

.media-item:hover {
    border-color: #00FF41;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
    transform: scale(1.02);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.media-caption {
    padding: 10px;
    font-size: 12px;
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 255, 65, 0.8);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

/* Informações financeiras */
.financial-info {
    text-align: center;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0, 255, 65, 0.1);
    border-radius: 8px;
}

.cost-label {
    font-weight: bold;
    opacity: 0.8;
}

.cost-value {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 10px #00FF41;
}

/* Rodapé do monitor */
.monitor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 255, 65, 0.3);
    font-size: 12px;
    opacity: 0.7;
}

/* Mídia em tela cheia */
.media-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.media-fullscreen-content {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.media-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.media-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Efeitos de animação */
.typing-text {
    border-right: 2px solid #00FF41;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 50% { border-color: #00FF41; }
    51%, 100% { border-color: transparent; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrollbar customizada */
.monitor-screen::-webkit-scrollbar {
    width: 8px;
}

.monitor-screen::-webkit-scrollbar-track {
    background: rgba(0, 255, 65, 0.1);
    border-radius: 4px;
}

.monitor-screen::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 65, 0.5);
    border-radius: 4px;
}

.monitor-screen::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 65, 0.8);
}

/* Responsividade */
@media (max-width: 768px) {
    .monitor-popup {
        width: 95vw;
        height: 90vh;
        max-height: 90vh;
    }
    
    .monitor-header {
        padding: 10px 15px;
    }
    
    .monitor-title {
        font-size: 14px;
        gap: 8px;
    }
    
    .monitor-screen {
        padding: 15px;
        height: calc(100% - 70px);
    }
    
    .vital-signs {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .media-gallery {
        grid-template-columns: 1fr;
    }
    
    .cost-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .monitor-footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .equipment-info {
        font-size: 14px;
    }
    
    .medical-report {
        font-size: 14px;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .monitor-popup {
        width: 98vw;
        height: 95vh;
        border-radius: 10px;
    }
    
    .monitor-header {
        padding: 8px 12px;
    }
    
    .monitor-title {
        font-size: 12px;
        gap: 6px;
    }
    
    .monitor-code {
        font-size: 12px;
        padding: 2px 6px;
    }
    
    .monitor-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .monitor-screen {
        padding: 12px;
        height: calc(100% - 60px);
    }
    
    .section-title {
        font-size: 12px;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .info-label {
        min-width: auto;
        font-size: 12px;
    }
    
    .info-value {
        text-align: left;
        font-size: 14px;
    }
}


/* Media query adicional para tablets grandes */
@media (max-width: 1024px) and (min-width: 769px) {
    .monitor-popup {
        width: 92vw;
        height: 88vh;
    }
    
    .monitor-screen {
        padding: 18px;
    }
    
    .vital-signs {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Media query para dispositivos muito pequenos */
@media (max-width: 320px) {
    .monitor-popup {
        width: 99vw;
        height: 98vh;
        border-radius: 5px;
        border-width: 2px;
    }
    
    .monitor-header {
        padding: 6px 10px;
    }
    
    .monitor-title {
        font-size: 11px;
        gap: 4px;
    }
    
    .monitor-code {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .monitor-close {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }
    
    .monitor-screen {
        padding: 10px;
        height: calc(100% - 50px);
    }
    
    .section-title {
        font-size: 11px;
    }
    
    .info-label, .info-value {
        font-size: 11px;
    }
    
    .vital-value {
        font-size: 16px;
    }
}
