/* ========= LOG PARSER ========= */

.lp-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* ===== TOOLBAR ===== */

.lp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.lp-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.lp-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ===== INPUT SECTION ===== */

.lp-input-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  transition: flex 0.25s ease;
}

.lp-input-section.lp-input-collapsed {
  flex: 0 0 30%;
  min-height: 100px;
}

.lp-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  gap: 8px;
  flex-shrink: 0;
}

.lp-input-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.lp-input-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lp-input-info {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

.lp-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
  border: 1px solid var(--border);
}

.lp-upload-label:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Dropzone */
.lp-dropzone {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
}

.lp-textarea {
  width: 100%;
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: none;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
  min-height: 0;
}

.lp-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.4;
}

.lp-drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--accent-light);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  z-index: 10;
  pointer-events: none;
}

.lp-drop-overlay.lp-drop-active {
  display: flex;
}

/* ===== OUTPUT SECTION ===== */

.lp-output-section {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
}

.lp-output-section.lp-output-visible {
  display: flex;
}

/* ===== STATS BAR ===== */

.lp-stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
  min-height: 36px;
}

.lp-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.lp-stat-item strong {
  color: var(--text);
  font-weight: 700;
}

.lp-stat-item svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.lp-stat-total {
  color: var(--text);
}

.lp-stat-errors strong {
  color: var(--red);
}

.lp-stat-warnings strong {
  color: var(--orange);
}

.lp-stat-infos strong {
  color: var(--accent);
}

.lp-stat-debugs strong {
  color: var(--text-muted);
}

.lp-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.lp-dot-error { background: var(--red); }
.lp-dot-warn { background: var(--orange); }
.lp-dot-info { background: var(--accent); }
.lp-dot-debug { background: var(--text-muted); opacity: 0.5; }

.lp-stat-format {
  margin-left: auto;
  opacity: 0.7;
}

.lp-stat-showing {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ===== FILTERS ===== */

.lp-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.lp-search-group {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  gap: 6px;
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}

.lp-search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.5;
}

.lp-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  padding: 6px 0;
  min-width: 0;
}

.lp-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.lp-regex-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex-shrink: 0;
}

.lp-regex-toggle input {
  display: none;
}

.lp-regex-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  transition: all 0.15s;
  user-select: none;
}

