/* ===== Web Fonts ===== */
@font-face {
    font-family: "Noto Sans JP";
    src: url("fonts/NotoSansJP-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Noto Sans JP";
    src: url("fonts/NotoSansJP-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "UDEV Gothic JPDOC";
    src: url("fonts/UDEVGothicJPDOC-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "UDEV Gothic JPDOC";
    src: url("fonts/UDEVGothicJPDOC-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ===== CSS Variables (Light) ===== */
:root {
    --bg: #fff;
    --bg-sidebar: #f9f9f9;
    --bg-hover: rgba(31, 35, 41, 0.04);
    --bg-active: rgba(31, 35, 41, 0.08);
    --bg-card: #f5f5f5;
    --bg-card-alt: #e5e5e5;
    --text: #1f2329;
    --text-muted: #999;
    --text-icon: #666;
    --border: #f0f0f0;
    --border-strong: #e0e0e0;
    --scrollbar: #ddd;
    --scrollbar-hover: #ccc;
    /* illuminote accent */
    --accent: #2ecc87;
    --accent-hover: #27b077;
    --accent-light: #e8f8f0;
    --accent-dark: #1fa06a;
    --accent-sidebar-bg: #3ecf8e;
    --accent-sidebar-text: #fff;
    --wip-color: #f0ad4e;
    --wip-bg: #fdf6ec;
    --shipped-color: #2ecc87;
    --shipped-bg: #e8f8f0;
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a1a;
        --bg-sidebar: #141414;
        --bg-hover: rgba(255, 255, 255, 0.05);
        --bg-active: rgba(255, 255, 255, 0.1);
        --bg-card: #242424;
        --bg-card-alt: #2a2a2a;
        --text: #e0e0e0;
        --text-muted: #888;
        --text-icon: #aaa;
        --border: #2a2a2a;
        --border-strong: #3a3a3a;
        --scrollbar: #444;
        --scrollbar-hover: #555;
        /* illuminote accent (dark) */
        --accent-light: #1a3a2a;
        --accent-sidebar-bg: #2a9d6a;
        --wip-bg: #3a2f1a;
        --shipped-bg: #1a3a2a;
    }
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: "Noto Sans JP", "BIZ UDPGothic", sans-serif;
    font-size: 14px;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

code, pre, kbd, samp {
    font-family: "UDEV Gothic JPDOC", "Consolas", monospace;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

/* ===== Layout ===== */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== Sidebar (base styles, overridden by scoped CSS) ===== */
.sidebar {
    width: 64px;
    min-width: 64px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

/* ===== Mobile Sidebar Toggle ===== */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-strong);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
}

.sidebar-overlay {
    display: none;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 48px 48px;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 28px;
    font-weight: 300;
    color: var(--text);
}

.section-link {
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
}

.section-link:hover {
    color: var(--text);
}

/* ===== File List ===== */
.file-list {
    margin-bottom: 48px;
}

.file-list-row {
    display: flex;
    align-items: center;
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.file-list-row:last-child {
    border-bottom: none;
}

.file-list-row:hover {
    background: var(--bg-hover);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-title {
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.file-tag .material-symbols-outlined {
    font-size: 14px;
}

.file-duration {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 80px;
}

.file-date {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 160px;
}

.file-menu-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.15s;
}

.file-menu-btn:hover {
    background: var(--bg-active);
    color: var(--text);
}

/* ===== News Cards ===== */
.news-section {
    margin-bottom: 48px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.news-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.news-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.news-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-card-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-card-image .placeholder-icon {
    font-size: 48px;
    color: var(--text-muted);
}

.news-card-body {
    padding: 16px;
}

.news-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.news-card-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Community Cards ===== */
.community-section {
    margin-bottom: 48px;
}

.community-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.community-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.community-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border-color: var(--border-strong);
}

.community-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.community-card-icon.green { background: #ecfdf5; color: #10b981; }
.community-card-icon.blue  { background: #eff6ff; color: #3b82f6; }
.community-card-icon.purple { background: #f5f3ff; color: #8b5cf6; }

@media (prefers-color-scheme: dark) {
    .community-card-icon.green { background: #052e16; }
    .community-card-icon.blue  { background: #172554; }
    .community-card-icon.purple { background: #2e1065; }
}

.community-card-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.community-card-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.community-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.community-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.community-card-footer .material-symbols-outlined {
    font-size: 14px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

/* ===== Material Symbols ===== */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
    vertical-align: middle;
    line-height: 1;
}

/* ===== Blazor Error Boundary ===== */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ===== Mobile Responsive ===== */
@media screen and (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0,0,0,0.4);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        padding: 64px 16px 24px;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .community-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .file-duration,
    .file-date {
        display: none;
    }

    .section-title {
        font-size: 22px;
    }
}

@media screen and (max-width: 480px) {
    .community-grid {
        grid-template-columns: 1fr;
    }
}
