/* =============================================
   Trace Documentation Page - Styles
   ============================================= */

/* Docs Page Base */
html {
    overflow-x: hidden;
}

.docs-page {
    background: var(--color-bg);
    overflow-x: hidden;
}

@supports (overflow-x: clip) {
    html {
        overflow-x: clip;
    }

    .docs-page {
        overflow-x: clip;
    }
}

/* Nav Active State */
.nav-links a.active {
    color: var(--color-text);
}

/* =============================================
   Docs Layout
   ============================================= */
.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 60px);
    padding-top: 60px;
}

/* =============================================
   Sidebar
   ============================================= */
.docs-sidebar {
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--color-bg);
}

.docs-sidebar-content {
    padding: var(--space-xl) var(--space-md);
}

.docs-sidebar h4 {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
}

.docs-sidebar h4:first-child {
    margin-top: 0;
}

.docs-sidebar ul {
    list-style: none;
    margin-bottom: var(--space-md);
}

.docs-sidebar li {
    margin-bottom: 2px;
}

.docs-sidebar a {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.docs-sidebar a:hover {
    color: var(--color-text);
    background: var(--color-bg-tertiary);
}

.docs-sidebar a.active {
    color: var(--color-accent);
    background: var(--color-accent-light);
}

/* =============================================
   Main Content
   ============================================= */
.docs-main {
    background: var(--color-bg-secondary);
    min-height: 100%;
    min-width: 0;
}

.docs-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
    overflow-wrap: anywhere;
    min-width: 0;
}

/* Sections */
.docs-content section {
    margin-bottom: var(--space-4xl);
    scroll-margin-top: 80px;
}

.docs-content section:last-of-type {
    margin-bottom: var(--space-xl);
}

/* Headers */
.docs-header {
    margin-bottom: var(--space-lg);
}

.docs-content h1 {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--space-md);
}

.docs-content h2 {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-md);
    padding-top: var(--space-md);
}

.docs-header h1,
.docs-header h2 {
    padding-top: 0;
}

.docs-content h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-sm);
}

.docs-content h4 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
}

/* Text */
.docs-intro {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-xl);
}

.docs-content p {
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

.docs-content strong {
    color: var(--color-text);
    font-weight: 600;
}

/* Lists */
.docs-content ul,
.docs-content ol {
    margin-bottom: var(--space-md);
    padding-left: var(--space-lg);
}

.docs-content li {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
    line-height: 1.6;
}

.docs-content li strong {
    color: var(--color-text);
}

/* Code */
.docs-content code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.875em;
    padding: 0.2em 0.4em;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--color-accent);
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

/* =============================================
   Cards & Boxes
   ============================================= */
.docs-card {
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: var(--space-md);
}

.docs-card.highlight {
    border-color: var(--color-accent);
    background: linear-gradient(135deg, var(--color-bg-card) 0%, rgba(0, 113, 227, 0.05) 100%);
}

.docs-card h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
}

.docs-card h4 {
    font-size: var(--font-size-base);
    margin-top: 0;
    margin-bottom: var(--space-sm);
}

.docs-card p:last-child,
.docs-card ul:last-child {
    margin-bottom: 0;
}

/* Grid */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.docs-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.docs-grid .docs-card {
    margin-bottom: 0;
}

/* Info Box */
.docs-info {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-accent-light);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 113, 227, 0.3);
    margin-bottom: var(--space-lg);
}

.docs-info svg {
    width: 24px;
    height: 24px;
    color: var(--color-accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.docs-info strong {
    display: block;
    font-size: var(--font-size-sm);
    margin-bottom: 0.25rem;
}

.docs-info p {
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

.docs-info.warning {
    background: rgba(255, 214, 10, 0.1);
    border-color: rgba(255, 214, 10, 0.3);
}

.docs-info.warning svg {
    color: var(--color-warning);
}

/* Callout */
.docs-callout {
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border-left: 4px solid var(--color-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: var(--space-lg);
}

.docs-callout h4 {
    font-size: var(--font-size-base);
    margin-top: 0;
    margin-bottom: var(--space-sm);
}

.docs-callout p:last-child,
.docs-callout ul:last-child {
    margin-bottom: 0;
}

/* =============================================
   Tables
   ============================================= */
.docs-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--space-lg);
    max-width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.docs-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    min-width: 680px;
}

.docs-table th,
.docs-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-wrap: normal;
    word-break: normal;
    hyphens: auto;
}

.docs-table th {
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-bg-card);
}

.docs-table td {
    color: var(--color-text-secondary);
}

.docs-table td strong {
    color: var(--color-text);
}

.docs-table tr:last-child td {
    border-bottom: none;
}

.docs-table tr:hover td {
    background: var(--color-bg-card);
}

#macos-unterschiede .docs-table table {
    table-layout: fixed;
}

#macos-unterschiede .docs-table th:nth-child(1),
#macos-unterschiede .docs-table td:nth-child(1) {
    width: 24%;
    min-width: 10rem;
}

/* =============================================
   Cleanup Modes
   ============================================= */
