/**
 * Tenant 店家後台樣式
 *
 * 預約平台 - 店家後台專用 CSS
 */

/* ========================================
   版面配置
   ======================================== */

#wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 側邊欄背景延伸 - 防止右側內容滾動時左側出現空白 */
#wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-gradient-primary);
    pointer-events: none;
    z-index: 0;
    transition: width 0.3s ease;
}

#wrapper:has(#sidebar.collapsed)::before {
    width: var(--sidebar-collapsed-width);
}

#content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    background-color: var(--light-color);
    position: relative;
    z-index: 1;
}

#content {
    flex: 1 0 auto;
    padding: 1.5rem;
}

/* ========================================
   側邊欄
   ======================================== */

#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--bg-gradient-primary);
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1;
}

/* nav 列表獨立捲動區域 */
#sidebar .nav.flex-column {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior: contain;
}

#sidebar .nav.flex-column::-webkit-scrollbar {
    display: none;
}

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

/* Logo */
.sidebar-brand {
    height: 4.375rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-decoration: none;
}

.sidebar-brand-icon {
    font-size: 1.5rem;
    color: white;
}

.sidebar-brand-text {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin-left: 0.5rem;
}

#sidebar.collapsed .sidebar-brand-text {
    display: none;
}

/* 分隔線 */
.sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 0 1rem 1rem;
    flex-shrink: 0;
}

/* 標題 */
.sidebar-heading {
    padding: 0 1rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

#sidebar.collapsed .sidebar-heading {
    display: none;
}

/* 導航項目 */
.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: white;
}

.nav-link.active {
    color: white;
    font-weight: 700;
}

.nav-link i {
    font-size: 1rem;
    width: 1.5rem;
    margin-right: 0.75rem;
    text-align: center;
}

#sidebar.collapsed .nav-link span {
    display: none;
}

#sidebar.collapsed .nav-link i {
    margin-right: 0;
}

#sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

