.log-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 50px);
  background: var(--color-background-primary);
  overflow: hidden;
}

.log-view.fullscreen {
  position: fixed;
  top: 30px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  height: calc(100vh - 30px);
}

.log-toolbar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
  gap: 20px;
  flex-shrink: 0;
  min-height: 56px;
}

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

.toolbar-section.left {
  flex-shrink: 0;
}

.toolbar-section.center {
  flex: 1;
  justify-content: center;
}

.toolbar-section.right {
  flex-shrink: 0;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--color-background-secondary);
  color: var(--color-text-primary);
}

.toolbar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toolbar-btn.active {
  background: var(--color-accent);
  color: white;
}

.toolbar-btn.danger:hover:not(:disabled) {
  background: var(--color-danger);
  color: white;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 4px;
}

.search-container {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-background-secondary);
  font-size: 13px;
  color: var(--color-text-primary);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-background-primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

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

.log-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  font-family: 'SF Mono', monospace;
}

.stat {
  padding: 4px 8px;
  background: var(--color-background-secondary);
  border-radius: var(--radius-sm);
}

.stat.selected {
  background: var(--color-accent);
  color: white;
}

.filters-panel,
.settings-panel {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--color-background-secondary);
  border-bottom: 1px solid var(--color-border);
  gap: 20px;
  flex-wrap: wrap;
}

.filter-group,
.setting-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.filter-group label,
.setting-group label {
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.filter-select,
.number-input {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  font-size: 12px;
}

.range-input {
  width: 100px;
}

.setting-value {
  font-family: 'SF Mono', monospace;
  font-size: 11px;
  color: var(--color-text-tertiary);
  min-width: 30px;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.filter-btn {
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  font-size: 12px;
  cursor: pointer;
}

.filter-btn:hover:not(:disabled) {
  background: var(--color-background-tertiary);
  border-color: var(--color-accent);
}

.filter-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.checkbox {
  width: 14px;
  height: 14px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-background-primary);
}

.checkbox:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.log-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-background-primary);
}

.log-header {
  display: grid;
  grid-template-columns: 120px 60px 80px 1fr 80px;
  gap: 12px;
  padding: 8px 16px;
  background: var(--color-background-secondary);
  border-bottom: 1px solid var(--color-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-items: center;
}

.log-col {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-col.timestamp {
  font-family: 'SF Mono', monospace;
  text-align: center;
}

.log-col.level {
  text-align: center;
}

.log-col.source {
  text-align: center;
}

.log-col.message {
  font-weight: 400;
}

.log-col.actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.scroll-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
}

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

.log-content {
  flex: 1;
  overflow-y: auto;
  font-family: 'SF Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  line-height: 1.4;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-tertiary);
  text-align: center;
  padding: 40px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-tertiary);
}

.log-entry {
  display: grid;
  grid-template-columns: 120px 60px 80px 1fr;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-border-secondary);
  cursor: pointer;
}

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

.log-entry.selected {
  background: rgba(0, 122, 255, 0.1);
  border-left: 3px solid var(--color-accent);
  padding-left: 13px;
}

.log-entry.compact {
  padding: 4px 16px;
  font-size: 11px;
}

.log-entry .log-col.timestamp {
  font-size: 10px;
  color: var(--color-text-tertiary);
  text-align: left;
  font-family: 'SF Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-entry .log-col.source {
  font-size: 10px;
  color: var(--color-text-secondary);
  text-align: center;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.log-entry .log-col.message {
  word-wrap: break-word;
  white-space: pre-wrap;
  color: var(--color-text-primary);
  font-family: 'SF Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
}

.log-entry.log-error .log-col.message {
  font-weight: 500;
}

.log-entry.log-warning .log-col.message {
  font-weight: 400;
}

.log-entry:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.log-entry:hover .log-col.timestamp {
  color: var(--color-text-secondary);
}

.log-entry .log-col.source[data-source='gin'] {
  color: #10b981;
}

.log-entry .log-col.source[data-source='openlist'] {
  color: #3b82f6;
}

.log-entry .log-col.source[data-source='rclone'] {
  color: #8b5cf6;
}

.log-entry .log-col.source[data-source='app'] {
  color: #f59e0b;
}

.level-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  min-width: 50px;
  border: 1px solid transparent;
}