.docs-modes {
    display: grid;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.docs-mode {
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.docs-mode-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.docs-mode-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: white;
}

.docs-mode-header.safe .docs-mode-number {
    background: var(--color-success);
}

.docs-mode-header.caution .docs-mode-number {
    background: var(--color-warning);
    color: #000;
}

.docs-mode-header.danger .docs-mode-number {
    background: var(--color-danger);
}

.docs-mode h4 {
    font-size: var(--font-size-lg);
    margin: 0;
}

.docs-mode p {
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

.docs-mode-tag {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
}

.docs-mode-tag.safe {
    background: rgba(48, 209, 88, 0.15);
    color: var(--color-success);
}

.docs-mode-tag.caution {
    background: rgba(255, 214, 10, 0.15);
    color: var(--color-warning);
}

.docs-mode-tag.danger {
    background: rgba(255, 69, 58, 0.15);
    color: var(--color-danger);
}

/* =============================================
   Screenshots
   ============================================= */
.docs-screenshot {
    margin: var(--space-lg) 0 var(--space-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.docs-screenshot + .docs-screenshot {
    margin-top: var(--space-md);
}

.docs-screenshot img {
    width: min(100%, 1040px);
    height: auto;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(16, 16, 18, 0.72);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 14px 34px rgba(0, 0, 0, 0.34);
}

.docs-screenshot figcaption {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    text-align: center;
}

/* =============================================
   Trace Storagebar Demo
   ============================================= */
.trace-storagebar-demo {
    --trace-storage-apps: #3681d9;
    --trace-storage-files: #cf4f46;
    --trace-storage-media: #dabd40;
    --trace-storage-communication: #5cb35d;
    --trace-storage-games: #7858aa;
    --trace-storage-dev: #d38640;
    --trace-storage-system: #86878a;
    --trace-storage-other: #9c7d60;
    --trace-storage-free: #333333;
    --trace-storage-recovered: #1e1e1e;
}

.trace-storagebar-demo h3 {
    margin-top: 0;
}

.trace-storagebar-demo-wrap {
    position: relative;
    margin-top: var(--space-md);
}

.trace-storagebar {
    position: relative;
    display: flex;
    height: 22px;
    border-radius: 0.2rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.trace-storagebar-segment {
    width: 0;
    height: 100%;
    flex: 0 0 auto;
    cursor: help;
    transition: width 700ms cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: calc(var(--segment-index, 0) * 70ms);
}

.trace-storagebar.is-animated .trace-storagebar-segment {
    width: var(--segment-width, 0%);
}

.trace-storagebar-segment:not(.is-free):not(.is-recovered) {
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.35);
}

.trace-storagebar-segment:hover {
    filter: brightness(1.08);
}

.trace-storagebar-segment:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: -2px;
}

.trace-storagebar-segment.is-apps { background: var(--trace-storage-apps); }
.trace-storagebar-segment.is-files { background: var(--trace-storage-files); }
.trace-storagebar-segment.is-media { background: var(--trace-storage-media); }
.trace-storagebar-segment.is-communication { background: var(--trace-storage-communication); }
.trace-storagebar-segment.is-games { background: var(--trace-storage-games); }
.trace-storagebar-segment.is-dev { background: var(--trace-storage-dev); }
.trace-storagebar-segment.is-system { background: var(--trace-storage-system); }
.trace-storagebar-segment.is-other { background: var(--trace-storage-other); }
.trace-storagebar-segment.is-free { background: var(--trace-storage-free); }

.trace-storagebar-segment.is-recovered {
    background: var(--trace-storage-recovered);
    box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.3);
}

.trace-storagebar-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    max-width: min(360px, calc(100vw - 3rem));
    padding: 0.75rem 0.85rem;
    background: rgba(20, 20, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 140ms ease, transform 140ms ease;
    pointer-events: none;
    z-index: 50;
}

.trace-storagebar-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.trace-storagebar-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: var(--trace-tooltip-arrow-x, 50%);
    width: 12px;
    height: 12px;
    background: rgba(20, 20, 20, 0.92);
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    transform: translateX(-50%) rotate(45deg);
}

.trace-storagebar-tooltip-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.trace-storagebar-tooltip-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

.trace-storagebar-tooltip-title {
    color: var(--color-text);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.trace-storagebar-tooltip-size {
    margin-left: auto;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-variant-numeric: tabular-nums;
}

.trace-storagebar-tooltip-body {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    .trace-storagebar-segment {
        transition: none;
    }
}

/* =============================================
   Docs Footer
   ============================================= */
.docs-footer {
    padding-top: var(--space-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: var(--space-3xl);
}

.docs-footer .btn {
    display: inline-flex;
}

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

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1024px) {
    .docs-layout {
        grid-template-columns: 220px 1fr;
    }
}

@media (max-width: 768px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        display: none;
    }

    .docs-content {
        padding: var(--space-xl) var(--space-md);
    }

    .docs-grid.cols-2 {
        grid-template-columns: 1fr;
    }
}
