/* LogWeb Styles - Terminal/DevOps Theme */

:root {
    --bg-primary: #0D1117;
    --bg-secondary: #161B22;
    --bg-tertiary: #21262D;
    --accent-primary: #58A6FF;
    --accent-secondary: #8B949E;
    --text-primary: #E6EDF3;
    --text-secondary: #8B949E;
    --success: #3FB950;
    --warning: #D29922;
    --error: #F85149;
    --border: #30363D;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* App Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
}

.logo-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.breadcrumb {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb-item {
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
    transition: background 150ms ease;
}

.breadcrumb-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

.breadcrumb-sep {
    margin: 0 4px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 150ms ease;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-secondary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Main Content */
.main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 0 1px 3px var(--shadow);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-count {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.file-list::-webkit-scrollbar {
    width: 8px;
}

.file-list::-webkit-scrollbar-track {
    background: transparent;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.file-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* File Item */
.file-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 150ms ease;
    border-left: 3px solid transparent;
    margin-bottom: 4px;
}

.file-item:hover {
    background: var(--bg-tertiary);
}

.file-item.active {
    background: rgba(88, 166, 255, 0.1);
    border-left-color: var(--accent-primary);
}

.file-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-icon {
    width: 16px;
    height: 16px;
    color: var(--accent-secondary);
    flex-shrink: 0;
}

.file-item.active .file-icon {
    color: var(--accent-primary);
}

.folder-icon {
    color: var(--warning);
}

.folder-item .file-name {
    color: var(--text-primary);
}

.folder-item:hover .folder-icon {
    color: var(--warning);
}

.chevron-icon {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
    margin-left: auto;
    flex-shrink: 0;
}

.file-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    padding-left: 24px;
    font-size: 11px;
    color: var(--text-secondary);
}

.file-size, .file-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Loading & Empty States */
.loading, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--text-secondary);
    text-align: center;
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Mobile Sidebar Toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 68px;
    left: 12px;
    z-index: 100;
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* Viewer */
.viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.viewer-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 16px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.viewer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Viewer Toolbar */
.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 400px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 12px;
}

.search-box:focus-within {
    border-color: var(--accent-primary);
}

.search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    padding: 10px 0;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-count {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 6px;
    background: var(--bg-secondary);
    border-radius: 4px;
    display: none;
}

.search-count.visible {
    display: block;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

/* Log Container */
.log-container {
    flex: 1;
    overflow: auto;
    padding: 16px 0;
}

.log-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line {
    display: flex;
    padding: 0 16px;
    transition: background 100ms ease;
}

.log-line:hover {
    background: rgba(88, 166, 255, 0.05);
}

.log-line.search-highlight {
    background: rgba(210, 153, 34, 0.2);
}

.log-line.search-match {
    background: rgba(63, 185, 80, 0.2);
}

.line-number {
    width: 60px;
    text-align: right;
    padding-right: 16px;
    color: var(--text-secondary);
    user-select: none;
    flex-shrink: 0;
    opacity: 0.5;
}

.line-content {
    flex: 1;
    color: var(--text-primary);
}

/* Log Level Colors */
.log-line[data-level="ERROR"],
.log-line[data-level="FATAL"],
.log-line[data-level="CRITICAL"] {
    color: var(--error);
}

.log-line[data-level="WARN"],
.log-line[data-level="WARNING"] {
    color: var(--warning);
}

.log-line[data-level="INFO"] {
    color: var(--accent-primary);
}

.log-line[data-level="DEBUG"],
.log-line[data-level="TRACE"] {
    color: var(--text-secondary);
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 28px;
    padding: 0 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.status-indicator.warning .indicator-dot {
    background: var(--warning);
}

.status-indicator.error .indicator-dot {
    background: var(--error);
}

.status-indicator.updating .indicator-dot {
    background: var(--accent-primary);
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 48px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 4px 12px var(--shadow);
    animation: slideIn 200ms ease;
}

.toast.error {
    border-color: var(--error);
}

.toast.success {
    border-color: var(--success);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Auto-scroll indicator */
.scroll-bottom-btn {
    position: fixed;
    bottom: 44px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

.scroll-bottom-btn.visible {
    display: flex;
}

.scroll-bottom-btn:hover {
    background: #79b8ff;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 28px;
        z-index: 90;
        transform: translateX(-100%);
        transition: transform 200ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .header-left {
        gap: 12px;
    }

    .breadcrumb {
        display: none;
    }

    .viewer-toolbar {
        flex-wrap: wrap;
    }

    .search-box {
        max-width: none;
        order: 1;
        width: 100%;
    }

    .toolbar-actions {
        order: 0;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
