/**
 * 2meet Vendor Dashboard — Mobile UI/UX Optimizations
 *
 * 載入條件：所有 /account/ 頁面（含 courses、bookings 子頁）
 * 覆蓋三個插件（infocards / courses / bookings）的 dashboard view
 *
 * @since 5.33.0
 */

/* ============================================================
   1. SIDEBAR 手機版收合 Toggle
   - Desktop：隱藏 toggle button，sidebar 正常顯示
   - ≤768px：sidebar 預設隱藏，點擊 toggle 才展開
   ============================================================ */

/* Desktop：toggle button 不顯示 */
.tmg-mobile-nav-toggle {
	display: none;
}

@media (max-width: 768px) {
	/* Sidebar 預設隱藏（!important 確保覆蓋 HivePress grid flex 規則）*/
	.hp-page__sidebar {
		display: none !important;
	}
	/* 展開狀態（JS 直接設 inline style，此規則作為 fallback）*/
	.hp-page.tmg-sidebar-open .hp-page__sidebar {
		display: block !important;
		margin-bottom: 20px;
	}
	/* Toggle button */
	.tmg-mobile-nav-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 6px;
		margin-bottom: 16px;
		padding: 10px 16px;
		width: 100%;
		background: var(--hp-color-primary, #4a90d9);
		color: #fff;
		border: none;
		border-radius: 6px;
		font-size: 14px;
		font-weight: 600;
		cursor: pointer;
		text-align: center;
	}
	.tmg-mobile-nav-toggle:hover {
		opacity: 0.9;
	}
}

/* ============================================================
   2. TABLE → CARD LAYOUT (≤640px)
   需搭配 <td data-label="欄位名稱"> 屬性
   涵蓋：
   - .tmeetic-orders__table（infocards 訂單）
   - .tmeetic-table（infocards / courses 通用）
   - .tmb-table（bookings 預約/服務）
   ============================================================ */

@media (max-width: 640px) {

	/* Table 轉為 block 容器 */
	.tmeetic-orders__table,
	.tmeetic-table,
	.tmb-table {
		display: block;
		width: 100%;
	}

	/* thead 隱藏（欄位名稱改由 data-label 顯示） */
	.tmeetic-orders__table thead,
	.tmeetic-table thead,
	.tmb-table thead {
		display: none;
	}

	.tmeetic-orders__table tbody,
	.tmeetic-table tbody,
	.tmb-table tbody {
		display: block;
	}

	/* 每一列變成卡片 */
	.tmeetic-orders__table tr,
	.tmeetic-table tr,
	.tmb-table tr {
		display: block;
		border: 1px solid #e0e0e0;
		border-radius: 8px;
		margin-bottom: 12px;
		padding: 4px 0;
		background: #fff;
		box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	}

	/* 每個 cell：flex 並排 label + 值 */
	.tmeetic-orders__table td,
	.tmeetic-table td,
	.tmb-table td {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 8px;
		padding: 7px 14px;
		border-bottom: 1px solid #f5f5f5;
		white-space: normal;
		font-size: 13px;
		min-width: 0;
	}

	/* 最後一個 cell 無底線 */
	.tmeetic-orders__table td:last-child,
	.tmeetic-table td:last-child,
	.tmb-table td:last-child {
		border-bottom: none;
	}

	/* data-label 欄位標題（由 ::before pseudo-element 顯示） */
	.tmeetic-orders__table td[data-label]::before,
	.tmeetic-table td[data-label]::before,
	.tmb-table td[data-label]::before {
		content: attr(data-label);
		font-weight: 600;
		color: #6c757d;
		font-size: 11px;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		flex-shrink: 0;
		min-width: 88px;
		padding-top: 2px;
	}

	/* table wrap 在 card 模式不需橫向捲動 */
	.tmeetic-orders__table-wrap,
	.tmeetic-table-wrapper {
		overflow-x: visible;
	}

	/* 操作欄（actions）垂直排列 */
	.tmb-actions,
	.tmeetic-table__actions {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
		white-space: normal;
	}

	/* 操作欄按鈕靠右對齊 */
	.tmeetic-orders__table td[data-label="操作"],
	.tmeetic-table td[data-label="操作"],
	.tmb-table td[data-label="操作"] {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ============================================================
   3. iCal URL 輸入框 min-width 修正
   my-bookings.php 和 booking-settings.php 的 inline style
   設有 min-width:200px，在小螢幕造成 overflow
   ============================================================ */

@media (max-width: 640px) {
	.tmb-ical-bar input[type="text"] {
		min-width: 0 !important;
		width: 100%;
	}
}

/* ============================================================
   4. 按鈕與操作元素觸控友善化
   ============================================================ */

@media (max-width: 640px) {
	/* 確保最小觸控高度 */
	.tmeetic-btn,
	.tmb-btn,
	.tmeetic-btn--sm,
	.tmb-btn-sm {
		min-height: 38px;
	}

	/* header 操作按鈕群自動換行（多個按鈕時） */
	.tmeetic-header-actions {
		flex-wrap: wrap;
	}
}
