/* ===========================
   CSS変数・カラースキーム
   =========================== */
:root {
    /* メインカラー */
    --main-green: #dfeacb;
    --main-green-dark: #92a869;
    --main-white: #ffffff;

    /* 補助カラー */
    --accent-gray: #c3c3c3;
    --accent-lavender: #c8bacc;

    /* エイリアス */
    --color-primary: #92a869;
    --color-primary-light: #dfeacb;
    --color-secondary: #c3c3c3;

    /* テキストカラー */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;

    /* 背景カラー */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-hover: #f0f0f0;

    /* レイアウトサイズ */
    --sidebar-width: 220px;
    --header-height: 58px;

    /* デザイン要素 */
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --transition-speed: 0.22s ease;
}



/* ===========================
   リセット・基本スタイル
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 12px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    font-size: 12px;
    line-height: 1.4;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all var(--transition-speed);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===========================
   新レイアウト（B/C/D）
   =========================== */
.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

.top-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background-color: var(--main-white);
    border-bottom: 2px solid var(--main-green);
    box-shadow: var(--box-shadow);
    z-index: 1000;
}

.header-container {
    height: 100%;
    padding: 0 16px 0 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.header-placeholder {
    flex: 1;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--main-white);
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.sidebar-logo-wrap {
    padding: 10px 14px 6px 14px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-logo {
    width: 130px;
    height: auto;
    object-fit: contain;
}

/* ===========================
   メインレイアウト
   =========================== */
.app-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-category-title {
    padding: 5px 16px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-lavender);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.sidebar-item:hover {
    background-color: var(--bg-hover);
}

.sidebar-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.sidebar-item.disabled:hover {
    background-color: transparent;
}

.sidebar-item.disabled::after {
    content: "準備中";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    background-color: var(--color-secondary);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
}

.sidebar-item.active {
    background-color: var(--main-green);
    color: var(--text-primary);
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--accent-lavender);
}

.sidebar-icon {
    font-size: 1.3rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-icon-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-text {
    font-size: 0.95rem;
}

/* ===========================
   メインコンテンツ
   =========================== */
.main-content {
    padding: 82px 18px 22px 18px;
    min-height: calc(100vh - var(--header-height));
    background-color: var(--bg-secondary);
    max-width: 100%;
}

#spa-content {
    width: 100%;
}


/* ===========================
   ホーム画面レイアウト（本文＋リンク集パネル）
   =========================== */
.home-layout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.home-main {
    flex: 1;
    min-width: 0;
}

.home-links-panel {
    width: 240px;
    flex-shrink: 0;
    background-color: var(--main-white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 12px;
    position: sticky;
    top: 16px;
}

.home-links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.home-links-header h3 {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.home-links-more {
    font-size: 0.75rem;
    color: var(--main-green-dark);
    text-decoration: none;
    white-space: nowrap;
}

.home-links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.home-link-card {
    display: block;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--transition-speed);
}

.home-link-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.home-link-card-image {
    width: 100%;
    aspect-ratio: 2.4 / 1;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.home-link-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-link-card-no-image {
    font-size: 1.3rem;
    color: #bbb;
}

.home-link-card-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
}

.home-link-card-favicon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.home-link-card-title {
    font-size: 0.76rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-links-empty,
.home-links-loading {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 10px 0;
}

/* ===========================
   ヒーローセクション
   =========================== */
.hero-section {
    margin-bottom: 18px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.hero-image {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

/* ===========================
   カテゴリーセクション
   =========================== */
.categories-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 14px;
}

.category-block {
    background-color: var(--main-white);
    border-radius: var(--border-radius);
    padding: 12px 12px 12px;
    box-shadow: var(--box-shadow);
}

.category-header {
    margin-bottom: 10px;
    text-align: left;
}

.category-title-image {
    max-width: 150px;
    height: auto;
    margin: 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(95px, 1fr));
    gap: 10px;
}

.category-card {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 10px 8px 8px;
    text-align: center;
    transition: all var(--transition-speed);
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 120px;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    border-color: var(--main-green-dark);
}

.category-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.category-card.disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

.category-card.disabled::after {
    content: "準備中";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    background-color: var(--color-secondary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.category-card img {
    width: 100%;
    height: clamp(90px, 9vw, 160px);
    object-fit: contain;
    margin: 0 0 8px 0;
}

.category-card h3 {
    width: 100%;
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

/* ===========================
   フッター
   =========================== */
footer {
    background-color: var(--main-white);
    border-top: 1px solid #e0e0e0;
    padding: 20px;
    text-align: center;
    margin-left: var(--sidebar-width);
}

.footer-container {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===========================
   レスポンシブデザイン
   =========================== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-speed);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    footer {
        margin-left: 0;
    }

    .categories-section {
        grid-template-columns: 1fr;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .home-layout {
        flex-direction: column;
    }

    .home-links-panel {
        width: 100%;
        position: static;
    }

    .header-logo h1 {
        font-size: 1.4rem;
    }
}

/* ===========================
   認証関連スタイル
   =========================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-size: 18px;
    color: #666;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--main-green-dark);
    opacity: 0.9;
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #b0b0b0;
}

.btn-logout {
    padding: 8px 16px;
    background-color: var(--color-secondary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 16px;
}

.btn-logout:hover {
    background-color: #b0b0b0;
}

/* ===========================
   認証画面
   =========================== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-secondary);
    padding: 20px;
}

.auth-card {
    max-width: 500px;
    width: 100%;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
}

.auth-header h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.auth-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ===========================
   ステータスメッセージ
   =========================== */
.status-message {
    max-width: 600px;
    margin: 100px auto;
    padding: 40px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.status-message h2 {
    color: var(--color-primary);
    margin-bottom: 20px;
}

.status-message p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

.error-message {
    max-width: 600px;
    margin: 100px auto;
    padding: 40px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.error-message h2 {
    color: #d32f2f;
    margin-bottom: 20px;
}

.error-message p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}