/*
 * 關鍵CSS - 首屏渲染必需樣式
 * 包含基本佈局、顏色變量和核心組件
 */

:root {
    /* 核心顏色變量 */
    --primary-color: #1a1a1a;
    --primary-color-rgb: 26, 26, 26;
    --primary-color-dark: #000000;
    --primary-light: #f0f0f0;

    /* 背景顏色 */
    --background-color: #f5f5f0;
    --background-secondary: #eeeeee;
    --card-background: #ffffff;
    --header-background: #4a4a4a;

    /* 文字顏色 */
    --text-color: #1a1a1a;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #666666;
    --text-white: #ffffff;

    /* 邊框和陰影 */
    --border-color: #dddddd;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

    /* 狀態顏色 */
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
}

/* 基礎重置和字體 */
* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', 'Source Han Sans TC', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

/* 基本佈局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 標題樣式 */
h1, h2, h3, h4, h5, h6 {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', 'Source Han Sans TC', sans-serif;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; font-weight: normal; }
h2 { font-size: 1.75rem; font-weight: normal; }
h3 { font-size: 1.5rem; font-weight: normal; }

/* 基本鏈接樣式 */
a {
    color: var(--text-link, var(--text-color));
    text-decoration: none;
}

a:hover {
    color: var(--text-link-hover, var(--primary-color-dark));
}

/* 基本按鈕樣式 */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: var(--text-white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.btn:hover {
    background-color: var(--primary-color-dark);
    color: var(--text-white);
}

/* 載入指示器 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.d-none {
    display: none !important;
}

/* 基本卡片樣式 */
.card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* 表格容器 */
.table-container {
    background: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 基本網格系統 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

.col {
    flex: 1;
    padding: 0 0.5rem;
}

/* 表格樣式 - 關鍵顯示 */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid var(--border-color);
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--background-secondary);
    font-weight: 600;
}

.table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 狀態標籤 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.status-registered {
    color: #fff;
    background-color: var(--success-color);
}

.status-available {
    color: #fff;
    background-color: #17a2b8;
}

.status-unavailable {
    color: #fff;
    background-color: var(--text-muted);
}

/* 工具類 */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.text-center { text-align: center !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }

/* 響應式顯示類 */
.d-md-table-cell {
    display: table-cell !important;
}

@media (max-width: 767.98px) {
    .d-none.d-md-table-cell {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .d-md-table-cell {
        display: table-cell !important;
    }
}

/* 響應式基礎 */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .btn {
        padding: 0.5rem 0.75rem;
        min-height: 44px;
    }

    /* 移動端表格優化 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