/* 摺疊按鈕 */
.sidebar-toggle {
    width: 100%;
    padding: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

.sidebar-toggle:hover {
    color: white;
}

/* ========================================
   頂部導航
   ======================================== */

.topbar {
    height: 4.375rem;
    background-color: white;
    box-shadow: var(--shadow-sm);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 側邊欄切換按鈕 */
.btn-sidebar-toggle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-sidebar-toggle:hover {
    background-color: var(--light-color);
}

/* 點數餘額顯示 */
.points-badge {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    font-weight: 600;
    color: var(--primary-color);
}

.points-badge i {
    margin-right: 0.5rem;
}

/* 用戶下拉選單 */
.user-dropdown {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.15s ease;
}

.user-dropdown:hover {
    background-color: var(--light-color);
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.user-name {
    margin-left: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.tenant-name {
    font-size: 0.75rem;
    color: var(--secondary-color);
    margin-left: 0.5rem;
}

/* ========================================
   頁面標題
   ======================================== */

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* 麵包屑 */
.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 0;
    font-size: 0.8rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
}

/* ========================================
   頁尾
   ======================================== */

.footer {
    padding: 1rem 1.5rem;
    background-color: white;
    border-top: 1px solid #e3e6f0;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

/* ========================================
   登入頁面
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient-primary);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    padding: 2rem;
    text-align: center;
    background: var(--light-color);
    border-bottom: 1px solid #e3e6f0;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--secondary-color);
    margin-bottom: 0;
}

.login-body {
    padding: 2rem;
}

.login-footer {
    padding: 1rem 2rem;
    text-align: center;
    background: var(--light-color);
    border-top: 1px solid #e3e6f0;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

/* ========================================
   儀表板
   ======================================== */

.dashboard-stats {
    margin-bottom: 1.5rem;
}

.stat-icon-circle {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon-circle.primary {
    background-color: var(--primary-color);
}

.stat-icon-circle.success {
    background-color: var(--success-color);
}

.stat-icon-circle.info {
    background-color: var(--info-color);
}

.stat-icon-circle.warning {
    background-color: var(--warning-color);
}

/* ========================================
   行事曆
   ======================================== */

.calendar-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

/* FullCalendar 自訂樣式 */
.fc {
    font-family: var(--font-family);
}

.fc-toolbar-title {
    font-size: 1.25rem !important;
}

.fc-button-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.fc-button-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

.fc-event {
    border: none;
    padding: 2px 4px;
    font-size: 0.75rem;
}

.fc-event.status-pending {
    background-color: var(--warning-color);
}

.fc-event.status-confirmed {
    background-color: var(--primary-color);
}

.fc-event.status-completed {
    background-color: var(--success-color);
}

.fc-event.status-cancelled {
    background-color: var(--secondary-color);
}

.fc-event.status-no-show {
    background-color: var(--danger-color);
}

.fc-event.status-in-progress {
    background-color: var(--info-color);
}

/* 行事曆狀態圖例 */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #555;
}

.calendar-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ========================================
   資料表格
   ======================================== */

.data-table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.data-table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.data-table-title {
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.data-table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.data-table-body {
    padding: 0;
}

.data-table-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.data-table-info {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* ========================================
   詳情頁面
   ======================================== */

.detail-header {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.detail-subtitle {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.detail-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.detail-section-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e3e6f0;
}

.detail-section-title {
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.detail-section-body {
    padding: 1.25rem;
}

/* 資訊列表 */
.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e3e6f0;
}

.info-list li:last-child {
    border-bottom: none;
}

.info-label {
    flex: 0 0 40%;
    font-weight: 600;
    color: var(--secondary-color);
}

.info-value {
    flex: 1;
    color: var(--dark-color);
}

/* ========================================
   快速操作
   ======================================== */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--dark-color);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--primary-color);
}

.quick-action-btn i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.quick-action-btn span {
    font-weight: 600;
    font-size: 0.875rem;
}

/* ========================================
   設定頁面
   ======================================== */

.settings-nav {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 0.5rem;
}

.settings-nav .nav-link {
    color: var(--dark-color);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
}

.settings-nav .nav-link:hover {
    background-color: var(--light-color);
}

.settings-nav .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.settings-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

/* ========================================
   功能商店
   ======================================== */

.feature-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.feature-card-header {
    padding: 1.25rem;
    border-bottom: 1px solid #e3e6f0;
}

.feature-card-body {
    padding: 1.25rem;
}

.feature-card-footer {
    padding: 1rem 1.25rem;
    background: var(--light-color);
    border-top: 1px solid #e3e6f0;
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.feature-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.feature-price-unit {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* ========================================
   側邊欄設定進度環
   ======================================== */

.sidebar-setup-progress {
    padding: 0.75rem 1rem;
    flex-shrink: 0;
}

.setup-progress-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
}

.setup-progress-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.progress-ring {
    flex-shrink: 0;
}

.progress-ring-fill {
    transition: stroke-dashoffset 0.6s ease;
}

.setup-progress-label {
    font-size: 0.8rem;
    font-weight: 600;
}

#sidebar.collapsed .setup-progress-label {
    display: none;
}

#sidebar.collapsed .setup-progress-link {
    justify-content: center;
}

/* ========================================
   側邊欄店家 footer
   ======================================== */

.sidebar-footer {
    padding: 0.5rem 1rem;
    flex-shrink: 0;
}

.sidebar-footer-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.sidebar-footer-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-footer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#sidebar.collapsed .sidebar-footer-name {
    display: none;
}

#sidebar.collapsed .sidebar-footer-content {
    justify-content: center;
}

/* ========================================
   側邊欄注意圓點
   ======================================== */

.setup-attention-dot {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #f59e0b;
    animation: pulse-dot 2s ease-in-out infinite;
}

.setup-attention-dot.next-step {
    background-color: #10b981;
    animation: pulse-dot-green 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.6; transform: translateY(-50%) scale(1.3); }
}

@keyframes pulse-dot-green {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateY(-50%) scale(1.4); }
}

#sidebar.collapsed .setup-attention-dot {
    right: 6px;
    top: 8px;
    transform: none;
}

/* ========================================
   新手引導卡片
   ======================================== */

.onboarding-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius-lg, 0.75rem);
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.onboarding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem 0.75rem;
    color: white;
}

.onboarding-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.onboarding-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.25rem;
}

.onboarding-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.onboarding-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.onboarding-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 1.5rem;
    border-radius: 2px;
    overflow: hidden;
}

.onboarding-progress-fill {
    height: 100%;
    background: white;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.onboarding-body {
    padding: 1rem 1.5rem 1.25rem;
}

.onboarding-steps {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}

.onboarding-steps::-webkit-scrollbar {
    display: none;
}

.onboarding-step {
    flex: 1;
    min-width: 160px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 0.625rem;
    padding: 1rem;
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: background 0.15s, transform 0.15s;
    position: relative;
}

.onboarding-step:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: white;
}