.lp-regex-toggle input:checked + .lp-regex-label {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.lp-level-filters {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lp-level-check {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.lp-level-check input {
  display: none;
}

.lp-level-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 3px;
  transition: all 0.15s;
  user-select: none;
  opacity: 0.35;
  border: 1px solid transparent;
}

.lp-level-check input:checked + .lp-level-tag {
  opacity: 1;
}

.lp-tag-error {
  color: var(--red);
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
}

.lp-tag-warn {
  color: var(--orange);
  background: rgba(253, 203, 110, 0.1);
  border-color: rgba(253, 203, 110, 0.3);
}

.lp-tag-info {
  color: var(--accent);
  background: var(--accent-light);
  border-color: var(--accent);
}

.lp-tag-debug {
  color: var(--text-muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.lp-time-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lp-time-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.lp-time-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.lp-time-input:focus {
  border-color: var(--accent);
}

.lp-filter-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.lp-btn-sm {
  padding: 4px 10px !important;
  font-size: 11px !important;
  gap: 4px;
}

/* ===== TABLE ===== */

.lp-table-wrapper {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
}

.lp-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  table-layout: fixed;
}

.lp-th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  padding: 7px 10px;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  z-index: 2;
}

.lp-th-sortable {
  cursor: pointer;
  transition: color 0.15s;
}

.lp-th-sortable:hover {
  color: var(--accent);
}

.lp-th-sortable::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 5px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
}

.lp-th-sortable:hover::after {
  opacity: 0.3;
}

.lp-th-sortable.lp-sorted-asc::after {
  opacity: 1;
  border-top: 4px solid var(--accent);
}

.lp-th-sortable.lp-sorted-desc::after {
  opacity: 1;
  border-top: none;
  border-bottom: 4px solid var(--accent);
}

/* Column widths */
.lp-th-line { width: 50px; }
.lp-th-ts { width: 200px; }
.lp-th-level { width: 80px; }
.lp-th-source { width: 150px; }
.lp-th-msg { width: auto; }

/* Table cells */
.lp-cell {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp-cell-line {
  width: 50px;
  color: var(--text-muted);
  opacity: 0.5;
  text-align: right;
  font-size: 11px;
}

.lp-cell-ts {
  width: 200px;
  color: var(--text-secondary);
  font-size: 11px;
}

.lp-cell-level {
  width: 80px;
}

.lp-cell-source {
  width: 150px;
  color: var(--text-secondary);
}

.lp-cell-msg {
  color: var(--text);
}

/* Log level badges */
.lp-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
}

.lp-level-error .lp-badge,
.lp-badge.lp-level-error {
  color: var(--red);
  background: rgba(255, 107, 107, 0.12);
}

.lp-level-warn .lp-badge,
.lp-badge.lp-level-warn {
  color: var(--orange);
  background: rgba(253, 203, 110, 0.12);
}

.lp-level-info .lp-badge,
.lp-badge.lp-level-info {
  color: var(--accent);
  background: var(--accent-light);
}

.lp-level-debug .lp-badge,
.lp-badge.lp-level-debug {
  color: var(--text-muted);
  background: var(--surface-2);
}

/* Row styles */
.lp-row {
  cursor: pointer;
  transition: background 0.1s;
}

.lp-row:hover {
  background: var(--surface-2);
}

.lp-row.lp-row-selected {
  background: var(--accent-light);
}

.lp-row.lp-row-selected .lp-cell-line {
  opacity: 1;
  color: var(--accent);
}

/* Row-level color hints */
.lp-level-error {
  border-left: 3px solid var(--red);
}

.lp-level-warn {
  border-left: 3px solid var(--orange);
}

.lp-level-info {
  border-left: 3px solid transparent;
}

.lp-level-debug {
  border-left: 3px solid transparent;
  opacity: 0.7;
}

.lp-level-error .lp-cell-msg {
  color: var(--red);
}

.lp-no-results td {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
}

.lp-truncation-row td {
  text-align: center;
  padding: 12px 20px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* ===== DETAIL PANEL ===== */

.lp-detail {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  max-height: 35%;
  overflow: auto;
}

.lp-detail.lp-detail-visible {
  display: flex;
}

.lp-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.lp-detail-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.lp-detail-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.lp-detail-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.lp-detail-body {
  padding: 12px 14px;
  overflow: auto;
}

.lp-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light);
}

.lp-detail-row:last-child {
  border-bottom: none;
}

.lp-detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
  padding-top: 1px;
  font-family: var(--font-sans);
}

.lp-detail-value {
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-mono);
  word-break: break-all;
}

.lp-detail-raw-row {
  flex-direction: column;
  gap: 6px;
}

.lp-detail-raw {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  max-height: 120px;
  overflow: auto;
}

/* ===== STATUS BAR ===== */

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

.lp-shortcut-hint {
  opacity: 0.6;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1024px) {
  .lp-time-filters {
    display: none;
  }

  .lp-stat-format {
    display: none;
  }

  .lp-th-source {
    width: 100px;
  }
}

@media (max-width: 768px) {
  .lp-toolbar {
    padding: 8px 12px;
  }

  .lp-toolbar-left {
    width: 100%;
  }

  .lp-toolbar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .lp-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
  }

  .lp-search-group {
    max-width: none;
    min-width: 0;
  }

  .lp-level-filters {
    justify-content: center;
  }

  .lp-time-filters {
    display: none;
  }

  .lp-filter-actions {
    margin-left: 0;
    justify-content: flex-end;
  }

  .lp-stats-bar {
    padding: 6px 10px;
    gap: 10px;
  }

  .lp-stat-item {
    font-size: 11px;
  }

  .lp-stat-format,
  .lp-stat-showing {
    display: none;
  }

  /* Table scroll */
  .lp-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lp-table {
    min-width: 600px;
    table-layout: auto;
  }

  .lp-th,
  .lp-cell {
    padding: 4px 6px;
    font-size: 11px;
  }

  .lp-th-ts,
  .lp-cell-ts {
    width: 140px;
  }

  .lp-th-source,
  .lp-cell-source {
    width: 80px;
  }

  .lp-shortcut-hint {
    display: none;
  }

  .lp-upload-label {
    padding: 3px 6px;
    font-size: 10px;
  }

  .lp-input-section.lp-input-collapsed {
    flex: 0 0 20%;
    min-height: 60px;
  }

  .lp-detail-body {
    padding: 8px 10px;
  }

  .lp-detail-row {
    flex-direction: column;
    gap: 2px;
  }

  .lp-detail-label {
    min-width: 0;
  }
}
