/* ====================================================== */
/* Club System Sidebar Layout                             */
/* ====================================================== */

:root {
    --sidebar-width:        260px;
    --sidebar-collapsed:    64px;
    --sidebar-bg:           #1a1f2e;
    --sidebar-text:         rgba(255, 255, 255, 0.75);
    --sidebar-text-hover:   #ffffff;
    --sidebar-active-bg:    rgba(255, 255, 255, 0.12);
    --sidebar-active-color: #ffffff;
    --sidebar-border:       rgba(255, 255, 255, 0.08);
    --sidebar-section:      rgba(255, 255, 255, 0.35);
    --content-bg:           #f5f6fa;
    --breadcrumb-height:    48px;
}

/* ── 整體外框 ── */
.club-layout {
    background: var(--content-bg);
}

.club-wrapper {
    display: flex;
    min-height: calc(100vh - var(--sa-navbar-height));
    margin-top: 0; /* navbar 已是 fixed-top，body padding-top 由 navbar spacer 處理 */
}

/* ── Sidebar ── */
.club-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--sa-navbar-height);
    height: calc(100vh - var(--sa-navbar-height));
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .25s ease, min-width .25s ease;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.club-sidebar.collapsed {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
}

/* Sidebar Header */
.club-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem .75rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.club-sidebar-title {
    font-weight: 700;
    font-size: .95rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
}

.club-sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    padding: .25rem .35rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s, transform .25s;
    flex-shrink: 0;
}
.club-sidebar-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }
.club-sidebar.collapsed .club-sidebar-toggle { transform: rotate(180deg); }

/* 登入者資訊 */
.club-sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user-name {
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-sub {
    margin-top: 2px;
}

/* ── 導覽選單 ── */
.club-sidebar-nav {
    flex: 1;
    padding: .75rem .5rem;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sidebar-section);
    padding: .25rem .65rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .65rem;
    border-radius: 7px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .875rem;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: rgba(255,255,255,.08);
    color: var(--sidebar-text-hover);
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
    font-weight: 600;
}

.sidebar-icon {
    font-size: .95rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: .8;
}

.sidebar-link.active .sidebar-icon { opacity: 1; }

/* 子選單縮排 */
.sidebar-submenu { padding-left: .75rem; }
.sidebar-link-sub { font-size: .83rem; }

/* Sidebar Footer */
.club-sidebar-footer {
    padding: .75rem .5rem;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

/* ── 收縮時隱藏文字 ── */
.club-sidebar.collapsed .sidebar-text,
.club-sidebar.collapsed .sidebar-section-label,
.club-sidebar.collapsed .sidebar-submenu {
    display: none !important;
}

.club-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: .6rem;
}

.club-sidebar.collapsed .club-sidebar-header {
    justify-content: center;
    padding: 1rem .5rem .75rem;
}

.club-sidebar.collapsed .club-sidebar-user {
    justify-content: center;
    padding: .85rem .5rem;
}

/* ── 主內容區 ── */
.club-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* 麵包屑列 */
.club-breadcrumb-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    font-size: .83rem;
    height: var(--breadcrumb-height);
    position: sticky;
    top: var(--sa-navbar-height);
    z-index: 99;
}

/* 頁面內容 */
.club-content {
    padding: 1.5rem;
    flex: 1;
}

/* ── 手機版：Sidebar 變成 Offcanvas ── */
@media (max-width: 991.98px) {
    .club-sidebar {
        position: fixed;
        top: var(--sa-navbar-height);
        left: 0;
        height: calc(100vh - var(--sa-navbar-height));
        transform: translateX(-100%);
        transition: transform .25s ease, width .25s ease;
        z-index: 1040;
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
    }
    .club-sidebar.mobile-open {
        transform: translateX(0);
    }
    .club-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1039;
    }
    .club-sidebar-overlay.show { display: block; }

    .club-main { width: 100%; }
    .club-content { padding: 1rem; }
    .club-breadcrumb-bar { padding: .5rem 1rem; }
}
