/*
 * Dorsal File/Collection Report/Dashboard default theme
 */

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Ubuntu Mono', 'Courier New', monospace;

    --bg-color: #ffffff;
    --text-color: #1f2937;
    --muted-text-color: #6b7280;
    --border-color: #e5e7eb;
    --panel-bg-color: #f9fafb;
    --accent-color: #0ea5e9;
    --accent-text-color: #ffffff;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
}

:root.dark {
    --bg-color: #111827;
    --text-color: #e5e7eb;
    --muted-text-color: #9ca3af;
    --border-color: #374151;
    --panel-bg-color: #1f2937;
    --accent-color: #38bdf8;
    --accent-text-color: #111827;
    --success-color: #019c3a;
    --warning-color: #facc15;
}

*, *:before, *:after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 2rem;
    font-size: 16px;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s ease-in-out;
}

header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--panel-bg-color);
    border-radius: 0.5rem 0.5rem 0 0;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    word-break: break-all;
}

header .subtitle {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--muted-text-color);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

main {
    padding: 2rem;
}

.section {
    margin-bottom: 2.5rem;
}

.section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    transition: border-color 0.2s ease-in-out;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.grid-single-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.grid-item .label {
    font-size: 0.875rem;
    color: var(--muted-text-color);
    margin-bottom: 0.25rem;
    display: block;
}

.grid-item .value {
    font-weight: 500;
    font-size: 1.125rem;
    overflow-wrap: break-word;
}

.grid-item .value.mono {
    font-family: var(--font-mono);
    font-size: 1em;
}

.grid-item .value.subdued {
    color: var(--muted-text-color);
    font-style: italic;
}

/* --- Styles for File Detail View (Modal) --- */
.grid-item .label a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--muted-text-color);
}

.hash-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--panel-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
}

.hash-container:hover {
    background-color: #f3f4f6;
}

:root.dark .hash-container:hover {
    background-color: #374151;
}

.hash-value {
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow-x: auto;
    flex-grow: 1;
    cursor: text;
}

.copy-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--muted-text-color);
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.copy-icon:hover {
    color: var(--text-color);
}

.tag {
    display: inline-block;
    background-color: var(--accent-color);
    color: var(--accent-text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.annotation-group {
    padding-top: 0.75rem;
}

.sub-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.nested-item {
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

/* --- End of File Detail Styles --- */

.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    transition: border-color 0.2s ease-in-out;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--panel-bg-color);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}

.accordion-icon {
    transition: transform 0.2s ease-in-out;
    color: var(--muted-text-color);
}

.accordion-content {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: none;
    transition: border-color 0.2s ease-in-out;
}

.summary-card {
    background-color: var(--panel-bg-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--warning-color);
    padding: 1rem 1.5rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.file-path-list {
    list-style-type: none;
    padding-left: 0;
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.file-path-list li {
    padding: 0.25rem 0;
}

.file-explorer-controls {
    margin-bottom: 1rem;
}

.file-explorer-controls input {
    box-sizing: border-box; 
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.table-container {
    overflow-x: auto;
}

#file-explorer-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#file-explorer-table th,
#file-explorer-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#file-explorer-table th>div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#file-explorer-table th:nth-child(1),
#file-explorer-table td:nth-child(1) {
    width: 50%;
}

#file-explorer-table th:nth-child(2),
#file-explorer-table td:nth-child(2) {
    width: 15%;
}

#file-explorer-table th:nth-child(3),
#file-explorer-table td:nth-child(3) {
    width: 20%;
}

#file-explorer-table th:nth-child(4),
#file-explorer-table td:nth-child(4) {
    width: 15%;
}


.truncate-cell {
    max-width: 0;
}

.truncate-cell>span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#file-explorer-table td .file-link {
    color: var(--accent-color);
    font-weight: 500;
}

#file-explorer-table td .file-link {
    cursor: pointer;
}

#file-explorer-table td .file-link:hover {
    text-decoration: underline;
}

#file-explorer-table td .file-link:hover {
    text-decoration: underline;
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--muted-text-color);
}

.pagination-controls button {
    background-color: var(--panel-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-text-color);
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    transition: border-color 0.2s ease-in-out;
}

.theme-switch {
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 9999px;
    padding: 0.25rem;
}

.theme-switch:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

:root.dark .theme-switch:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.theme-switch svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--muted-text-color);
}

.dark #dark-icon {
    display: block;
}

.dark #light-icon {
    display: none;
}

