/* 全局樣式 */
html,
body {
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

body {
    padding-top: 0 !important;
    /* 移除頂部 padding，因為 header 在父頁面 */
    overflow-y: auto;
    /* 啟用滾動 */
}

.container-fluid {
    min-height: 100vh;
    padding: var(--spacing);
    display: flex;
    flex-direction: column;
    max-width: 2200px;
    margin-bottom: 30px;
    height: auto;
}

/* 頁面頭部 */
.page-header {
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
    margin-bottom: var(--spacing);
    display: flex;
    align-items: center;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1));
}

.page-header h2 {
    position: relative;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.page-header img {
    height: var(--header-height);
}

/* 添加日曆相關樣式 */
.date-group {
    position: relative;
    width: 100%;
}

.calendar {
    display: none;
    opacity: 0;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-10px);
}

.calendar.show {
    visibility: block;
    opacity: 1;
    transform: translateY(0);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.calendar-header span {
    font-weight: 500;
    color: var(--text-primary);
}

.prev-month,
.next-month {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    position: relative;
    cursor: pointer;
}

.prev-month::before,
.next-month::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-left: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.prev-month::before {
    transform: translate(-25%, -50%) rotate(45deg);
}

.next-month::before {
    transform: translate(-75%, -50%) rotate(225deg);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}

.day-header {
    font-weight: 500;
    color: var(--text-primary);
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.day-header.sunday {
    color: #ff4444;
}

.day {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.day:hover:not(.disabled) {
    background-color: rgba(128, 190, 231, 0.1);
}

.day.selected {
    background-color: var(--primary-color);
    color: white;
}

.day.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.day.sunday {
    color: #ff4444;
}

.day.sunday.selected {
    color: white;
}

.input-wrapper {
    position: relative;
}

.form-control[readonly] {
    background-color: white;
    cursor: pointer;
}

/* 主要內容區域 */
.main-content {
    height: var(--search-stats-height);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing);
    margin-bottom: var(--spacing);
}

.search-section {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
}

.search-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

.search-item {
    flex: 1;
    min-width: 0;
}

.dropdown-filter {
    position: relative;
    width: 100%;
}

.dropdown-filter .input-group {
    cursor: pointer;
}

.dropdown-filter .form-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 10px;
    cursor: pointer;
    user-select: none;
}

.dropdown-filter .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 2px;
    padding: 8px;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .1);
    z-index: 1000;
    display: none;
}

.dropdown-filter .dropdown-menu.show {
    display: block;
}

.dropdown-filter .dropdown-item {
    padding: 8px;
    cursor: pointer;
}

.dropdown-filter .dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-filter .dropdown-item label {
    display: flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    width: 100%;
}

.dropdown-filter .dropdown-item input[type="checkbox"] {
    margin-right: 8px;
}

/* 下拉箭頭樣式 */
.dropdown-filter .bi-chevron-down {
    transition: transform 0.2s ease;
}

.dropdown-filter.active .bi-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 0.5rem 0;
}

.dropdown-item {
    padding: 8px;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item:first-child {
    font-weight: 500;
}

.dropdown-item label {
    display: flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    width: 100%;
}

.dropdown-item input[type="checkbox"] {
    margin-right: 8px;
}

.row {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: center;
}

.col-md-6,
.col-md-3 {
    padding: 0;
}

.col-md-6 {
    width: 42%;
}

.col-md-3 {
    width: 28%;
}

.stats-container {
    display: flex;
    gap: 0.75rem;
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.stats-item {
    flex: 1;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: 1px solid var(--accent-color);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: white;
}

.stats-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 6px rgba(128, 190, 231, 0.2);
}

.stats-number {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
    line-height: 1;
}

.stats-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1;
}

/* 表單控件 */
.form-control,
.form-select,
.input-group {
    height: var(--input-height);
    line-height: 1.5;
    font-size: 0.875rem;
    width: 100%;
    box-sizing: border-box;
}

.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-color);
    padding: 0.5rem 0.75rem;
    transition: var(--transition);
    box-shadow: none;
}

.input-group {
    display: flex;
    align-items: center;
}

