/* ═══════════════════════════════════════════════════════════════════════
   Huntarr Logs — Modern Compact Layout
   ═══════════════════════════════════════════════════════════════════════ */

#logsSection,
#activitySection {
    padding-bottom: 80px !important;
}

/* No-instances warning (Media Hunt logs) */
#logsSection .logs-no-instances {
    text-align: center; padding: 64px 24px; width: 100%; box-sizing: border-box;
    margin: 20px; background: rgba(15, 23, 42, 0.4); border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
#logsSection .logs-no-instances i.fa-cube { font-size: 3rem; color: #334155; margin-bottom: 16px; display: block; }
#logsSection .logs-no-instances .no-instances-title { font-size: 1.2rem; font-weight: 600; color: #f1f5f9; margin: 0 0 8px 0; }
#logsSection .logs-no-instances .no-instances-desc { font-size: 0.95rem; color: #94a3b8; line-height: 1.6; margin: 0 auto 24px auto; max-width: 400px; }
#logsSection .logs-no-instances .no-instances-action-btn {
    display: inline-flex; align-items: center; gap: 8px; background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4); color: #818cf8; padding: 10px 20px; border-radius: 8px;
    text-decoration: none; font-weight: 500; transition: background 0.2s, border-color 0.2s;
}
#logsSection .logs-no-instances .no-instances-action-btn:hover {
    background: rgba(99, 102, 241, 0.3); border-color: rgba(99, 102, 241, 0.5);
}

/* ── Toolbar ── */
.logs-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
}

.logs-toolbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}

.logs-toolbar-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 40px;
}

/* ── Filter Chips ── */
.logs-filters {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.logs-filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0 4px 0 10px;
    height: 36px;
    transition: border-color 0.2s;
}

.logs-filter-chip:hover,
.logs-filter-chip:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
}

.logs-filter-chip i {
    color: #64748b;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chip-select {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    padding: 6px 4px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 20px;
}

.chip-select option {
    background: #1e293b;
    color: #e2e8f0;
}

.chip-select-sm {
    font-size: 0.8rem;
    padding: 2px 18px 2px 4px;
}

/* ── Search Bar ── */
.logs-search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0 10px;
    height: 36px;
    min-width: 160px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.logs-search-bar:focus-within {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.logs-search-bar i {
    color: #475569;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Override global enforcement — input is inside styled container */
.logs-search-bar input {
    background: transparent !important;
    background-image: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #e2e8f0 !important;
    font-size: 0.78rem;
    outline: none;
    width: 100%;
    height: auto;
    padding: 0;
}

.logs-search-bar input::placeholder {
    color: #475569;
}

/* ── Toolbar Buttons ── */
.logs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.8);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.logs-btn:hover {
    background: rgba(30, 41, 59, 1);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.15);
}

.logs-btn-search:hover {
    border-color: rgba(99, 102, 241, 0.5);
    color: #a5b4fc;
}

.logs-btn-danger:hover {
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

/* ── Meta Row: Connection + Pagination ── */
.logs-connection-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #64748b;
}

.logs-status-icon {
    font-size: 0.45rem;
    color: #64748b;
    transition: color 0.3s;
}

.logs-connection-dot .status-connected {
    color: #10b981;
}

/* Color the dot when connected */
.logs-connection-dot:has(.status-connected) .logs-status-icon {
    color: #10b981;
}

.logs-connection-dot .status-disconnected {
    color: #64748b;
}

.logs-connection-dot .status-error {
    color: #f87171;
}

.logs-connection-dot:has(.status-error) .logs-status-icon {
    color: #f87171;
}

.logs-pagination {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logs-page-size {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 0.8rem;
}

.logs-page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.logs-page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.7rem;
}

.logs-page-btn:hover:not(:disabled) {
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.08);
}

