/* ベース */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #222;
    background-color: #F2DFDF;
}

/* レイアウト全体 */

.app-layout {
    width: 90%;
    display: flex;
    min-height: 100vh;
    justify-content: space-between;
}

/* サイドバー */

.sidebar {
    width: 20%;
    background-color: #ffffff;
    border-right: 1px solid #e2e5ec;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
    padding: 0 8px;
}

.app-logo img {
    max-width: 32px;
    height: auto;
    display: flex;
    /* align-items: center;
    justify-content: center; */
    margin-right: 8px;
}

.app-name img {
    max-width: 112px;
}

/* ナビゲーションメニュー */

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-section {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-section + .nav-section {
    margin-top: 8px;
}

.nav-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 16px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 10px;
    margin-bottom: 4px;
    text-decoration: none;
    border-radius: 8px;
    color: #4b5563;
    font-size: 14px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.nav-link.active {
    background-color: #e0ebff;
    color: #1d4ed8;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    margin-right: 10px;
    font-size: 16px;
}

.nav-label {
    white-space: nowrap;
}

/* モバイル用トップバー（デフォルトは非表示） */
.mobile-topbar {
    display: none;
}

.mobile-topbar {
    height: 56px;
    padding: 0 16px;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: none;
    align-items: center;
    justify-content: space-between;
}

.mobile-topbar .topbar-left img {
    width: 28px;
    height: 28px;
}

.mobile-topbar .icon-button {
    background: none;
    border: none;
    padding: 4px;
    font-size: 20px;
    color: #4b5563;
}

/* メインエリア */

.main-area {
    flex: 1;
    padding: 24px 32px;
}

.main-inner {
    max-width: 800px;
    margin: 0 auto;
}

.card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    padding: 24px 24px 28px;
}

/* レスポンシブ */

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        padding: 16px 12px;
    }

    .main-area {
        padding: 16px 16px;
    }

    .app-layout {
        width: 100%;
        margin: 0;
        flex-direction: column;
        min-height: 100vh;
        padding-bottom: 64px;
    }

    .mobile-topbar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .main-area {
        order: 1;
        padding: 16px 16px 24px;
    }

    /* サイドバーをボトムナビ化 */
    .sidebar {
        order: 2;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 56px;
        padding: 4px 8px;
        border-right: none;
        border-top: 1px solid #e5e7eb;
        background-color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2;
    }

    /* サイドバー内のロゴはモバイルでは不要 */
    .sidebar-header {
        display: none;
    }

    /* ナビ部分を横並びにしてボトムナビっぽく */
    .sidebar-nav {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
    }

    .nav-section {
        display: flex;
        flex-direction: row;
    }

    .nav-section + .nav-section {
        margin-top: 0;
    }

    .nav-link {
        flex-direction: column;
        margin-bottom: 0;
        padding: 4px 6px;
        font-size: 12px;
    }

    /* ラベルを消してアイコンだけにする */
    .nav-label {
        display: none;
    }

    /* PC用のサイドバー幅調整は不要になるので上書き */
    .sidebar {
        width: 100%;
    }

    .main-inner {
        max-width: 100%;
    }
}

