/* Logs page styles */

.logs-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.logs-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.header-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Log Stats */
.log-stats {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.stat-item:hover {
    background: var(--surface-hover);
}

.stat-item.active {
    background: var(--primary-light);
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stat-dot.debug {
    background: var(--text-secondary);
}
.stat-dot.info {
    background: var(--primary);
}
.stat-dot.warn {
    background: var(--warning);
}
.stat-dot.error {
    background: var(--error);
}
.stat-dot.fatal {
    background: var(--error);
}

.stat-count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    font-family: "SF Mono", "Monaco", "Inconsolata", monospace;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.stat-item.total .stat-label {
    font-weight: 600;
    color: var(--text);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding: 0.375rem 0.75rem;
    background: var(--bg);
    border-radius: 20px;
    font-size: 0.75rem;
}

.connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
    background: var(--success);
    animation: none;
}

.connection-status.disconnected .status-dot {
    background: var(--error);
    animation: none;
}

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

/* Log Stream */
.log-stream-container {
    flex: 1;
    display: flex;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.log-stream {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.log-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--text-secondary);
}

.log-placeholder svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-hint {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Log Entry */
.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.log-entry:hover {
    background: var(--bg);
}

.log-entry.hidden {
    display: none;
}

.log-timestamp {
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-level {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 50px;
    text-align: center;
}

.log-entry[data-level="debug"] .log-level {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
}

.log-entry[data-level="info"] .log-level {
    background: var(--primary-light);
    color: var(--primary);
}

.log-entry[data-level="warn"] .log-level {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.log-entry[data-level="error"] .log-level {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.log-entry[data-level="fatal"] .log-level {
    background: rgba(220, 38, 38, 0.2);
    color: var(--error);
}

.log-service {
    color: var(--primary);
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-message {
    color: var(--text);
    flex: 1;
    word-break: break-word;
}

.log-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    border-radius: 4px;
    flex-shrink: 0;
}

.log-entry:hover .log-expand {
    opacity: 1;
}

.log-expand:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

/* Scroll Controls */
.scroll-controls {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scroll-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.scroll-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--primary);
}

.scroll-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Log Detail Panel */
.log-detail-panel {
    position: absolute;
    bottom: -300px;
    left: 0;
    right: 0;
    height: 300px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    transition: bottom 0.3s ease;
    display: flex;
    flex-direction: column;
}

.log-detail-panel.open {
    bottom: 0;
}

.log-detail-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.log-detail-panel .panel-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.log-detail-panel .panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.375rem;
}

.detail-value {
    font-family: "SF Mono", "Monaco", "Inconsolata", monospace;
    font-size: 0.8125rem;
    color: var(--text);
    background: var(--bg);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Logs View (legacy) */
.logs-content {
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.log-line {
    display: flex;
    gap: 1rem;
}

.log-level.info {
    color: var(--primary);
}

.log-level.warn {
    color: var(--warning);
}

.log-level.error {
    color: var(--error);
}

.log-level.debug {
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .logs-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .log-stats {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .stat-separator {
        display: none;
    }

    .connection-status {
        width: 100%;
        justify-content: center;
    }

    .log-entry {
        flex-wrap: wrap;
    }

    .log-timestamp {
        order: 1;
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .log-level {
        order: 2;
    }

    .log-service {
        order: 3;
    }

    .log-message {
        order: 5;
        width: 100%;
        margin-top: 0.25rem;
    }

    .log-expand {
        order: 4;
        opacity: 1;
    }
}
