/* ==========================================================================
   ADB Device Manager - Premium Professional Documentation CSS
   Implements a strict editorial design system:
   - Narrower content (max-width: 820px)
   - Strict spacing scale (4px, 8px, 12px, 16px, 24px, 32px, 48px, 64px, 96px)
   - High visual rhythm and whitespace
   - Clean cards for tables, diagrams, and section highlights
   - Perfect list alignments with icons
   ========================================================================== */

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-bg-page: #ffffff;
    --color-bg-card: #fafafa;
    --color-text-title: #111111;
    --color-text-body: #444444;
    --color-text-muted: #666666;
    --color-border: #eaeaea;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Theme tokens */
    --color-header-bg: rgba(255, 255, 255, 0.85);
    --color-img-bg: #ffffff;
    --color-highlight-bg: #f0f7ff;
    --color-nav-hover-bg: #f0f7ff;

    /* Badge None */
    --color-badge-none-bg: #fef2f2;
    --color-badge-none-border: #fee2e2;
    --color-badge-none-text: #ef4444;
}

[data-theme="dark"] {
    --color-bg-page: #0b0f19;
    --color-bg-card: #131b2e;
    --color-text-title: #f8fafc;
    --color-text-body: #cbd5e1;
    --color-text-muted: #94a3b8;
    --color-border: #1e293b;

    --color-header-bg: rgba(11, 15, 25, 0.85);
    --color-img-bg: #131b2e;
    --color-highlight-bg: rgba(37, 99, 235, 0.15);
    --color-nav-hover-bg: rgba(37, 99, 235, 0.12);

    /* Badge None dark mode */
    --color-badge-none-bg: rgba(239, 68, 68, 0.08);
    --color-badge-none-border: rgba(239, 68, 68, 0.25);
    --color-badge-none-text: #fca5a5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100%;
    min-height: 100vh;
    background: var(--color-bg-page);
    font-family: var(--font-sans);
    color: var(--color-text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Header styling */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--color-header-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 32px;
}

.header-content {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-text-title);
    font-weight: 700;
    font-size: 1.1rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: var(--color-primary);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: color 0.15s ease, transform 0.2s ease;
    outline: none;
    margin-left: 8px;
}

.theme-toggle-btn:hover {
    color: var(--color-primary);
    transform: translateY(-1px);
}

.theme-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* Toggle visibility of sun/moon icons depending on the theme */
[data-theme="dark"] .theme-toggle-btn .sun-icon {
    display: block;
}
[data-theme="dark"] .theme-toggle-btn .moon-icon {
    display: none;
}

:root:not([data-theme="dark"]) .theme-toggle-btn .sun-icon {
    display: none;
}
:root:not([data-theme="dark"]) .theme-toggle-btn .moon-icon {
    display: block;
}

/* Main Container: Narrow max-width for premium reading experience */
.main-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

/* Hero Section */
.hero {
    text-align: left;
    margin-bottom: 32px;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-text-title);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 12px;
}

.hero-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-muted);
    line-height: 1.5;
    max-width: 640px;
}

/* Unified Page Summary / Metadata Block */
.page-summary-block {
    display: flex;
    justify-content: space-between;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 48px;
    gap: 32px;
}

.summary-index {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-index h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-title);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.summary-index ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.summary-index li a {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.summary-index li a:hover {
    text-decoration: underline;
}

.summary-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--color-border);
    padding-left: 32px;
    min-width: 140px;
    gap: 4px;
    flex-shrink: 0;
}

.summary-meta span {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-meta strong {
    font-size: 13px;
    color: var(--color-text-title);
    font-weight: 700;
}

/* High-Scannability Summary Badges */
.summary-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 48px;
}

.summary-badge-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-title);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 16px;
}

.summary-badge-item i {
    width: 14px;
    height: 14px;
    color: var(--color-primary);
    flex-shrink: 0;
}

/* Custom separator spacing */
.hero-divider,
.section-divider {
    height: 1px;
    background-color: var(--color-border);
    border: none;
    margin: 64px 0;
}

/* Sections Layout */
.section {
    margin-bottom: 64px;
}

.section-header {
    margin-bottom: 16px;
}

.section-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-title);
    letter-spacing: -0.3px;
}

.section-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-body);
}

.section-content p {
    max-width: 680px; /* Restrict lines to ~65-75 chars */
    margin-bottom: 16px;
}

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

/* Lists and callouts with perfect icon-content alignment */
.clean-list {
    list-style: none;
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.clean-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.clean-list li i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    margin-top: 3px;
    flex-shrink: 0;
}

.clean-list li div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.clean-list li div strong {
    font-size: 14px;
    color: var(--color-text-title);
    font-weight: 700;
}

.clean-list li div span {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
    max-width: 680px;
}

/* Data grid items (without cards - simple structure) */
.data-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.data-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-title);
}

.data-item-header h4 {
    font-size: 14px;
    font-weight: 700;
}

.data-item-header i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.data-item p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0;
    padding-left: 24px;
}

.status-badge {
    font-size: 11px;
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    padding-left: 24px;
}