.onboarding-step .step-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.onboarding-step .step-title {
    font-weight: 700;
    font-size: 0.875rem;
}

.onboarding-step .step-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
}

.onboarding-step .step-status {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1rem;
    opacity: 0.7;
}

.onboarding-step.completed {
    opacity: 0.55;
}

.onboarding-step.completed .step-status {
    opacity: 1;
    color: #a7f3d0;
}

.onboarding-step.next-step {
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.onboarding-step.next-step .step-status {
    opacity: 1;
    color: white;
}

.onboarding-complete {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    color: white;
}

.onboarding-complete .complete-icon {
    font-size: 2.5rem;
    color: #a7f3d0;
}

.onboarding-complete .complete-text strong {
    font-size: 1.1rem;
}

.onboarding-complete .complete-text p {
    color: rgba(255, 255, 255, 0.7);
}

/* ========================================
   響應式 - 手機 (< 576px)
   ======================================== */

@media (max-width: 575.98px) {
    /* 手機版隱藏側邊欄背景延伸 */
    #wrapper::before {
        display: none;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
        width: 260px;
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #sidebar .nav.flex-column {
        padding-bottom: 2rem;
    }

    /* 手機版隱藏進度環 */
    .sidebar-setup-progress {
        display: none !important;
    }

    /* 新手引導卡片手機版 */
    .onboarding-card {
        margin-bottom: 1rem;
    }

    .onboarding-header {
        padding: 1rem 1rem 0.5rem;
    }

    .onboarding-title {
        font-size: 0.95rem;
    }

    .onboarding-progress-bar {
        margin: 0 1rem;
    }

    .onboarding-body {
        padding: 0.75rem 1rem 1rem;
    }

    .onboarding-steps {
        gap: 0.5rem;
    }

    .onboarding-step {
        min-width: 140px;
        padding: 0.75rem;
    }

    .topbar {
        height: 3.5rem;
        padding: 0 0.75rem;
    }

    #content {
        padding: 0.75rem;
    }

    .page-header {
        margin-bottom: 1rem;
    }

    .page-title {
        font-size: 1.125rem;
    }

    .page-subtitle {
        font-size: 0.75rem;
    }

    .data-table-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .data-table-title {
        font-size: 0.875rem;
    }

    .data-table-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .data-table-actions .form-control,
    .data-table-actions .form-select {
        width: 100%;
    }

    .data-table-footer {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .quick-action-btn {
        padding: 1rem;
    }

    .quick-action-btn i {
        font-size: 1.5rem;
    }

    .quick-action-btn span {
        font-size: 0.75rem;
    }

    .points-badge,
    .tenant-name,
    .user-name {
        display: none;
    }

    .detail-header {
        padding: 1rem;
    }

    .detail-title {
        font-size: 1rem;
    }

    .detail-section-body {
        padding: 0.875rem;
    }

    .info-list li {
        flex-direction: column;
        gap: 0.25rem;
    }

    .info-label {
        flex: none;
    }

    .settings-nav {
        margin-bottom: 1rem;
    }

    .settings-nav .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .settings-content {
        padding: 1rem;
    }

    .feature-card-header,
    .feature-card-body {
        padding: 1rem;
    }

    .feature-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .feature-price {
        font-size: 1.25rem;
    }

    .login-card {
        margin: 1rem;
        max-width: none;
    }

    .login-header,
    .login-body {
        padding: 1.5rem;
    }

    .calendar-container {
        padding: 0.5rem;
    }

    .fc-toolbar-title {
        font-size: 1rem !important;
    }

    .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }
}

/* ========================================
   響應式 - 平板 (576px - 768px)
   ======================================== */

@media (min-width: 576px) and (max-width: 767.98px) {
    /* 平板小螢幕隱藏側邊欄背景延伸 */
    #wrapper::before {
        display: none;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #sidebar .nav.flex-column {
        padding-bottom: 2rem;
    }

    .topbar {
        padding: 0 1rem;
    }

    #content {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .data-table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-table-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .points-badge {
        display: none;
    }

    .tenant-name {
        display: none;
    }

    .info-list li {
        flex-direction: column;
        gap: 0.25rem;
    }

    .info-label {
        flex: none;
    }
}

/* ========================================
   響應式 - 小平板/iPad (768px - 992px)
   ======================================== */

