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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    font-size: 18px;
    line-height: 1.4;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

/* ==========================================
   HEADER PRINCIPAL
   ========================================== */

#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid #2196f3;
}

#main-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
}

#status {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 20px;
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: #4caf50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.6);
    animation: pulse-online 2s ease-in-out infinite;
}

.status-dot.offline {
    background: #757575;
}

/* Animação do status online */
@keyframes pulse-online {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.6; 
        transform: scale(1.1);
    }
}

/* ==========================================
   GRID DE DOENTES
   ========================================== */

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    flex: 1;
}

@media (max-width: 2400px) {
    .grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1200px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Coluna de doente */
.col {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid #2a2a2a;
    transition: transform 0.2s ease;
}

.col:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* ==========================================
   HEADER DA COLUNA
   ========================================== */

.hdr {
    padding: 16px;
    color: #ffffff;
    position: relative;
}

.hdr.GREEN { 
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%); 
}

.hdr.YELLOW { 
    background: linear-gradient(135deg, #ffbf00 0%, #f9a825 100%); 
    color: #000; 
}

.hdr.ORANGE { 
    background: linear-gradient(135deg, #ff7f00 0%, #f57c00 100%); 
}

.hdr.RED { 
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%); 
    animation: header-alert 3s ease-in-out infinite;
}

/* Animação do header RED */
@keyframes header-alert {
    0%, 100% { 
        box-shadow: 0 0 0 rgba(229, 57, 53, 0.4);
    }
    50% { 
        box-shadow: 0 0 20px rgba(229, 57, 53, 0.8);
    }
}

.hdr-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.hdr-left {
    flex: 1;
}

.bed {
    font-size: 16px;
    font-weight: 700;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

.name {
    font-size: 22px;
    font-weight: 600;
    margin: 4px 0;
}

.demo {
    font-size: 16px;
    opacity: 0.85;
}

.hdr-right {
    text-align: right;
}

.score-label {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 500;
}

.score {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-top: 4px;
}

.hdr-bottom {
    font-size: 15px;
    opacity: 0.9;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Badge de deterioração */
.deterioration-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #d32f2f;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   LINHAS DE DADOS
   ========================================== */

.rows {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.row {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    position: relative;
}

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

.row-label {
    font-size: 14px;
    color: #9e9e9e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 600;
}

.row-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.row-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    flex-wrap: wrap;
}

.k {
    color: #b0b0b0;
    font-size: 15px;
}

.v {
    color: #ffffff;
    font-weight: 600;
}

.v.large {
    font-size: 20px;
}

/* ==========================================
   BADGES DE ALERTA - COM ANIMAÇÕES
   ========================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    margin-left: 6px;
}

.badge.red {
    background: #e53935;
    color: #ffffff;
}

.badge.amber {
    background: #ff7f00;
    color: #ffffff;
}

/* Animação BLINK para badges vermelhos CRÍTICOS */
.badge.blink {
    animation: blink-alert 1.5s ease-in-out infinite;
}

@keyframes blink-alert {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 rgba(229, 57, 53, 0);
    }
    50% { 
        opacity: 0.3;
        transform: scale(1.05);
        box-shadow: 0 0 10px rgba(229, 57, 53, 0.6);
    }
}

/* Animação PULSE para badges âmbar e avisos */
.badge.pulse {
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.03);
    }
}

/* ==========================================
   SPARKLINES
   ========================================== */

.spark {
    height: 24px;
    width: 100%;
    margin-top: 4px;
}

.spark polyline {
    fill: none;
    stroke: #2196f3;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: draw-sparkline 1s ease-out;
}

/* Animação de desenho da sparkline */
@keyframes draw-sparkline {
    from {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dasharray: 1000;
        stroke-dashoffset: 0;
    }
}

/* ==========================================
   EVENTOS
   ========================================== */

.events {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.event-pill {
    background: #2a2a2a;
    border-left: 3px solid #2196f3;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #e0e0e0;
    animation: slide-in 0.3s ease-out;
}

/* Animação de entrada dos eventos */
@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.event-time {
    color: #9e9e9e;
    margin-right: 6px;
    font-weight: 600;
}

/* ==========================================
   SETAS DE TENDÊNCIA
   ========================================== */

.trend-arrow {
    font-size: 16px;
    margin-left: 4px;
    display: inline-block;
}

.trend-arrow.up { 
    color: #e53935;
    animation: bounce-up 1s ease-in-out infinite;
}

.trend-arrow.down { 
    color: #4caf50;
    animation: bounce-down 1s ease-in-out infinite;
}

.trend-arrow.stable { 
    color: #9e9e9e;
}

/* Animações das setas */
@keyframes bounce-up {
    0%, 100% { 
        transform: translateY(0);
    }
    50% { 
        transform: translateY(-3px);
    }
}

@keyframes bounce-down {
    0%, 100% { 
        transform: translateY(0);
    }
    50% { 
        transform: translateY(3px);
    }
}

/* ==========================================
   SEPARADORES
   ========================================== */

.separator {
    color: #616161;
    margin: 0 6px;
}

.icon {
    margin-right: 4px;
    font-style: normal;
}

/* ==========================================
   ANIMAÇÕES DE FADE IN (entrada suave)
   ========================================== */

.col {
    animation: fade-in 0.4s ease-out;
}

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

/* ==========================================
   LOADING STATE (opcional)
   ========================================== */

.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   RESPONSIVIDADE
   ========================================== */

@media (max-width: 1200px) {
    body {
        font-size: 16px;
    }
    
    #main-header h1 {
        font-size: 24px;
    }
    
    .name {
        font-size: 18px;
    }
    
    .score {
        font-size: 28px;
    }
}

/* ==========================================
   PRINT STYLES (se necessário)
   ========================================== */

@media print {
    body {
        background: white;
        color: black;
    }
    
    .badge.blink,
    .badge.pulse {
        animation: none;
    }
}