/* WS LOGGER - ELITE UI THEME V3.1 + MOBILE RESPONSIVE ULTRA */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --bg-deep: #050505;
    --bg-card: #0f0f0f;
    --accent: #FF3B30; /* Vermelho Neon */
    --accent-dim: rgba(255, 59, 48, 0.15);
    --text-main: #ffffff;
    --text-sec: #888888;
    --border: #1f1f1f;
    --success: #2ea043;
    --map-blue: #2196F3;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; outline: none; }

body { 
    background: radial-gradient(circle at top center, #1a0505, var(--bg-deep)); 
    color: var(--text-main); 
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent; /* Remove piscar azul no touch do mobile */
}

/* --- LAYOUT --- */
.container { display: flex; min-height: 100vh; position: relative; }

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1000;
}

.content {
    flex: 1;
    padding: 40px;
    min-width: 0; /* Evita que o grid estoure a largura no mobile */
}

/* --- ELEMENTOS VISUAIS --- */
.logo-area { 
    display: flex; align-items: center; gap: 15px; margin-bottom: 50px; 
    color: var(--accent);
}
.logo-area h2 { font-size: 1.2rem; letter-spacing: 2px; color: white; }

.nav-link {
    display: flex; align-items: center; gap: 15px;
    padding: 15px;
    color: var(--text-sec);
    text-decoration: none;
    border-radius: 12px;
    transition: 0.3s;
    font-size: 0.95rem;
    margin-bottom: 5px;
    min-height: 48px; /* Touch target otimizado */
}
.nav-link:hover, .nav-link.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.card {
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 100%;
}

.badge {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: monospace;
    border: 1px solid var(--accent);
    letter-spacing: 1px;
    white-space: nowrap;
}

.header-main {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px;
    gap: 15px;
}