.level-badge.debug {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
  border-color: rgba(107, 114, 128, 0.2);
}

.level-badge.info {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.2);
}

.level-badge.warn {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.2);
}

.level-badge.error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

/* Log Level Row Highlighting */
.log-entry.log-error {
  background: rgba(239, 68, 68, 0.03);
  border-left: 2px solid #ef4444;
  padding-left: 14px;
}

.log-entry.log-warning {
  background: rgba(245, 158, 11, 0.03);
}

.log-entry.log-debug {
  opacity: 0.8;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: var(--color-surface-elevated);
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

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

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-running {
  color: var(--color-success);
  font-weight: 600;
}

.status-stopped {
  color: var(--color-danger);
  font-weight: 600;
}

@media (max-width: 1024px) {
  .log-header,
  .log-entry {
    grid-template-columns: 100px 50px 70px 1fr;
    gap: 8px;
  }

  .toolbar-section.center {
    order: 3;
    flex-basis: 100%;
    margin-top: 8px;
  }

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

  .log-col.timestamp {
    font-size: 9px;
  }
}

@media (max-width: 768px) {
  .log-header,
  .log-entry {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .log-col.timestamp,
  .log-col.level,
  .log-col.source {
    display: none;
  }

  .log-col.message {
    padding: 8px 0;
  }

  .filters-panel,
  .settings-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filter-actions {
    margin-left: 0;
    margin-top: 8px;
  }

  .toolbar-section {
    gap: 4px;
  }

  .toolbar-btn {
    width: 28px;
    height: 28px;
  }

  .log-stats {
    flex-direction: column;
    gap: 4px;
  }

  .status-bar {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .status-left,
  .status-right {
    justify-content: center;
    gap: 12px;
  }
}

:root.dark .log-entry.log-error,
:root.auto.dark .log-entry.log-error {
  background: rgba(239, 68, 68, 0.05);
}

:root.dark .log-entry.log-warning,
:root.auto.dark .log-entry.log-warning {
  background: rgba(245, 158, 11, 0.05);
}

@media (pointer: fine) {
  .log-entry {
    cursor: pointer;
  }

  .toolbar-btn,
  .scroll-btn,
  .filter-btn {
    cursor: pointer;
  }
}

.search-input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.toolbar-btn:focus-visible,
.filter-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media print {
  .log-toolbar,
  .filters-panel,
  .settings-panel,
  .status-bar {
    display: none;
  }

  .log-view {
    height: auto;
  }

  .log-content {
    overflow: visible;
    height: auto;
  }

  .log-entry {
    break-inside: avoid;
    border-bottom: 1px solid #ddd;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.notification-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 300px;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 500;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notification-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.notification-message {
  flex: 1;
  line-height: 1.4;
}

.notification-success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.9) 0%, rgba(21, 128, 61, 0.9) 100%);
  color: white;
}

.notification-success .notification-icon {
  background: rgba(255, 255, 255, 0.2);
}

.notification-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(185, 28, 28, 0.9) 100%);
  color: white;
}

.notification-error .notification-icon {
  background: rgba(255, 255, 255, 0.2);
}

.notification-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(180, 83, 9, 0.9) 100%);
  color: white;
}

.notification-warning .notification-icon {
  background: rgba(255, 255, 255, 0.2);
}

.notification-info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(29, 78, 216, 0.9) 100%);
  color: white;
}

.notification-info .notification-icon {
  background: rgba(255, 255, 255, 0.2);
}

.notification-enter-from {
  opacity: 0;
}

.notification-leave-to {
  opacity: 0;
}

.dark .notification-toast {
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
