/* Reset & base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark theme (default) */
:root,
[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-card-hover: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #a0aab5;
    --text-muted: #6b7685;
    --accent: #9b72cf;
    --accent-light: #c9a0ff;
    --accent-green: #3fb950;
    --accent-green-muted: #2ea04370;
    --border: #30363d;
    --hover-bg: #21262d;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f6f8fa;
    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --text-muted: #8b949e;
    --accent: #7c3aed;
    --accent-light: #6d28d9;
    --accent-green: #1a7f37;
    --accent-green-muted: #1a7f3720;
    --border: #d0d7de;
    --hover-bg: #f3f4f6;
}

/* WCAG accessible - light */
[data-a11y="true"],
[data-a11y="true"][data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f0;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #555555;
    --accent: #0000cc;
    --accent-light: #0000cc;
    --accent-green: #006600;
    --accent-green-muted: #00660020;
    --border: #666666;
    --hover-bg: #e8e8e8;
}

/* WCAG accessible - dark */
[data-a11y="true"][data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --bg-card-hover: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #bbbbbb;
    --accent: #6fa3ff;
    --accent-light: #6fa3ff;
    --accent-green: #5cff5c;
    --accent-green-muted: #5cff5c20;
    --border: #888888;
    --hover-bg: #1a1a1a;
}

/* Base styles */
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}

.logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

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

/* Theme & A11y toggles */
.theme-toggle,
.a11y-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover,
.a11y-toggle:hover {
    background: var(--hover-bg);
    border-color: var(--accent);
}

.theme-icon,
.a11y-icon {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
    transition: fill 0.15s ease;
}

.theme-toggle:hover .theme-icon,
.a11y-toggle:hover .a11y-icon {
    fill: var(--text-primary);
}

.theme-icon.moon {
    display: block;
}

.theme-icon.sun {
    display: none;
}

[data-theme="light"] .theme-icon.moon {
    display: none;
}

[data-theme="light"] .theme-icon.sun {
    display: block;
}

.a11y-toggle.active {
    border-color: var(--accent-green);
    background: var(--accent-green-muted);
}

.a11y-toggle.active .a11y-icon {
    fill: var(--accent-green);
}

/* Main */
.main {
    flex: 1;
    padding: 32px 24px;
}

/* Page hero */
.page-hero {
    margin-bottom: 32px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-light), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Light theme overrides */
[data-theme="light"] .gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .extension-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* WCAG overrides */
[data-a11y="true"] body {
    font-size: 16px;
    line-height: 1.8;
}

[data-a11y="true"] .gradient-text {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: var(--text-primary);
    background-clip: unset;
}

[data-a11y="true"] .extension-description {
    font-size: 16px;
    line-height: 1.8;
}

[data-a11y="true"] .extension-card {
    border-width: 2px;
}

[data-a11y="true"] .extension-name {
    font-size: 18px;
}

[data-a11y="true"] .extension-link {
    text-decoration: underline;
    font-size: 15px;
}

[data-a11y="true"] *:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

[data-a11y="true"] a {
    text-decoration: underline;
}

[data-a11y="true"] .logo {
    text-decoration: none;
}

/* Extensions grid */
.extensions-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.extension-card {
    padding: 24px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.extension-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.extension-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.extension-icon {
    font-size: 28px;
}

.extension-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.status-published {
    background: var(--accent-green-muted);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.status-development {
    background: rgba(250, 204, 21, 0.1);
    color: #facc15;
    border: 1px solid #facc15;
}

.extension-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.extension-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.tech-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--accent-green);
}

.extension-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.extension-link {
    font-size: 13px;
    color: var(--accent-light);
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.extension-link:hover {
    opacity: 0.8;
}

/* Footer */
.footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.footer-link:hover {
    background: var(--hover-bg);
    color: var(--accent-light);
}

.footer-icon {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    transition: fill 0.15s ease;
}

.footer-link:hover .footer-icon {
    fill: var(--accent-light);
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
}

/* Privacy pages */
.back-link {
    display: inline-block;
    color: var(--accent-light);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
    transition: opacity 0.15s ease;
}

.back-link:hover {
    opacity: 0.8;
}

.privacy-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.privacy-extension-name {
    font-size: 16px;
    color: var(--accent-light);
    margin-bottom: 8px;
    font-weight: 600;
}

.last-updated {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.highlight-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
}

.highlight-box p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.privacy-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 28px;
    margin-bottom: 12px;
}

.privacy-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.privacy-content ul {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    list-style: none;
    padding: 0;
    margin-bottom: 12px;
}

.privacy-content ul li {
    padding-left: 16px;
    position: relative;
    margin-bottom: 6px;
}

.privacy-content ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
}

.privacy-content a {
    color: var(--accent-light);
    text-decoration: none;
}

.privacy-content a:hover {
    opacity: 0.8;
}

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

    .main {
        padding: 24px 16px;
    }

    .page-title {
        font-size: 24px;
    }

    .page-subtitle {
        font-size: 14px;
    }

    .extension-card {
        padding: 20px;
    }

    .extension-header {
        flex-wrap: wrap;
    }

    .footer {
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

/* Permissions table */
.permissions-table {
    margin: 16px 0;
    overflow-x: auto;
}

.permissions-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.permissions-table th,
.permissions-table td {
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--border);
}

.permissions-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

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

.permissions-table code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--accent-light);
    white-space: nowrap;
}

.permissions-table tr:hover td {
    background: var(--hover-bg);
}