/* 通用響應式表格樣式庫 */

/* 過濾器樣式 */
.v-table-filter-section {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 5px var(--shadow);
}

.v-table-filter-container {
    max-width: 100%;
}

.v-table-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
}

.v-table-filter-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    flex: 1;
}

/* PC状态下均匀分布 */
@media (min-width: 769px) {
    .v-table-filter-form {
        flex-wrap: nowrap;
    }
    
    .v-table-filter-group {
        flex: 1;
        min-width: 0;
    }
    
    .v-table-filter-actions {
        flex: 1;
        min-width: 0;
        justify-content: flex-end;
    }
}

.v-table-filter-group label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
    font-size: 14px;
}

.v-table-filter-select,
.v-table-filter-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.v-table-filter-select:focus,
.v-table-filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.v-table-filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.v-table-filter-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 7px 17px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    min-width: 60%;
    text-align: center;
}

.v-table-filter-btn:hover {
    background: #0056b3;
}

.v-table-filter-reset {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 7px 11px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 40%;
    text-align: center;
}

.v-table-filter-reset:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

/* 表格容器 */
.v-table-responsive {
    overflow-x: auto;
    margin: 20px 0;
}

/* 通用資料表格 */
.v-data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-color);
    box-shadow: 0 2px 10px var(--shadow);
    border-radius: 8px;
    overflow: hidden;
    
}

.v-data-table thead {
    background: var(--table-header-bg);
    color: var(--table-header-text-color);
}

.v-data-table th,
.v-data-table td {
    padding: 10px 6px;
    text-align:center;
    border-bottom: 1px solid var(--border-color);
}

