/* ==========================================
   資源下載頁樣式
   ========================================== */

[v-cloak] { display: none; }

/* ========== 控制列：分類 Tabs + 搜尋 ========== */
.downloads-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: #003366;
}

.tab-btn.active {
    color: #0089A7;
    border-bottom-color: #0089A7;
    font-weight: 600;
}

.tab-count {
    font-size: 0.78rem;
    padding: 1px 7px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #9ca3af;
}

.tab-btn.active .tab-count {
    background: #0089A7;
    color: #fff;
}

/* 搜尋 */
.search-box {
    position: relative;
    min-width: 220px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.9rem;
}

.search-input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #0089A7;
    box-shadow: 0 0 0 3px rgba(0, 137, 167, 0.1);
}

/* ========== 手機版分類 ========== */
.mobile-categories {
    display: none;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.mobile-cat-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 0.88rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
}

.mobile-cat-btn:hover {
    border-color: #0089A7;
    color: #0089A7;
}

.mobile-cat-btn.active {
    background: #0089A7;
    color: #fff;
    border-color: #0089A7;
}

/* ========== 檔案列表 ========== */
.file-list {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.file-list-header {
    display: grid;
    grid-template-columns: 56px 1fr 120px 100px 100px;
    gap: 12px;
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.file-row {
    display: grid;
    grid-template-columns: 56px 1fr 120px 100px 100px;
    gap: 12px;
    padding: 16px 20px;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}

.file-row:last-child {
    border-bottom: none;
}

.file-row:hover {
    background: #f9fafb;
}

/* ========== 檔案圖示 ========== */
.file-type-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: #f3f4f6;
    color: #6b7280;
}

.file-type-icon.type-pdf { background: #fef2f2; color: #dc2626; }
.file-type-icon.type-doc,
.file-type-icon.type-docx { background: #eff6ff; color: #2563eb; }
.file-type-icon.type-xls,
.file-type-icon.type-xlsx { background: #f0fdf4; color: #16a34a; }
.file-type-icon.type-ppt,
.file-type-icon.type-pptx { background: #fff7ed; color: #ea580c; }
.file-type-icon.type-zip,
.file-type-icon.type-rar,
.file-type-icon.type-7z { background: #faf5ff; color: #7c3aed; }
.file-type-icon.type-odt,
.file-type-icon.type-ods { background: #eff6ff; color: #2563eb; }

/* ========== 檔案名稱 ========== */
.file-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.file-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.new-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: #f97316;
    text-transform: uppercase;
    flex-shrink: 0;
}

.file-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.file-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    background: #e5e7eb;
    color: #374151;
}

.file-ext {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f3f4f6;
    color: #9ca3af;
    text-transform: uppercase;
}

.file-desc {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: #9ca3af;
    line-height: 1.4;
}

/* ========== 日期/大小 ========== */
.col-date,
.col-size {
    font-size: 0.88rem;
    color: #6b7280;
    text-align: center;
}

/* ========== 下載按鈕 ========== */
.col-action {
    text-align: center;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background: #0089A7;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.download-btn:hover {
    background: #007590;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 137, 167, 0.3);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========== RWD ========== */
@media (max-width: 768px) {
    .downloads-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .category-tabs {
        display: none;
    }

    .mobile-categories {
        display: flex;
    }

    .search-box {
        min-width: auto;
    }

    .file-list-header {
        display: none;
    }

    .file-row {
        grid-template-columns: 44px 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px;
        padding: 14px 16px;
    }

    .col-icon {
        grid-row: 1 / 3;
        align-self: start;
    }

    .col-name {
        grid-column: 2 / 4;
    }

    .col-date {
        display: none;
    }

    .col-size {
        font-size: 0.78rem;
        text-align: left;
    }

    .col-action {
        text-align: right;
    }

    .download-btn {
        padding: 6px 14px;
        font-size: 0.82rem;
    }

    .download-btn-text {
        display: none;
    }

    .file-type-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .file-title {
        font-size: 0.92rem;
    }
}
