/* ==========================================
   挑戰列表頁樣式 V2 (Challenges Page Styles V2)
   色值對齊 V2 色盤 (primary: #003366)
   ========================================== */

/* --- Hero Overlay --- */

.hero-overlay {
    background: linear-gradient(rgba(0, 51, 102, 0.85), rgba(0, 51, 102, 0.85)),
                url('https://images.unsplash.com/photo-1497366216548-37526070297c?ixlib=rb-4.0.3&auto=format&fit=crop&w=1600&q=80');
    background-size: cover;
    background-position: center;
}

/* 卡片 Grid 佈局 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* List View 圖片 */
.challenge-card .card-image-list {
    width: 280px;
    aspect-ratio: 16 / 9;
    align-self: flex-start;
}

@media (max-width: 768px) {
    .challenge-card.flex-row {
        flex-direction: column !important;
    }
    .challenge-card .card-image-list {
        width: 100%;
        align-self: stretch;
    }
}

/* Filter Select Custom Style */
.filter-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Pagination Active State */
.pagination-active {
    background-color: #003366;
    color: white;
}

/* --- 原內嵌 CSS 內容 --- */

[v-cloak] { display: none !important; }

/* 載入動畫 */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    color: var(--primary);
}

.loading-spinner i {
    font-size: 2rem;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 16px;
}

.empty-state p {
    margin: 8px 0;
}

/* 篩選項活動狀態 */
.filter-active {
    color: var(--primary) !important;
    font-weight: 600;
}

/* 分頁按鈕 */
.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.pagination-btn:hover:not(.active):not(:disabled) {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 精選標籤 */
.featured-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 封面圖片佔位 */
.cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 3rem;
}

/* 挑戰卡片 */
.challenge-card {
    transition: all 0.3s ease;
    overflow: hidden;
    border-radius: 12px;
}

.challenge-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(0, 51, 102, 0.15);
}

.challenge-card .card-image {
    position: relative;
    overflow: hidden;
}

.challenge-card .card-image-grid {
    aspect-ratio: 16 / 9;
}

.challenge-card .card-image img {
    transition: transform 0.3s ease;
}

.challenge-card:hover .card-image img {
    transform: scale(1.05);
}

/* 卡片標題 */
.challenge-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* 卡片摘要 */
.challenge-card .card-summary {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 12px;
    line-height: 1.6;
}

/* 卡片底部資訊 */
.card-meta-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #4b5563;
}

.card-meta-item i {
    color: #008c95;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.card-meta-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 查看詳情按鈕 */
.card-detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--primary, #003366);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 6px;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s;
}

.card-detail-btn:hover {
    background: #002244;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.3);
}

.card-detail-btn i {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.card-detail-btn:hover i {
    transform: translateX(3px);
}

/* 狀態徽章 */
.status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-badge.recruiting {
    background: #10b981;
    color: white;
}

.status-badge.reviewing {
    background: #f59e0b;
    color: white;
}

.status-badge.closed {
    background: #6b7280;
    color: white;
}

.status-badge.urgent {
    background: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 標籤樣式 */
.tag-category {
    background: rgba(0, 140, 149, 0.1);
    color: #008c95;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

.tag-new {
    background: #3b82f6;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

/* List View 卡片調整 */
@media (max-width: 768px) {
    .challenge-card .card-detail-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }
}

/* 篩選器標題 */
.filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.filter-title:hover {
    color: #003366;
}

/* 篩選器計數 */
.filter-count {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 400;
}

/* ===== WCAG 2.1 AA 無障礙修正 ===== */

/* 螢幕閱讀器專用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦點指示器 - 所有互動元素 */
.pagination-btn:focus-visible,
.card-detail-btn:focus-visible,
.filter-title button:focus-visible,
.filter-title:focus-visible {
    outline: 2px solid #003366;
    outline-offset: 2px;
}

input[type="text"]:focus-visible,
select:focus-visible,
input[type="checkbox"]:focus-visible {
    outline: 2px solid #003366;
    outline-offset: 1px;
}

/* 分頁按鈕最小觸控尺寸 44x44 */
@media (pointer: coarse) {
    .pagination-btn {
        width: 44px;
        height: 44px;
    }
}

/* 篩選器展開按鈕樣式（原 h3 改用 button） */
.filter-title button {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    user-select: none;
    color: inherit;
    font: inherit;
}

.filter-title button:hover {
    color: #003366;
}

/* 修正 reviewing 狀態徽章對比度 (#f59e0b 白字對比度不足) */
.status-badge.reviewing {
    background: #b45309;
    color: white;
}