.page-title { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.page-subtitle { color: var(--text-sec); }

.card-header-flex {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* --- COMANDOS E FILTROS --- */
.control-panel h3 { margin-bottom: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; }

.command-container {
    display: flex; 
    gap: 20px; 
    flex-wrap: wrap;
}

.device-select-area { flex: 1; min-width: 250px; }

.device-selector {
    width: 100%;
    background: #000;
    border: 1px solid #333;
    color: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.3s;
    min-height: 50px;
}
.device-selector:hover, .device-selector:focus { border-color: var(--accent); }

.action-grid {
    flex: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.btn-action {
    background: linear-gradient(145deg, #1a1a1a, #0a0a0a);
    border: 1px solid #333;
    color: var(--text-main);
    padding: 20px;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.3s;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    justify-content: center;
    min-height: 50px;
}

.btn-action i { font-size: 1.8rem; color: var(--accent); margin-bottom: 5px; transition: 0.3s; }
.btn-action:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(255, 59, 48, 0.15);
}
.btn-action:hover i { transform: scale(1.1); }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-sm { padding: 10px 20px; flex-direction: row; border-radius: 8px; font-size: 0.85rem; }
.btn-sm i { font-size: 1rem; margin-bottom: 0; }

/* --- TIMELINE (FEED DE LOGS) --- */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
    display: flex;
    gap: 20px;
    padding: 25px 0;
    border-bottom: 1px solid #1f1f1f;
    align-items: flex-start;
    transition: 0.3s;
    width: 100%;
}
.timeline-item:hover { background: rgba(255,255,255,0.02); padding-left: 10px; padding-right: 10px; border-radius: 8px;}
.timeline-item:last-child { border-bottom: none; }

.time-box {
    min-width: 70px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-sec);
    line-height: 1.4;
    flex-shrink: 0;
}

.log-icon {
    width: 45px; height: 45px;
    border-radius: 12px;
    background: #1a1a1a;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 1px solid #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.log-content { flex: 1; min-width: 0; word-wrap: break-word; }
.log-header { display: flex; justify-content: space-between; margin-bottom: 8px; align-items: center; }
.app-name { font-weight: 700; color: var(--text-main); font-size: 1rem; letter-spacing: 0.5px; }
.log-msg { color: #ccc; font-size: 0.95rem; line-height: 1.5; word-break: break-word; }

.btn-media {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 12px 20px; /* Touch target aumentado */
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    word-break: normal;
}
.btn-media:hover { background: var(--accent); color: white; }

.btn-map { border-color: var(--map-blue); color: var(--map-blue); }
.btn-map:hover { background: var(--map-blue); color: white; }

.search-wrapper { flex: 2; display: flex; align-items: center; background: #0a0a0a; border: 1px solid #333; border-radius: 8px; padding-left: 10px; width: 100%;}
.search-input { border: none !important; background: transparent !important; box-shadow: none !important; margin-bottom: 0; width: 100%;}

/* --- MODAL DE FOTO --- */
.modal-overlay-img {
    display: none;
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); 
    backdrop-filter: blur(5px);
    z-index: 10000;
    justify-content: center; 
    align-items: center; 
    flex-direction: column;
    padding: 20px;
}

.modal-content { 
    width: 100%;
    max-width: 600px; 
    max-height: 90vh; 
    border-radius: 12px; 
    border: 1px solid var(--border);
    box-shadow: 0 0 50px rgba(255, 59, 48, 0.2);
    animation: zoomIn 0.3s ease;
    background: #000;
    display: flex;
    flex-direction: column;
}

.modal-content img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px 12px 0 0;
}

.btn-modal-close, .btn-modal-download { 
    padding: 15px 30px; 
    font-size: 0.95rem; 
    flex-direction: row; 
    flex: 1; 
    text-align: center;
}
.btn-modal-close { background:#333; border:none; color: white;}
.btn-modal-download { text-decoration:none; background:var(--accent); border:none; color:white; }

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}


/* =========================================
   UX MOBILE ULTRA PREMIUM - RESPONSIVIDADE
========================================= */

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.3s;
}
.mobile-menu-btn:hover, .mobile-menu-btn:active { color: var(--accent); }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    body { padding-top: 70px; /* Espaço para o header fixo */ }

    .mobile-menu-btn { display: block; }

    /* Cabeçalho fixo no topo para app-feel */
    .header-main { 
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: rgba(15, 15, 15, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--border);
        padding: 15px 20px;
        margin-bottom: 0;
        z-index: 990;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5);
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .header-main > div:first-child { flex: 1; }
    .page-title { font-size: 1.2rem; }
    .page-subtitle { display: none; /* Esconde subtítulo para poupar espaço */ }
    .badge { font-size: 0.7rem; padding: 4px 8px; }

    /* Menu Lateral Off-Canvas */
    .sidebar {
        position: fixed;
        left: -100%; /* Fora da tela */
        top: 0;
        width: 280px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0,0,0,0.9);
    }

    .sidebar.open { left: 0; }
    .sidebar-overlay.active { display: block; opacity: 1; }

    /* Ajuste de Tela Principal */
    .content { padding: 15px; width: 100%; overflow-x: hidden; }
    .card { padding: 15px; margin-bottom: 15px; border-radius: 12px; }
    
    /* Filtros e Inputs */
    .filter-bar { flex-direction: column; gap: 12px; padding: 12px; }
    .filter-input { width: 100%; min-height: 48px; }

    /* Status do Dispositivo */
    .status-container { padding: 12px; gap: 10px; }
    .status-item { 
        flex-direction: row; /* Mantém na mesma linha se possível */
        justify-content: space-between;
        align-items: center; 
        padding-bottom: 12px;
        gap: 10px;
    }
    .status-label { font-size: 0.8rem; }
    .status-value { font-size: 0.85rem; text-align: right; }

    /* Timeline Otimizada para Mobile */
    .timeline-item { 
        flex-direction: column; /* Empilha no mobile */
        padding: 20px 0; 
        gap: 12px; 
    }
    .time-box { 
        width: 100%; 
        text-align: left; 
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed #333; 
        padding-bottom: 8px; 
        color: var(--accent); 
        font-weight: 600;
    }
    .log-header { flex-direction: column; align-items: flex-start; gap: 5px; }
    
    .timeline-item > div:nth-child(2) { display: none; } /* Esconde o ícone lateral grande para poupar espaço */
    
    .log-msg { font-size: 0.9rem; }
    
    /* Botões Mobile */
    .action-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .btn-action { padding: 15px 10px; font-size: 0.8rem; border-radius: 10px; }
    .btn-action i { font-size: 1.4rem; }
    
    .btn-media { width: 100%; justify-content: center; } /* Botões de mídia ocupam largura total */

    .pagination-bar { 
        flex-direction: column; 
        gap: 15px; 
        text-align: center; 
        padding-top: 15px;
    }
    .pagination-bar .btn-page { width: 100%; justify-content: center; min-height: 48px; }
    
    .device-select-area { min-width: 100%; }
}