.input-group-text {
    height: var(--input-height);
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background-color: var(--primary-light);
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    flex-shrink: 0;
}

.form-select {
    padding-right: 2rem;
    background-position: right 0.75rem center;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px rgba(128, 190, 231, 0.2);
    border-color: var(--primary-color);
    outline: none;
}

/* 表格樣式 */
.table {
    table-layout: fixed;
    width: 100%;
}

.table th,
.table td {
    /*      white-space: nowrap; */
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* 日期欄位 - 調整為更寬 */
.table th:nth-child(1),
.table td:nth-child(1) {
    width: 140px;
    min-width: 140px;
}

/* 時間欄位 - 調整為更寬 */
.table th:nth-child(2),
.table td:nth-child(2) {
    width: 120px;
    min-width: 120px;
}

.table th:nth-child(3),
.table td:nth-child(3) {
    width: 180px;
}

.table th:nth-child(4),
.table td:nth-child(4) {
    width: 150px;
}

.table th:nth-child(5),
.table td:nth-child(5) {
    width: 120px;
}

.table th:nth-child(6),
.table td:nth-child(6) {
    width: 100px;
}

.table th:nth-child(7),
.table td:nth-child(7) {
    width: 80px;
}

.table th:nth-child(8),
.table td:nth-child(8) {
    width: 100px;
}

.table th:nth-child(9),
.table td:nth-child(9) {
    width: 120px;
}



.table th:nth-child(11),
.table td:nth-child(11) {
    width: 120px;
}


.table th:nth-child(13),
.table td:nth-child(13) {
    width: auto;
}

.table td {
    position: relative;
}

.table td[title] {
    cursor: help;
}

.table .btn {
    padding: 0.25rem 0.5rem;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.weekday-text {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: normal;
}

.table thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 0.75rem;
    border: none;
    position: sticky;
    top: 0;
    z-index: 1;
    height: var(--table-row-height);
    font-size: 0.9rem;
}

.table tbody tr {
    height: var(--table-row-height);
    transition: var(--transition);
    border-bottom: 1px solid var(--accent-color);
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

.badge {
    padding: 0.4em 0.8em;
    font-weight: 500;
    border-radius: 30px;
    font-size: 0.75rem;
}

.venue-card-title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 按鈕樣式 */
.btn-outline-primary {
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 500;
    transition: var(--transition);
    border-radius: var(--border-radius);
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    height: var(--input-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    cursor: pointer;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(128, 190, 231, 0.3);
}

.btn-secondary {
    background-color: var(--text-secondary);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.button-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.details-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(128, 190, 231, 0.2);
    cursor: pointer;
}

.details-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(128, 190, 231, 0.3);
}

.details-btn i {
    font-size: 16px;
}

.venue-map-btn {
    background-color: #EA4335;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(234, 67, 53, 0.2);
}

.venue-map-btn:hover {
    background-color: #C5221F;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(234, 67, 53, 0.3);
    color: white;
}

.venue-map-btn i {
    font-size: 16px;
}

.whatsapp-btn {
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(37, 211, 102, 0.2);
}

.whatsapp-btn:hover {
    background-color: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn i {
    font-size: 16px;
}

/* 新增禁用聯絡按鈕的樣式 */
.whatsapp-btn.disabled {
    background-color: #ababab;
    cursor: not-allowed;
    opacity: 0.6;
}

.whatsapp-btn.disabled:hover {
    background-color: #ababab;
}

/* 修改分頁容器樣式 */
.pagination {
    margin-bottom: 0;
    display: flex;
    justify-content: center;
    gap: 0.25rem;
}

/* 分頁按鈕樣式 */
.page-item {
    margin: 0;
}

.page-link {
    color: var(--primary-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.875rem;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.page-link:hover {
    background-color: rgba(128, 190, 231, 0.1);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(128, 190, 231, 0.3);
    color: white;
}

.page-item.disabled .page-link {
    color: var(--text-secondary);
    pointer-events: none;
    background-color: #f8f9fa;
}

/* 模態框樣式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    margin: 1.75rem auto;
    max-width: 500px;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--accent-color);
    background-color: var(--primary-color);
    color: white;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.modal-body {
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--accent-color);
}

.btn-close-white {
    filter: brightness(0) invert(1);
}

.modal pre {
    background-color: rgba(128, 190, 231, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 文字樣式 */
.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.fw-medium {
    font-weight: 500 !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.text-end {
    text-align: right !important;
}

.g-3 {
    gap: 1rem;
}

/* 背景顏色 */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.bg-level {
    background-color: var(--level-color) !important;
}

.bg-region {
    background-color: var(--region-color) !important;
}

.bg-district {
    background-color: var(--district-color) !important;
}

/* 視圖切換按鈕 */
.view-toggle-container {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem;
}

.btn-group {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.btn-toggle {
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-color);
    background: white;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-toggle:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.btn-toggle:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.btn-toggle.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-toggle:hover:not(.active) {
    background: var(--accent-color);
    color: var(--text-primary);
}

/* 控制按鈕容器 */
.controls-container {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.source-toggle-container {
    flex-grow: 1;
    margin-bottom: 0.5rem;
}

/* 來源切換按鈕組 */
.source-toggle-container .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

/* 來源按鈕樣式 */
.btn-source {
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    min-width: 90px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 「全部」按鈕樣式 */
.btn-source[data-source="all"] {
    background-color: #f8f9fa;
    color: #6c757d;
}

.btn-source[data-source="all"].active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

/* 「WhatsApp」按鈕樣式 */
.btn-source[data-source="venues"] {
    background-color: #f8f9fa;
    color: #25D366;
}

.btn-source[data-source="venues"].active {
    background-color: #25D366;
    border-color: #25D366;
    color: white;
}

/* 「Website」按鈕樣式 */
.btn-source[data-source="venues2"] {
    background-color: #f8f9fa;
    color: #0d6efd;
}

.btn-source[data-source="venues2"].active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

/* 「LID」按鈕樣式 */
.btn-source[data-source="venues_lid"] {
    background-color: #f8f9fa;
    color: #0088cc;
}

.btn-source[data-source="venues_lid"].active {
    background-color: #0088cc;
    border-color: #0088cc;
    color: white;
}

/* 「訊息提取」按鈕樣式 */
.btn-source[data-source="message-extracted"] {
    background-color: #f8f9fa;
    color: #fd7e14;
}

.btn-source[data-source="message-extracted"].active {
    background-color: #fd7e14;
    border-color: #fd7e14;
    color: white;
}

/* 「無電話」按鈕樣式 */
.btn-source[data-source="no-phone"] {
    background-color: #f8f9fa;
    color: #dc3545;
}

.btn-source[data-source="no-phone"].active {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* 按鈕懸停效果 */
.btn-source:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 按鈕圖標樣式 */
.btn-source i {
    font-size: 1rem;
}

/* 視圖切換按鈕容器 */
.view-toggle-container {
    margin-bottom: 0.5rem;
}

/* 視圖切換按鈕組 */
.view-toggle-container .btn-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 視圖按鈕樣式 */
.btn-toggle {
    background-color: #f8f9fa;
    color: #6c757d;
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

/* 視圖按鈕激活樣式 */
.btn-toggle.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* 表格視圖樣式分離 - 管理員與普通用戶 */
.admin-view th:nth-child(4),
.admin-view th:nth-child(5) {
    min-width: 100px;
    max-width: 150px;
}

.admin-view td:nth-child(4),
.admin-view td:nth-child(5) {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-view .group-badge,
.admin-view .source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    white-space: normal;
    text-align: left;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
}

/* 日期 */
.user-view th:nth-child(1),
.user-view td:nth-child(1) {
    width: 150px;
    min-width: 150px;
}

/* 時間 */
.user-view th:nth-child(2),
.user-view td:nth-child(2) {
    width: 130px;
    min-width: 130px;
}

/* 場地 */
.user-view th:nth-child(3),
.user-view td:nth-child(3) {
    width: 200px;
    min-width: 180px;
}

/* 區域 */
.user-view th:nth-child(4),
.user-view td:nth-child(4) {
    width: 100px;
    min-width: 90px;
}

/* 分區 */
.user-view th:nth-child(5),
.user-view td:nth-child(5) {
    width: 120px;
    min-width: 110px;
}

/* 費用 */
.user-view th:nth-child(6),
.user-view td:nth-child(6) {
    width: 100px;
    min-width: 90px;
}

/* 等級 */
.user-view th:nth-child(7),
.user-view td:nth-child(7) {
    width: 120px;
    min-width: 110px;
}

/* 人數 */
.user-view th:nth-child(8),
.user-view td:nth-child(8) {
    width: 80px;
    min-width: 70px;
}

/* 球種 */
.user-view th:nth-child(9),
.user-view td:nth-child(9) {
    width: 100px;
    min-width: 90px;
}

/* 備註列 - 使用剩餘空間 */
.user-view th:nth-child(10),
.user-view td:nth-child(10) {
    width: auto;
    min-width: 150px;
    max-width: 400px;
}

/* 詳情按鈕列 */
.user-view th:nth-child(11),
.user-view td:nth-child(11) {
    width: 180px;
    min-width: 180px;
}

/* 偵錯按鈕樣式 */
.debug-btn {
    padding: 6px 12px;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.debug-btn:hover {
    background-color: #138496;
}

.debug-btn i {
    font-size: 1rem;
}

/* 電話映射按鈕樣式 */
.map-btn {
    padding: 6px 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.map-btn:hover {
    background-color: #5a6268;
}

.map-btn i {
    font-size: 1rem;
}

/* 調整按鈕組中的間距 */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 確保模態框內容溢出時可滾動 */
.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* LID 映射信息的樣式 */
.alert-success {
    background-color: rgba(25, 135, 84, 0.15);
    border-color: rgba(25, 135, 84, 0.2);
    color: #198754;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.2);
    color: #664d03;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.alert strong {
    font-weight: 600;
}

/* 非管理員用戶的統一樣式 */
.source-unified {
    border-left: 4px solid var(--primary-color) !important;
}

.source-unified .venue-card-header {
    background: linear-gradient(to right, rgba(128, 190, 231, 0.1), transparent);
}

.source-unified .venue-card-title {
    color: var(--primary-color);
}

.table .source-unified td:first-child {
    border-left: 4px solid var(--primary-color);
}

.source-unified .status-indicator {
    background-color: rgba(128, 190, 231, 0.1);
    color: var(--primary-color);
}

.source-unified .badge.bg-region,
.source-unified .badge.bg-district {
    background-color: rgba(128, 190, 231, 0.2) !important;
    color: var(--primary-dark);
}

.source-unified:hover {
    box-shadow: 0 0 15px rgba(128, 190, 231, 0.2);
}

/* 群組和來源列樣式 */
.group-badge,
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    white-space: normal;
    text-align: left;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
}

/* 表格中寬度限制，避免過寬 */
.table th:nth-child(4),
.table th:nth-child(5) {
    min-width: 100px;
    max-width: 150px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --search-stats-height: auto;
        --spacing: 0.5rem;
    }

    html,
    body {
        overflow: auto;
        height: auto;
    }

    .container-fluid {
        height: auto;
        min-height: 100vh;
        padding: 0.5rem;
    }

    /* 關鍵修改：將主內容區域改為上下排列 */
    .main-content {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* 確保搜尋區域和統計區域佔滿整行 */
    .search-section,
    .stats-container {
        width: 100%;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* 搜尋行改為縱向排列 */
    .search-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-item {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    /* 統計區域改為網格布局 */
    .stats-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stats-item {
        flex: unset;
        width: 100%;
        padding: 0.5rem;
        margin: 0;
    }

    /* 調整統計數字和標籤大小 */
    .stats-number {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

    .stats-label {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .calendar {
        width: 100%;
    }

    .search-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-item {
        width: 100%;
    }

    .page-header {
        padding: 1rem;
    }

    .page-header h2 {
        font-size: 1.25rem;
    }

    .row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .col-md-6,
    .col-md-3 {
        width: 100%;
    }

    .stats-container {
        flex-wrap: wrap;
    }

    .stats-item {
        flex: 1 1 45%;
    }

    .table-container {
        height: auto;
        padding: 0.5rem;
        box-shadow: none;
        background: transparent;
    }

    .table td,
    .table th {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .row.mt-4 .col-12 {
        flex-direction: column;
        gap: 1rem;
    }

    .row.mt-4 .text-end {
        text-align: center !important;
    }

    .view-toggle-container {
        display: none;
    }

    .table-responsive {
        display: none;
    }

    .card-view {
        width: 100%;
    }

    .venue-card {
        display: block;
    }

    .row.mt-4 {
        flex-direction: column-reverse;
    }

    .search-section {
        height: auto;
        padding: 1rem;
    }

    .stats-container {
        height: auto;
        padding: 1rem;
    }

    .main-content {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .search-section,
    .stats-container {
        padding: 0.75rem;
        margin-bottom: 0;
    }

    .pagination {
        gap: 0.125rem;
    }

    .page-link {
        min-width: 32px;
        height: 32px;
        padding: 0;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #pageInfo {
        font-size: 0.75rem;
    }

    .row.mt-4 .w-25 {
        width: 100% !important;
        text-align: center;
    }
}

/* 資料來源標籤樣式 */
.source-label {
    margin-left: 5px;
    font-size: 0.7em;
    vertical-align: middle;
}

.table .source-label {
    margin-left: 8px;
    font-size: 0.65em;
    padding: 3px 6px;
}

/* WhatsApp 來源樣式 */
.source-whatsapp {
    border-left: 4px solid #25D366 !important;
}

.source-whatsapp .venue-card-header {
    background: linear-gradient(to right, rgba(37, 211, 102, 0.1), transparent);
}

.source-whatsapp .venue-card-title {
    color: #075E54;
}

/* .source-whatsapp .whatsapp-btn {
    background-color: #25D366;
} */

/* Website 來源樣式 */
.source-website {
    border-left: 4px solid #0088cc !important;
}

.source-website .venue-card-header {
    background: linear-gradient(to right, rgba(0, 136, 204, 0.1), transparent);
}

.source-website .venue-card-title {
    color: #0088cc;
}

/* .source-website .whatsapp-btn {
    background-color: #0088cc;
} */

/* @lid 來源樣式 */
.source-lid {
    border-left: 4px solid #FF6B6B !important;
}

.source-lid .venue-card-header {
    background: linear-gradient(to right, rgba(255, 107, 107, 0.1), transparent);
}

.source-lid .venue-card-title {
    color: #FF6B6B;
}

/* .source-lid .whatsapp-btn {
    background-color: #FF6B6B;
} */

/* 表格視圖的樣式 */
.table .source-whatsapp td:first-child {
    border-left: 4px solid #25D366;
}

.table .source-website td:first-child {
    border-left: 4px solid #0088cc;
}

.table .source-lid td:first-child {
    border-left: 4px solid #FF6B6B;
}

/* 來源標籤樣式 */
.source-label {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
}

.source-whatsapp .source-label {
    background-color: #25D366 !important;
    color: white;
}

.source-website .source-label {
    background-color: #0088cc !important;
    color: white;
}

.source-lid .source-label {
    background-color: #FF6B6B !important;
    color: white;
}

/* 懸停效果 */
.venue-card.source-whatsapp:hover {
    box-shadow: 0 0 15px rgba(37, 211, 102, 0.2);
}

.venue-card.source-website:hover {
    box-shadow: 0 0 15px rgba(0, 136, 204, 0.2);
}

.venue-card.source-lid:hover {
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.2);
}

/* 狀態指示器樣式 */
.source-whatsapp .status-indicator {
    background-color: rgba(37, 211, 102, 0.1);
    color: #075E54;
}

.source-website .status-indicator {
    background-color: rgba(0, 136, 204, 0.1);
    color: #0088cc;
}

.source-lid .status-indicator {
    background-color: rgba(255, 107, 107, 0.1);
    color: #FF6B6B;
}

/* 徽章樣式 */
.source-whatsapp .badge.bg-region,
.source-whatsapp .badge.bg-district {
    background-color: rgba(37, 211, 102, 0.2) !important;
    color: #075E54;
}

.source-website .badge.bg-region,
.source-website .badge.bg-district {
    background-color: rgba(0, 136, 204, 0.2) !important;
    color: #0088cc;
}

.source-lid .badge.bg-region,
.source-lid .badge.bg-district {
    background-color: rgba(255, 107, 107, 0.2) !important;
    color: #FF6B6B;
}

/* 偵錯按鈕樣式 */
.debug-btn {
    padding: 6px 12px;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.debug-btn:hover {
    background-color: #138496;
}

.debug-btn i {
    font-size: 1rem;
}

/* 電話映射按鈕樣式 */
.map-btn {
    padding: 6px 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.map-btn:hover {
    background-color: #5a6268;
}

.map-btn i {
    font-size: 1rem;
}

/* 調整按鈕組中的間距 */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 確保模態框內容溢出時可滾動 */
.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* LID 映射信息的樣式 */
.alert-success {
    background-color: rgba(25, 135, 84, 0.15);
    border-color: rgba(25, 135, 84, 0.2);
    color: #198754;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.2);
    color: #664d03;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.alert strong {
    font-weight: 600;
}

/* 非管理員用戶的統一樣式 */
.source-unified {
    border-left: 4px solid var(--primary-color) !important;
}

.source-unified .venue-card-header {
    background: linear-gradient(to right, rgba(128, 190, 231, 0.1), transparent);
}

.source-unified .venue-card-title {
    color: var(--primary-color);
}

.table .source-unified td:first-child {
    border-left: 4px solid var(--primary-color);
}

.source-unified .status-indicator {
    background-color: rgba(128, 190, 231, 0.1);
    color: var(--primary-color);
}

.source-unified .badge.bg-region,
.source-unified .badge.bg-district {
    background-color: rgba(128, 190, 231, 0.2) !important;
    color: var(--primary-dark);
}

.source-unified:hover {
    box-shadow: 0 0 15px rgba(128, 190, 231, 0.2);
}

/* 群組和來源列樣式 */
.group-badge,
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    white-space: normal;
    text-align: left;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
}

/* 表格中寬度限制，避免過寬 */
.table th:nth-child(4),
.table th:nth-child(5) {
    min-width: 100px;
    max-width: 150px;
}

/* 表格視圖樣式分離 - 管理員與普通用戶 */
.admin-view th:nth-child(4),
.admin-view th:nth-child(5) {
    min-width: 100px;
    max-width: 150px;
}

.admin-view td:nth-child(4),
.admin-view td:nth-child(5) {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-view .group-badge,
.admin-view .source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    white-space: normal;
    text-align: left;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
}

/* 響應式 - 日期 */
.user-view th:nth-child(1),
.user-view td:nth-child(1) {
    width: 150px;
    min-width: 150px;
}

/* 響應式 - 時間 */
.user-view th:nth-child(2),
.user-view td:nth-child(2) {
    width: 130px;
    min-width: 130px;
}

/* 響應式 - 場地 */
.user-view th:nth-child(3),
.user-view td:nth-child(3) {
    width: 200px;
    min-width: 180px;
}

/* 響應式 - 區域 */
.user-view th:nth-child(4),
.user-view td:nth-child(4) {
    width: 100px;
    min-width: 90px;
}

/* 響應式 - 分區 */
.user-view th:nth-child(5),
.user-view td:nth-child(5) {
    width: 120px;
    min-width: 110px;
}

/* 響應式 - 費用 */
.user-view th:nth-child(6),
.user-view td:nth-child(6) {
    width: 100px;
    min-width: 90px;
}

/* 響應式 - 等級 */
.user-view th:nth-child(7),
.user-view td:nth-child(7) {
    width: 120px;
    min-width: 110px;
}

/* 響應式 - 人數 */
.user-view th:nth-child(8),
.user-view td:nth-child(8) {
    width: 80px;
    min-width: 70px;
}

/* 響應式 - 球種 */
.user-view th:nth-child(9),
.user-view td:nth-child(9) {
    width: 100px;
    min-width: 90px;
}

/* 響應式 - 備註列使用剩餘空間 */
.user-view th:nth-child(10),
.user-view td:nth-child(10) {
    width: auto;
    min-width: 150px;
    max-width: 400px;
}

/* 響應式 - 詳情按鈕列 */
.user-view th:nth-child(11),
.user-view td:nth-child(11) {
    width: 180px;
    min-width: 180px;
}