#dark-icon {
    display: none;
}

#light-icon {
    display: block;
}


[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before,
[data-tooltip]:after {
    line-height: 1.4;
    font-size: .9em;
    pointer-events: none;
    position: absolute;
    box-sizing: border-box;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

[data-tooltip]:before {
    content: '';
    border: 5px solid transparent;
    z-index: 1001;
}

[data-tooltip]:after {
    content: attr(data-tooltip);
    text-align: left;
    min-width: 10em;
    max-width: 300px;
    white-space: normal;
    overflow-wrap: break-word;
    padding: .5rem .75rem;
    border-radius: .25rem;
    background: var(--text-color);
    color: var(--bg-color);
    z-index: 1000;
}

[data-tooltip]:hover:before,
[data-tooltip]:hover:after {
    display: block;
    opacity: 1;
}

[data-tooltip][data-tooltip-placement="top"]:before {
    bottom: 100%;
    left: 50%;
    margin-bottom: -1px;
    transform: translateX(-50%);
    border-top-color: var(--text-color);
}

[data-tooltip][data-tooltip-placement="top"]:after {
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
}

.mono {
    font-family: var(--font-mono);
}

.chart-container {
    position: relative;
    background-color: var(--panel-bg-color);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 0.375rem;
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.overview-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

.interactive-chart-panel {
    background-color: var(--panel-bg-color);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
}

.chart-panel-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.chart-control-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
}

:root.dark .chart-control-btn {
    background-color: #374151;
}

.chart-control-btn:hover {
    border-color: var(--muted-text-color);
}

.chart-control-btn.active {
    background-color: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}

:root.dark .chart-control-btn.active {
    background-color: #0ea5e9;
    border-color: #0ea5e9;
    color: #ffffff;
}

.metric-toggle-controls {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    overflow: hidden;
}

.metric-toggle-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background-color: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.metric-toggle-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.metric-toggle-btn.active {
    background-color: var(--panel-bg-color);
    color: var(--accent-color);
    font-weight: 600;
}

:root.dark .metric-toggle-btn.active {
    background-color: #374151;
}

.metric-toggle-btn:disabled {
    color: var(--muted-text-color);
    background-color: transparent;
    cursor: not-allowed;
    opacity: 0.6;
}

.chart-panel-body {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-grow: 1;
}

.chart-area {
    position: relative;
    flex-grow: 1;
    min-width: 0;
    height: 100%;
    min-height: 320px;
}

.chart-legend {
    flex-shrink: 0;
    width: 220px;
}

.chart-legend ul {
    flex-wrap: wrap;
}

.mini-file-view-panel {
    background-color: var(--panel-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
    font-size: 0.9em;
}

.mini-file-view-panel .panel-header {
    padding: 0rem 1rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.panel-title-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mini-file-view-panel .panel-content {
    padding: 1.25rem 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

.mini-file-view-panel .sub-header {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 1.25em;
}

.mini-file-view-panel .header-with-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-icon {
    color: var(--muted-text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-icon svg {
    width: 1em;
    height: 1.2em;
}

.expand-icon {
    color: var(--muted-text-color);
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.expand-icon:hover {
    color: var(--text-color);
}

.expand-icon svg {
    margin-top: 1em;
    width: 1.4em;
    height: 1.4em;
}

.mini-file-view-panel .grid-item .value {
    font-size: 1em;
    font-weight: 500;
}

.mini-section {
    margin-bottom: 1.25rem;
}

.mini-section:last-child {
    margin-bottom: 0;
}

@media (max-width: 1024px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .chart-panel-body {
        flex-direction: column;
    }

    .chart-legend {
        width: 100%;
    }

    .chart-area {
        min-height: 280px;
    }
}

.file-path-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.mini-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.mini-table th,
.mini-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.mini-table th {
    text-align: left;
    font-weight: 600;
}

#toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 2001;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s, bottom 0.3s;
}

#toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 3rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

body.modal-open .modal-overlay {
    display: flex;
}

body.modal-open {
    overflow: hidden;
}

.modal-content {
    background-color: var(--bg-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--muted-text-color);
    cursor: pointer;
}

.modal-body {
    overflow-y: auto;
    flex-grow: 1;
    padding: 0;
}

.tabs-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--panel-bg-color);
    flex-shrink: 0;
}

.tab-link {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--muted-text-color);
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.tab-link:hover {
    color: var(--text-color);
}

.tab-link.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
    padding: 1.5rem;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.tab-content pre {
    margin: 0;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}