/* Filament Logs Explorer - self-contained styles (light & dark aware). */

[x-cloak] {
    display: none !important;
}

/* -------------------------------------------------------------------------- */
/* Page: channel list                                                         */
/* -------------------------------------------------------------------------- */

.lge-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.lge-page-toolbar {
    display: flex;
    justify-content: flex-end;
}

.lge-channel-heading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.lge-driver {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    opacity: 0.75;
}

.lge-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lge-file-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}

.lge-file-row:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.dark .lge-file-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.lge-file-row--active {
    background-color: rgba(99, 102, 241, 0.1);
}

/* The clickable area that opens the file (everything except the delete button). */
.lge-file-open {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    text-align: start;
    background: transparent;
    cursor: pointer;
}

.lge-file-open:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Trailing "delete file" button, kept usable even when the file is unreadable. */
.lge-file-delete {
    flex: 0 0 auto;
    margin-inline-end: 0.5rem;
}

.lge-file-icon {
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    color: #6b7280;
}

.lge-file-body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
    flex: 1 1 auto;
}

.lge-file-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lge-file-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.dark .lge-file-meta {
    color: #9ca3af;
}

.lge-file-warning {
    color: #b45309;
}

.dark .lge-file-warning {
    color: #fbbf24;
}

.lge-file-chevron {
    flex: 0 0 auto;
    width: 1.125rem;
    height: 1.125rem;
    color: #9ca3af;
}

/* Empty state */
.lge-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
}

.lge-empty-state-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: #9ca3af;
}

.lge-empty-state-heading {
    font-size: 1rem;
    font-weight: 600;
}

.lge-empty-state-description {
    font-size: 0.875rem;
    color: #6b7280;
    max-width: 28rem;
}

.dark .lge-empty-state-description {
    color: #9ca3af;
}

/* -------------------------------------------------------------------------- */
/* Viewer (slide-over)                                                        */
/* -------------------------------------------------------------------------- */

.lge-root {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lge-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}

.lge-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lge-toolbar-search {
    flex: 1 1 16rem;
    min-width: 12rem;
}

.lge-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 8rem;
}

.lge-search-icon {
    position: absolute;
    inset-inline-start: 0.625rem;
    width: 1rem;
    height: 1rem;
    color: #9ca3af;
    pointer-events: none;
}

.lge-search-input {
    width: 100%;
    padding-block: 0.4rem;
    padding-inline: 2rem 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: #ffffff;
    color: #111827;
    font-size: 0.875rem;
    line-height: 1.25rem;
    appearance: none;
}

.lge-search-input::placeholder {
    color: #9ca3af;
}

.lge-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 1px #6366f1;
}

.dark .lge-search-input {
    border-color: #374151;
    background-color: rgba(255, 255, 255, 0.05);
    color: #f3f4f6;
}

.lge-matches {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: #6b7280;
    white-space: nowrap;
}

.dark .lge-matches {
    color: #9ca3af;
}

/* Truncation banner */
.lge-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.dark .lge-banner {
    background-color: rgba(251, 191, 36, 0.1);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.3);
}

.lge-banner-icon {
    flex: 0 0 auto;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.0625rem;
}

/* States (empty / unreadable) */
.lge-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 3rem 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.dark .lge-state {
    color: #9ca3af;
}

.lge-state-icon {
    width: 2rem;
    height: 2rem;
    opacity: 0.7;
}

.lge-state--warning {
    color: #b45309;
}

.dark .lge-state--warning {
    color: #fbbf24;
}

/* Log content */
.lge-viewer {
    max-height: calc(100dvh - 20rem);
    min-height: 14rem;
    overflow: auto;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    scroll-behavior: smooth;
}

.dark .lge-viewer {
    border-color: #1f2937;
    background-color: #0b1120;
}

.lge-lines {
    counter-reset: lge-line;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
    padding-block: 0.5rem;
}

.lge-line {
    counter-increment: lge-line;
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    column-gap: 0.75rem;
    padding-inline-end: 0.75rem;
    color: #1f2937;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dark .lge-line {
    color: #d1d5db;
}

.lge-line::before {
    content: counter(lge-line);
    align-self: start;
    position: sticky;
    inset-inline-start: 0;
    text-align: end;
    padding-inline-end: 0.5rem;
    color: #9ca3af;
    background-color: #f3f4f6;
    border-inline-end: 1px solid #e5e7eb;
    user-select: none;
    -webkit-user-select: none;
}

.dark .lge-line::before {
    color: #4b5563;
    background-color: #0b1120;
    border-inline-end-color: #1f2937;
}

.lge-line:hover {
    background-color: rgba(99, 102, 241, 0.06);
}

.lge-line--match {
    background-color: rgba(251, 191, 36, 0.12);
}

.lge-line--current {
    background-color: rgba(251, 191, 36, 0.22);
    box-shadow: inset 2px 0 0 0 #f59e0b;
}

.lge-mark {
    background-color: #fde68a;
    color: #111827;
    border-radius: 0.125rem;
    padding-inline: 0.05rem;
}

.dark .lge-mark {
    background-color: #b45309;
    color: #ffffff;
}

/* Footer */
.lge-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.dark .lge-footer {
    color: #9ca3af;
}

.lge-hint {
    opacity: 0.85;
}