.v-data-table th {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.v-data-table tbody tr:hover {
    background-color: var(--hover-bg);
}

/* 通用欄位樣式 */
.v-col-quarter {
    min-width: 70px;
    color: var(--text-secondary);
    text-align: center;
}

.v-col-group {
    min-width: 120px;
    color: var(--text-secondary);
}

.v-col-title {
    font-weight: 600;
    color: var(--text-color);
    min-width: 100px;
}

.v-col-teacher {
    color: var(--text-secondary);
    min-width: 150px;
}

.v-col-location {
    min-width: 140px;
    color: var(--text-secondary);
}

.v-col-date {
    min-width: 100px;
    color: var(--text-secondary);
}

.v-col-number {
    min-width: 80px;
    color: var(--text-color);
    text-align: center;
}

.v-col-text {
    min-width: 120px;
    color: var(--text-color);
}

.v-col-teach_methodt {
    min-width: 80px;
    color: var(--text-color);
}



.v-col-course-time {
    min-width: 150px;
    color: var(--text-color);
}

/* 空狀態 */
.v-no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .v-table-filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .v-table-filter-group {
        min-width: auto;
    }
    
    .v-table-filter-actions {
        justify-content: center;
        margin-top: 10px;
    }
    
    .v-data-table {
        font-size: 14px;
    }
    
    .v-data-table th,
    .v-data-table td {
        padding: 8px 10px;
    }
    
    .v-col-quarter {
        min-width: 80px;
    }
    
    .v-col-group {
        min-width: 100px;
    }
    
    .v-col-title {
        min-width: 150px;
    }
    
    .v-col-teacher {
        min-width: 120px;
    }
    
    .v-col-location {
        min-width: 100px;
    }
    
    .v-col-date {
        min-width: 80px;
    }
    
    .v-col-number {
        min-width: 60px;
    }
    
    .v-col-text {
        min-width: 100px;
    }
    
    .v-col-course-time {
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .v-table-filter-section {
        padding: 15px;
    }
    
    .v-table-filter-form {
        gap: 10px;
    }
    
    .v-table-filter-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .v-table-filter-btn,
    .v-table-filter-reset {
        width: 100%;
        text-align: center;
    }
    
    .v-data-table {
        font-size: 12px;
    }
    
    .v-data-table th,
    .v-data-table td {
        padding: 6px 8px;
    }
    
    .v-col-quarter {
        min-width: 70px;
    }
    
    .v-col-group {
        min-width: 80px;
    }
    
    .v-col-title {
        min-width: 120px;
    }
    
    .v-col-teacher {
        min-width: 100px;
    }
    
    .v-col-location {
        min-width: 80px;
    }
    
    .v-col-date {
        min-width: 70px;
    }
    
    .v-col-number {
        min-width: 50px;
    }
    
    .v-col-text {
        min-width: 80px;
    }
    
    .v-col-course-time {
        min-width: 70px;
    }
}

/* 置頂樣式 */
.pinned-row {
    background: linear-gradient(to right, rgba(255, 235, 59, 0.1), transparent) !important;
    border-left: 4px solid #ffeb3b;
}

.pin-badge {
    display: inline-block;
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
    vertical-align: middle;
}

/* 通用欄位樣式擴充 */
.v-col-category {
    min-width: 50px;
    color: var(--text-secondary);
}

.v-col-action {
    min-width: 100px;
    text-align: center;
}

.v-table-action-btn {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.v-table-action-btn:hover {
    background: #0056b3;
    color: white;
}

/* 分頁樣式 */
.pagination-container {
    margin-top: 30px;
    padding: 20px;
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.pagination-info {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.page-number:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.page-number.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-ellipsis {
    color: var(--text-secondary);
    padding: 0 5px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.page-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--bg-color);
}

.page-btn-icon {
    font-size: 16px;
}

/* 卡片式響應式設計 - 小螢幕時轉換為卡片 */
@media (max-width: 600px) {
    .v-table-responsive {
        overflow: visible;
    }
    
    /* 重置所有元素為 block */
    .v-data-table,
    .v-data-table thead,
    .v-data-table tbody {
        display: block;
    }
    
    /* 隱藏表頭 */
    .v-data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    /* 卡片容器：使用 flexbox，允許欄位自動換行 */
    .v-data-table tr {
        display: flex;
        flex-wrap: wrap;
        border: 1px solid var(--border-color);
        margin-bottom: 12px;
        padding: 12px;
        border-radius: 8px;
        background: var(--bg-color);
        box-shadow: 0 2px 5px var(--shadow);
    }
    
    /* 所有 td 預設為 inline-flex，並排顯示 */
    .v-data-table td {
        border: none;
        position: relative;
        padding: 4px 0;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        margin-right: 10px;
        margin-bottom: 4px;
    }
    
    /* 標題欄位：獨佔一行 */
    .v-data-table td.v-col-title {
        width: 100%;
        flex-basis: 100%;
        display: flex;
        flex-direction: column;
        font-size: 16px;
        font-weight: 600;
        color: var(--primary-color);
        margin-bottom: 8px;
        margin-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 6px;
    }
    
    /* 非標題欄位的標籤（顯示在值的左側） */
    .v-data-table td:not(.v-col-title):before {
        content: attr(data-label) ': ';
        font-weight: 600;
        color: var(--text-color);
        font-size: 12px;
        white-space: nowrap;
    }
    
    /* 標題欄位不顯示標籤 */
    .v-data-table td.v-col-title:before {
        display: none;
    }
    
    /* 當 hide-header-on-mobile 時，隱藏非標題欄位的標籤 */
    .hide-header-on-mobile .v-data-table td:not(.v-col-title):before {
        display: none;
    }
    
    /* 確保每個欄位內容不換行 */
    .v-data-table td:not(.v-col-title) {
        white-space: nowrap;
    }
    
    /* 操作按鈕欄位：獨佔一行並居中 */
    .v-data-table td.v-col-action {
        width: 100%;
        flex-basis: 100%;
        justify-content: center;
        margin-top: 8px;
        margin-right: 0;
    }
    
    .v-table-action-btn {
        display: inline-block;
        text-align: center;
        width: 100%;
    }
    
    /* 顏色和樣式調整 */
    .v-col-quarter,
    .v-col-group,
    .v-col-category,
    .v-col-teacher,
    .v-col-location,
    .v-col-date,
    .v-col-text,
    .v-col-course-time {
        color: var(--text-secondary);
        font-size: 13px;
    }
    
    .v-col-number {
        color: var(--text-color);
        font-weight: 500;
    }
    
    /* 手機版置頂樣式調整 */
    .pinned-row {
        border-left: 3px solid #ff6b6b;
        background: rgba(255, 107, 107, 0.05) !important;
    }
    
    .pin-badge {
        display: inline-block;
        width: fit-content;
        margin: 0 0 5px 0;
    }
    
    /* 分頁響應式設計 */
    .pagination-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-number {
        min-width: 28px;
        height: 28px;
        font-size: 13px;
    }
    
    .page-btn {
        width: 100%;
        justify-content: center;
        padding: 8px;
    }
}