@media (min-width: 768px) and (max-width: 991.98px) {
    /* 平板版側邊欄背景寬度同步 */
    #wrapper::before {
        width: var(--sidebar-collapsed-width);
    }

    #sidebar {
        width: var(--sidebar-collapsed-width);
    }

    #sidebar .sidebar-brand-text,
    #sidebar .sidebar-heading,
    #sidebar .nav-link span {
        display: none;
    }

    #sidebar .nav-link {
        justify-content: center;
        padding: 0.75rem;
    }

    #sidebar .nav-link i {
        margin-right: 0;
    }

    /* 平板版隱藏進度環文字和 footer 文字 */
    .setup-progress-label,
    .sidebar-footer-name {
        display: none;
    }

    .setup-progress-link,
    .sidebar-footer-content {
        justify-content: center;
    }

    .setup-attention-dot {
        right: 6px;
        top: 8px;
        transform: none;
    }

    .topbar {
        padding: 0 1rem;
    }

    #content {
        padding: 1.25rem;
    }

    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }

    .tenant-name {
        display: none;
    }
}

/* ========================================
   響應式 - 桌面 (>= 992px)
   ======================================== */

@media (min-width: 992px) {
    #sidebar:not(.collapsed) {
        width: var(--sidebar-width);
    }

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

    .quick-actions {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* ========================================
   響應式 - 大桌面 (>= 1200px)
   ======================================== */

@media (min-width: 1200px) {
    #content {
        padding: 2rem;
    }

    .data-table-header,
    .data-table-footer {
        padding: 1rem 1.5rem;
    }
}

/* ========================================
   側邊欄遮罩
   ======================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 767.98px) {
    .sidebar-overlay.show {
        display: block;
    }
}

/* ========================================
   行動版優化
   ======================================== */

/* 固定底部操作列 */
.mobile-bottom-actions {
    display: none;
}

@media (max-width: 575.98px) {
    .mobile-bottom-actions {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 0.75rem;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        gap: 0.5rem;
    }

    .mobile-bottom-actions .btn {
        flex: 1;
    }

    /* 為底部操作列預留空間 */
    .has-bottom-actions #content {
        padding-bottom: 5rem;
    }
}

/* 卡片堆疊式佈局 (手機) */
@media (max-width: 575.98px) {
    .card-stack .card {
        margin-bottom: 0.75rem;
    }

    .card-stack .card:last-child {
        margin-bottom: 0;
    }
}