.status-badge i {
    width: 12px;
    height: 12px;
    color: var(--color-primary);
}

/* Storage & Comm list layouts */
.storage-list,
.comm-list,
.deps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.storage-item,
.comm-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.storage-item i,
.comm-item i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    flex-shrink: 0;
    margin-top: 3px;
}

.storage-item div,
.comm-item div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.storage-item h4,
.comm-item h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-title);
    display: inline-flex;
    align-items: center;
}

.storage-item p,
.comm-item p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0;
    max-width: 680px;
}

.badge-none {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-badge-none-text);
    padding: 2px 6px;
    border: 1px solid var(--color-badge-none-border);
    background: var(--color-badge-none-bg);
    border-radius: 4px;
    margin-left: 8px;
}

/* Callout clean-note (border only callout) */
.clean-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-body);
    margin-top: 32px;
    padding: 16px 24px;
    border-left: 3px solid var(--color-primary);
    background: var(--color-bg-card);
    border-radius: 0 6px 6px 0;
}

.clean-note i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.clean-note span {
    line-height: 1.5;
}

.clean-note span a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.clean-note span a:hover {
    text-decoration: underline;
}

/* Sharing of Data Grid */
.no-share-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.no-share-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-body);
    font-weight: 500;
}

.no-share-item i {
    width: 14px;
    height: 14px;
    color: #ef4444;
    flex-shrink: 0;
}

/* Highlight Items */
.highlight-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.highlight-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.highlight-item i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    flex-shrink: 0;
    margin-top: 3px;
}

.highlight-item div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.highlight-item h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-title);
}

.highlight-item p {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Architecture Diagram - spacious padding and background card */
.architecture-diagram {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 48px;
    margin: 40px 0;
}

.diagram-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.diagram-box {
    background: var(--color-img-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 12px 24px;
    text-align: center;
    min-width: 140px;
}

.diagram-box.primary {
    border-color: var(--color-primary);
    background: var(--color-highlight-bg);
}

.diagram-box h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-title);
    margin: 0;
}

.diagram-box p {
    font-size: 11px;
    color: var(--color-text-muted);
    margin: 0;
}

.diagram-arrow {
    font-size: 16px;
    color: var(--color-primary);
    font-weight: bold;
}

/* Threat Model List */
.threat-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
    margin-top: 24px;
}

.threat-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.protects-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #10b981;
}

.protects-title i {
    width: 16px;
    height: 16px;
}

.limits-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #f59e0b;
}

.limits-title i {
    width: 16px;
    height: 16px;
}

.clean-bullet-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clean-bullet-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.clean-bullet-list li::before {
    content: "•";
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.2;
}

/* Non-Collection Items */
.non-collection-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.non-collection-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.non-collection-item i {
    width: 16px;
    height: 16px;
    color: #ef4444;
    flex-shrink: 0;
    margin-top: 2px;
}

.non-collection-item div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.non-collection-item h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-title);
}

.non-collection-item p {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Third-Party Dependencies List */
.deps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.deps-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.deps-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.deps-header i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.deps-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-title);
    margin: 0;
}

.deps-item p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0;
    padding-left: 24px;
}

.deps-header .status-badge {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-left: 0;
}

.deps-header .status-badge i {
    width: 12px;
    height: 12px;
    color: var(--color-primary);
}

/* Table Style: Wrapped inside rounded cards */
.table-wrapper {
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-card);
    padding: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--color-text-title);
    font-size: 13px;
    border-bottom: 1px solid var(--color-border);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-body);
    font-size: 13px;
}

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

.status-yes {
    color: var(--color-primary);
    font-weight: 600;
}

.status-no {
    color: var(--color-text-muted);
    font-weight: 400;
}

/* Document Info and Metas */
.doc-info {
    display: flex;
    gap: 32px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.doc-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-info-item span {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.doc-info-item strong {
    font-size: 13px;
    color: var(--color-text-title);
    font-weight: 700;
}

/* Related Links Footnote */
.related-link {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px dashed var(--color-border);
    font-size: 13px;
}

.related-link p {
    color: var(--color-text-muted);
}

.related-link a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.related-link a:hover {
    text-decoration: underline;
}

/* Lucide Icon override */
i[data-lucide] {
    display: inline-block;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        padding: 16px;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .nav {
        gap: 16px;
    }

    .main-container {
        padding: 32px 16px 64px;
    }

    .hero-title {
        font-size: 26px;
    }

    .page-summary-block {
        flex-direction: column;
        gap: 16px;
    }

    .summary-meta {
        border-left: none;
        border-top: 1px solid var(--color-border);
        padding-left: 0;
        padding-top: 16px;
    }

    .data-list-grid,
    .no-share-list,
    .threat-list,
    .non-collection-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .doc-info {
        flex-direction: column;
        gap: 16px;
    }

    .diagram-flow {
        flex-direction: column;
        align-items: stretch;
    }

    .diagram-arrow {
        text-align: center;
        transform: rotate(90deg);
        margin: 4px 0;
    }
}