.logs-page-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.logs-page-info {
    color: #94a3b8;
    font-size: 0.8rem;
    padding: 0 4px;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════
   Log Table
   ═══════════════════════════════════════════════════════════════════════ */

.logs-table-wrapper {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.logs-data-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.logs-data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.logs-data-table th {
    background: rgba(15, 23, 42, 0.9);
    color: #64748b;
    text-align: left;
    padding: 10px 16px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logs-data-table td {
    padding: 10px 16px;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
    line-height: 1.4;
}

.logs-data-table tbody tr {
    transition: background 0.15s;
}

.logs-data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.logs-data-table tr:last-child td {
    border-bottom: none;
}

/* Column widths */
.col-time {
    width: 150px;
    color: #64748b !important;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.78rem !important;
    white-space: nowrap;
}

.col-level {
    width: 90px;
    white-space: nowrap;
}

.col-app {
    width: 100px;
    color: #a5b4fc !important;
    font-weight: 600;
    font-size: 0.82rem !important;
    white-space: nowrap;
}

.col-message {
    font-family: inherit;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ═══════════════════════════════════════════════════════════════════════
   Level Badges — pill style
   ═══════════════════════════════════════════════════════════════════════ */

.log-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 60px;
    line-height: 1;
}

.log-level-error {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.log-level-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.log-level-info {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.log-level-debug {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.18);
}

.log-level-fatal {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════
   Search Highlighting
   ═══════════════════════════════════════════════════════════════════════ */

.search-highlight {
    background-color: rgba(251, 191, 36, 0.25);
    color: #fbbf24;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════
   Legacy entry styles (kept for EventSource / polling inserts)
   ═══════════════════════════════════════════════════════════════════════ */

.log-entry {
    margin-bottom: 1px;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background-color 0.15s;
}

.log-entry:hover {
    background-color: rgba(99, 102, 241, 0.04);
}

.log-entry-row {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
    line-height: 1.3;
    gap: 12px;
}

.log-timestamp {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: #64748b;
    min-width: 120px;
    text-align: left;
    font-weight: 500;
    flex-shrink: 0;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
}

.log-timestamp .date {
    font-size: 10px;
    color: #475569;
    margin-bottom: 1px;
}

.log-timestamp .time {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

.log-source {
    font-weight: 600;
    color: #a5b4fc;
    min-width: 70px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.log-message {
    flex: 1;
    color: #cbd5e1;
    word-wrap: break-word;
    line-height: 1.4;
    padding-right: 8px;
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Timer state (shared with other modules)
   ═══════════════════════════════════════════════════════════════════════ */

.timer-value.refreshing-state {
    color: #00c2ce !important;
}

.timer-value.running-state {
    color: #00ff88 !important;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════
   Responsive — Mobile
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Toolbar handles by Universal Mobile Header Truth in components.css */
    
    .logs-filters {
        width: 100%;
        gap: 6px;
    }

    .logs-filter-chip {
        flex: 1;
        min-width: 0;
    }

    .logs-search-bar {
        min-width: unset;
        flex: 1;
    }

    .logs-toolbar-meta {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }

    .logs-pagination {
        gap: 10px;
    }

    /* Card layout for log rows */
    .logs-data-table,
    .logs-data-table thead,
    .logs-data-table tbody,
    .logs-data-table th,
    .logs-data-table td,
    .logs-data-table tr {
        display: block;
    }

    .logs-data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .logs-data-table tbody tr {
        background: rgba(15, 23, 42, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 12px;
    }

    .logs-data-table td {
        border: none;
        padding: 4px 0;
        position: relative;
        padding-left: 30%;
        text-align: right;
        font-size: 0.82rem;
    }

    .logs-data-table td:before {
        position: absolute;
        top: 4px;
        left: 0;
        width: 28%;
        text-align: left;
        font-weight: 600;
        color: #64748b;
        text-transform: uppercase;
        font-size: 0.68rem;
        letter-spacing: 0.03em;
    }

    .logs-data-table td:nth-of-type(1):before { content: "Time"; }
    .logs-data-table td:nth-of-type(2):before { content: "Level"; }
    .logs-data-table td:nth-of-type(3):before { content: "App"; }

    .logs-data-table td:nth-of-type(4) {
        padding-left: 0;
        text-align: left;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        margin-top: 6px;
        padding-top: 10px;
    }

    .logs-data-table td:nth-of-type(4):before { content: none; }

    /* Legacy entry rows */
    .log-entry-row {
        gap: 8px;
        padding: 5px 6px;
        font-size: 11px;
    }

    .log-timestamp { min-width: 100px; font-size: 10px; }
    .log-timestamp .date { font-size: 9px; }
    .log-timestamp .time { font-size: 10px; }
    .log-level-badge { min-width: 55px; font-size: 0.6rem; padding: 2px 6px; }
    .log-source { min-width: 55px; font-size: 10px; }
    .log-message { font-size: 11px; }
}

@media (max-width: 480px) {
    .logs-filters {
        flex-direction: column;
    }

    .log-entry-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
        padding: 6px;
    }

    .log-timestamp,
    .log-source { min-width: auto; }

    .log-level-badge { min-width: auto; align-self: flex-start; }

    .log-message {
        width: 100%;
        margin-top: 2px;
        padding-right: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Legacy classes kept for backward compat (referenced nowhere in JS but
   present in logs-history.css overlap — no-op stubs)
   ═══════════════════════════════════════════════════════════════════════ */

.btn-danger-outline {
    /* legacy — replaced by .logs-btn-danger */
    display: none;
}