/* 滑動式分頁標籤 */
.nav-tabs-scroll {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.nav-tabs-scroll .nav-item {
    flex: 0 0 auto;
}

/* 響應式網格卡片 */
.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   Rich Menu 即時預覽
   ======================================== */

.rich-menu-preview-container {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.phone-mockup {
    width: 280px;
    height: 500px;
    background-color: #000;
    border-radius: 30px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* LINE 聊天室頭部 */
.line-header {
    height: 48px;
    background: linear-gradient(180deg, #06C755 0%, #00B050 100%);
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex-shrink: 0;
}

.line-header-back {
    color: white;
    font-size: 1.2rem;
}

.line-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.line-header-name {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 10px;
    flex: 1;
}

.line-header-icons {
    display: flex;
    gap: 12px;
    color: white;
    font-size: 1rem;
}

/* LINE 聊天區域背景 */
.line-chat-area {
    flex: 1;
    background-color: #7AACB3;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 60%, rgba(255,255,255,0.08) 0%, transparent 40%),
        radial-gradient(circle at 40% 80%, rgba(255,255,255,0.06) 0%, transparent 30%);
    position: relative;
    overflow: hidden;
}

.line-chat-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.65rem;
    padding: 4px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Rich Menu 預覽區域 */
.rich-menu-preview {
    height: 90px;
    background-color: #1DB446;
    flex-shrink: 0;
    display: grid;
    gap: 1px;
    padding: 1px;
    transition: background-color 0.3s ease;
    position: relative;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 3+4 佈局：上排 3 格、下排 4 格 */
.rich-menu-preview.layout-3x4 {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 1fr 1fr;
}
.rich-menu-preview.layout-3x4 .cell-row1 { grid-column: span 4; }
.rich-menu-preview.layout-3x4 .cell-row2 { grid-column: span 3; }

.rich-menu-preview.theme-GREEN { background-color: #1DB446; }
.rich-menu-preview.theme-BLUE { background-color: #2196F3; }
.rich-menu-preview.theme-PURPLE { background-color: #9C27B0; }
.rich-menu-preview.theme-ORANGE { background-color: #FF5722; }
.rich-menu-preview.theme-DARK { background-color: #263238; }

.rich-menu-cell {
    background-color: rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.65rem;
    text-align: center;
    padding: 4px;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 2;
}

.rich-menu-cell:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.rich-menu-cell-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
    line-height: 1;
}

.rich-menu-cell-text {
    font-weight: 600;
    line-height: 1.2;
    font-size: 0.7rem;
}

/* 自訂圖片預覽疊層 */
.rich-menu-custom-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    z-index: 0;
}

/* 自訂圖片模式：顯示背景圖 + 描邊文字（不遮蓋背景） */
.rich-menu-preview.has-custom-image .rich-menu-custom-image {
    display: block;
}

.rich-menu-preview.has-custom-image .rich-menu-cell {
    background-color: transparent;
}

.rich-menu-preview.has-custom-image .rich-menu-cell-icon,
.rich-menu-preview.has-custom-image .rich-menu-cell-text {
    text-shadow: -2px -2px 0 var(--rm-outline, #000),
                  2px -2px 0 var(--rm-outline, #000),
                 -2px  2px 0 var(--rm-outline, #000),
                  2px  2px 0 var(--rm-outline, #000),
                  0   -2px 0 var(--rm-outline, #000),
                  0    2px 0 var(--rm-outline, #000),
                 -2px  0   0 var(--rm-outline, #000),
                  2px  0   0 var(--rm-outline, #000);
    color: var(--rm-text-color, #fff);
}

/* 手機底部導航列 */
.phone-bottom-bar {
    height: 28px;
    background-color: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-top: 1px solid #e0e0e0;
}

.phone-home-indicator {
    width: 80px;
    height: 4px;
    background-color: #333;
    border-radius: 2px;
}

/* 預覽說明文字 */
.preview-label {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* ========================================
   Rich Menu 模式切換 Tab
   ======================================== */

.rich-menu-mode-tabs {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--primary-color, #4361ee);
}

.rich-menu-mode-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #fff;
    color: var(--primary-color, #4361ee);
}

.rich-menu-mode-tab.active {
    background-color: var(--primary-color, #4361ee);
    color: #fff;
}

.rich-menu-mode-tab:not(.active):hover {
    background-color: rgba(67, 97, 238, 0.1);
}

/* ========================================
   自訂模式 - 佈局選擇器
   ======================================== */

.layout-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.layout-option {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.layout-option:hover {
    border-color: #adb5bd;
}

.layout-option.active {
    border-color: var(--primary-color, #4361ee);
    background-color: rgba(67, 97, 238, 0.05);
}

.layout-label {
    font-size: 0.65rem;
    color: #6c757d;
    margin-top: 4px;
    font-weight: 600;
}

.layout-mini {
    display: grid;
    gap: 1px;
    background: #dee2e6;
    height: 32px;
    border-radius: 3px;
    overflow: hidden;
}

.layout-mini > div {
    background: #adb5bd;
}

/* 各佈局的 mini 預覽 */
.layout-mini-3x4 {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 1fr 1fr;
}
.layout-mini-3x4 > div:nth-child(-n+3) { grid-column: span 4; }
.layout-mini-3x4 > div:nth-child(n+4) { grid-column: span 3; }

.layout-mini-2x3 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
}

.layout-mini-2x3-top2 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: 1fr 1fr;
}
.layout-mini-2x3-top2 > div:nth-child(-n+2) { grid-column: span 3; }
.layout-mini-2x3-top2 > div:nth-child(n+3) { grid-column: span 2; }

.layout-mini-2x2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr 1fr;
}

.layout-mini-1x2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr 1fr;
}
.layout-mini-1x2 > div:first-child { grid-column: span 2; }

/* ========================================
   自訂模式 - 預覽
   ======================================== */

.rich-menu-custom-preview {
    height: 90px;
    flex-shrink: 0;
    position: relative;
    background: #263238;
    overflow: hidden;
}

.rich-menu-custom-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.rich-menu-area-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.rich-menu-area-number {
    position: absolute;
    z-index: 3;
    background: rgba(67, 97, 238, 0.75);
    color: white;
    font-weight: bold;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
}

.rich-menu-area-border {
    position: absolute;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-sizing: border-box;
}

/* 響應式調整 */
@media (max-width: 575.98px) {
    .rich-menu-preview-container {
        padding: 0.5rem 0;
    }

    .phone-mockup {
        width: 240px;
        height: 420px;
        border-radius: 25px;
        padding: 8px;
    }

    .phone-screen {
        border-radius: 18px;
    }

    .line-header {
        height: 40px;
    }

    .rich-menu-preview {
        height: 75px;
    }

    .rich-menu-custom-preview {
        height: 75px;
    }

    .rich-menu-cell-icon {
        font-size: 0.85rem;
    }

    .rich-menu-cell-text {
        font-size: 0.5rem;
    }

    .layout-selector {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Flex Menu 主選單預覽
   ======================================== */

.flex-menu-preview-container {
    display: flex;
    justify-content: center;
}

.flex-menu-phone-mockup {
    width: 280px;
    background: #e5ddd5;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.flex-menu-bubble {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.flex-menu-header {
    background-color: #1DB446;
    padding: 16px;
    text-align: center;
    transition: background-color 0.2s;
}

.flex-menu-header-title {
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
}

.flex-menu-header-subtitle {
    color: #fff;
    font-size: 0.7rem;
    margin-top: 4px;
    opacity: 0.9;
}

.flex-menu-tip {
    background: #F5F5F5;
    margin: 12px;
    padding: 8px 10px;
    border-radius: 6px;
}

.flex-menu-tip-title {
    font-size: 0.7rem;
    font-weight: bold;
    color: #333;
}

.flex-menu-tip-text {
    font-size: 0.6rem;
    color: #666;
    margin-top: 2px;
}

.flex-menu-buttons {
    padding: 8px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flex-menu-btn {
    border-radius: 6px;
    padding: 8px 10px;
    color: #fff;
    cursor: default;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
}

.flex-menu-btn.full {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.flex-menu-btn.full .flex-menu-btn-title {
    font-size: 0.75rem;
    font-weight: bold;
}

.flex-menu-btn.full .flex-menu-btn-sub {
    font-size: 0.6rem;
    opacity: 0.9;
}

.flex-menu-btn.compact {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
}

.flex-menu-btn.compact .flex-menu-btn-title {
    font-size: 0.68rem;
    font-weight: bold;
}

.flex-menu-btn-row {
    display: flex;
    gap: 6px;
}

.flex-menu-btn-title {
    font-size: 0.75rem;
    font-weight: bold;
}

.flex-menu-btn-sub {
    font-size: 0.6rem;
    opacity: 0.85;
}

/* 按鈕設定列表 */
.flex-btn-setting {
    background: #fafafa;
}

.flex-btn-setting .form-control-color {
    cursor: pointer;
}

/* RWD */
@media (max-width: 576px) {
    .flex-menu-phone-mockup {
        width: 100%;
        max-width: 280px;
    }
}

/* ========================================
   進階自訂 Rich Menu
   ======================================== */

/* 大尺寸佈局 mini 預覽（3行） */
.layout-mini-3row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1px;
    background: #dee2e6;
    height: 48px;
    border-radius: 3px;
    overflow: hidden;
}

.layout-mini-3row > div {
    background: #adb5bd;
}

/* 每格設定區塊 */
.adv-cell-settings .border {
    transition: border-color 0.15s;
}

.adv-cell-settings .border:hover {
    border-color: var(--primary-color) !important;
}

.adv-cell-settings .adv-cell-label {
    font-size: 0.8rem;
}

.adv-cell-settings .adv-cell-action {
    font-size: 0.75rem;
}

/* Flex 彈窗 Modal 卡片 */
#flexPopupBubbles .card {
    border-color: #e0e0e0;
}

#flexPopupBubbles .card-header {
    background: #f8f9fa;
    padding: 0.5rem 0.75rem;
}

#flexPopupBubbles .card-body {
    padding: 0.75rem;
}

/* 進階自訂 Rich Menu 即時預覽 */
.rich-menu-advanced-preview {
    position: relative;
    width: 100%;
    height: 70px;
    overflow: hidden;
    border-radius: 0;
}

.adv-preview-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F5F0E8;
}

.adv-preview-cells {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.adv-preview-cell {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.adv-preview-cell-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0.5px solid rgba(255,255,255,0.4);
    pointer-events: none;
}

.adv-preview-cell-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1px;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.adv-preview-cell-label {
    font-size: 6px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.adv-preview-cell-num {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 5px;
    color: rgba(255,255,255,0.6);
    font-weight: bold;
    z-index: 2;
}
