/* =========================================
   Yufinest Events - 全局變數與基礎
   ========================================= */
:root {
    --yf-primary: #333;      /* 主色調：深藍灰 */
    --yf-accent: #454F5E;       /* 強調色：亮藍 */
    --yf-success: #E98C00;      /* 成功色 */
    --yf-warning: #f39c12;      /* 收藏色：橘黃 */
    --yf-bg-light: #f8f9fa;     /* 淺灰背景 */
    --yf-border: #e2e8f0;       /* 邊框色 */
    --yf-radius: 8px;           /* 圓角 */
    --yf-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* =========================================
   1. 活動發佈與註冊表單 (Form)
   ========================================= */
.yf-form-container {
    background: #fff;
    padding: 2rem;
    border-radius: var(--yf-radius);
    box-shadow: var(--yf-shadow);
    border: 1px solid var(--yf-border);
    margin: 20px auto;
}

.yf-form-row {
    margin-bottom: 1.2rem;
}

.yf-form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--yf-primary);
}

.yf-input-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--yf-border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
    box-sizing: border-box; /* 確保 padding 不會撐開寬度 */
}

.yf-input-field:focus {
    border-color: var(--yf-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.yf-submit-btn {
    background-color: var(--yf-accent);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.3s;
    width: 100%;
}

.yf-submit-btn:hover {
    background-color: #2980b9;
}

/* =========================================
   2. 單一活動頁面 - 資訊卡 (Info Box)
   ========================================= */
.yf-event-meta-box {
    background: var(--yf-bg-light);
    border-left: 5px solid var(--yf-accent);
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 0 var(--yf-radius) var(--yf-radius) 0;
}

.yf-meta-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 1.05rem;
    color: var(--yf-primary);
}

.yf-meta-icon {
    margin-right: 12px;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.yf-meta-label {
    font-weight: bold;
    margin-right: 8px;
}

.yf-map-container {
    margin-top: 20px;
    border-radius: var(--yf-radius);
    overflow: hidden;
    box-shadow: var(--yf-shadow);
}
.yf-map-container iframe {
    width: 100%;
    display: block;
    border: 0;
}

/* =========================================
   3. 收藏/有興趣按鈕 (Interest Button)
   ========================================= */
.yf-interest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid var(--yf-border);
    background: #fff;
    color: var(--yf-primary);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.yf-interest-btn:hover {
    background: #f1f1f1;
    transform: translateY(-1px);
}

.yf-interest-btn.active {
    background-color: var(--yf-warning);
    color: #fff;
    border-color: var(--yf-warning);
}

.yf-interest-btn .count {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-size: 0.8rem;
}

/* =========================================
   4. 行事曆 (Calendar)
   ========================================= */
.yf-calendar-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: var(--yf-radius);
    box-shadow: var(--yf-shadow);
}

.yf-calendar-header {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--yf-primary);
}

.yf-calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 固定寬度，避免格子忽大忽小 */
}

.yf-calendar-table th {
    background: var(--yf-primary);
    color: #fff;
    padding: 10px;
    text-align: center;
}

.yf-calendar-table td {
    border: 1px solid var(--yf-border);
    height: 100px; /* 固定高度 */
    vertical-align: top;
    padding: 8px;
    position: relative;
    background: #fff;
}

.yf-calendar-table td .day-number {
    font-weight: bold;
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: block;
}

.yf-calendar-event-link {
    display: block;
    background: var(--yf-accent);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 5px;
    margin-bottom: 3px;
    border-radius: 3px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yf-calendar-event-link:hover {
    background: #2980b9;
    color: #fff;
}

/* 手機版 RWD 調整 */
@media (max-width: 768px) {
    .yf-calendar-table td {
        height: 60px;
        font-size: 0.8rem;
        padding: 2px;
    }
    .yf-calendar-event-link {
        font-size: 0.6rem; /* 手機版字體縮小 */
    }
}

/* =========================================
   5. 我的收藏列表 (Interest List)
   ========================================= */
.yf-interest-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.yf-interest-item {
    background: #fff;
    border: 1px solid var(--yf-border);
    border-radius: var(--yf-radius);
    padding: 15px;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.yf-interest-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.yf-interest-item a {
    text-decoration: none;
    color: var(--yf-primary);
    font-weight: bold;
    font-size: 1.1rem;
}

.yf-interest-date {
    display: block;
    font-size: 0.9rem;
    color: #777;
    margin-top: 5px;
}

/* =========================================
   6. 活動列表切換 (List/Grid Switcher)
   ========================================= */

/* 工具列 */
.yf-list-wrapper {
    margin-bottom: 40px;
}

.yf-view-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.yf-view-btn {
    background: none;
    border: 1px solid #ddd;
    color: #777;
    padding: 5px 10px;
    margin-left: 5px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.yf-view-btn:hover, .yf-view-btn.active {
    background: var(--yf-primary);
    color: #fff;
    border-color: var(--yf-primary);
}

.yf-view-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* --- 容器通用 --- */
.yf-events-container {
    display: grid;
    gap: 30px;
    transition: all 0.3s ease;
}

.yf-event-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--yf-radius);
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column; /* 預設為直向 */
}

.yf-event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

/* 圖片區域 */
.yf-card-image {
    position: relative;
    overflow: hidden;
    height: 200px; /* 固定高度 */
    flex-shrink: 0;
}

.yf-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.yf-event-card:hover .yf-card-image img {
    transform: scale(1.05);
}

.yf-card-date-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    color: var(--yf-primary);
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 內容區域 */
.yf-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.yf-card-title {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    line-height: 1.4;
}

.yf-card-title a {
    text-decoration: none;
    color: var(--yf-primary);
}

.yf-card-title a:hover {
    color: var(--yf-accent);
}

.yf-card-meta {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.yf-card-meta .meta-item {
    display: flex;
    align-items: center;
}
.yf-card-meta .dashicons {
    margin-right: 4px;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.yf-card-excerpt {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1; /* 讓按鈕置底 */
}

.yf-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.yf-read-more {
    color: var(--yf-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* =========================================
   模式 A: Grid View (網格) - 預設
   ========================================= */
.yf-grid-view {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* =========================================
   模式 B: List View (列表)
   ========================================= */
.yf-list-view {
    grid-template-columns: 1fr; /* 單欄 */
}

.yf-list-view .yf-event-card {
    flex-direction: row; /* 改為橫向排列 */
    min-height: 220px;
}

.yf-list-view .yf-card-image {
    width: 35%; /* 圖片佔 35% */
    height: auto; /* 高度自動 */
}

.yf-list-view .yf-card-content {
    width: 65%; /* 內容佔 65% */
}

/* 手機版強制回到 Grid 樣式，避免 List 太擠 */
@media (max-width: 768px) {
    .yf-list-view .yf-event-card {
        flex-direction: column;
    }
    .yf-list-view .yf-card-image {
        width: 100%;
        height: 200px;
    }
    .yf-list-view .yf-card-content {
        width: 100%;
    }
}

/* 分頁 */
.yf-pagination {
    margin-top: 40px;
    text-align: center;
}
.yf-pagination a, .yf-pagination span {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: var(--yf-primary);
}
.yf-pagination .current {
    background: var(--yf-primary);
    color: #fff;
    border-color: var(--yf-primary);
}

/* =========================================
   8. 登入/註冊 雙頁籤樣式 (Auth Tabs)
   ========================================= */
.yf-auth-tabs {
    display: flex;
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
}

.yf-tab-btn {
    background-color: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 15px 20px;
    transition: 0.3s;
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    flex: 1; /* 兩個按鈕平均分配寬度 */
    text-align: center;
    border-radius: 0px;
}

/* 滑鼠經過的效果 */
.yf-tab-btn:hover {
    background-color: #e2e2e2;
    color: var(--yf-primary);
}

/* 選中狀態的效果 */
.yf-tab-btn.active {
    background-color: #fff;
    color: var(--yf-accent);
    border-bottom: 3px solid var(--yf-accent);
    margin-bottom: -1px; /* 蓋住底線 */
}

/* 警示訊息樣式 */
.yf-alert {
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.95rem;
}

.yf-alert.yf-error {
    background-color: #fde8e8;
    color: #c53030;
    border: 1px solid #fbd5d5;
}

.yf-alert.yf-success {
    background-color: #def7ec;
    color: #03543f;
    border: 1px solid #bcf0da;
}

/* =========================================
   9. 我的收藏列表 - 圖文卡片樣式 (升級版)
   ========================================= */

/* 列表容器：網格排列 */
.yf-interest-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* 自動適應寬度 */
    gap: 20px;
}

/* 單一卡片 */
.yf-interest-item {
    background: #fff;
    border: 1px solid var(--yf-border);
    border-radius: var(--yf-radius);
    overflow: hidden; /* 確保圖片不溢出圓角 */
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.yf-interest-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

/* 圖片區域 */
.yf-interest-thumb {
    width: 100%;
    height: 150px; /* 固定高度，讓卡片整齊 */
    background-color: #f0f0f0;
    overflow: hidden;
}

.yf-interest-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持比例填滿，不變形 */
    transition: transform 0.5s;
}

.yf-interest-item:hover .yf-interest-thumb img {
    transform: scale(1.1); /* 滑鼠移過去圖片稍微放大 */
}

/* 內容文字區域 */
.yf-interest-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* 標題 */
.yf-interest-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--yf-primary);
    text-decoration: none;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 最多顯示兩行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yf-interest-title:hover {
    color: var(--yf-accent);
}

/* 日期 */
.yf-interest-date {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 10px;
}

/* =========================================
   10. 單一活動頁 - 主圖樣式
   ========================================= */
.yf-single-featured-image {
    margin-bottom: 25px;
    border-radius: var(--yf-radius);
    overflow: hidden;
    box-shadow: var(--yf-shadow);
    line-height: 0; /* 消除圖片下方的微小空白 */
}

.yf-single-featured-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    max-height: 500px; /* 限制最大高度，避免直圖佔據太多版面 */
    display: block;
}

/* 讓資訊卡緊接在圖片下方 */
.yf-event-meta-box {
    margin-top: 0; 
}

/* =========================================
   分頁樣式 (Pagination)
   ========================================= */
.yf-pagination {
    margin-top: 50px;
    display: flex;
    justify-content: center;
}

.yf-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
}

.yf-pagination li {
    display: inline-block;
}

.yf-pagination a, 
.yf-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px; /* 圓角 */
    text-decoration: none;
    color: var(--yf-primary);
    font-weight: 600;
    transition: all 0.2s;
    background: #fff;
}

.yf-pagination a:hover {
    background-color: var(--yf-bg-light);
    border-color: #bbb;
}

.yf-pagination .current {
    background-color: var(--yf-primary);
    color: #fff;
    border-color: var(--yf-primary);
    cursor: default;
}

/* =========================================
   11. 活動分類篩選頁籤 (Event Type Tabs)
   ========================================= */
.yf-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center; /* 置中顯示 */
}

.yf-cat-link {
    display: inline-block;
    padding: 8px 16px;
    background-color: #f1f1f1;
    color: #555;
    text-decoration: none;
    border-radius: 20px; /* 圓潤膠囊狀 */
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.yf-cat-link:hover {
    background-color: #e2e2e2;
    color: #333;
}

/* 啟用狀態 (Active) */
.yf-cat-link.active {
    background-color: var(--yf-accent); /* 使用後台設定的強調色 */
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* =========================================
   12. 美化註冊角色選擇器 (Role Selector)
   ========================================= */
.yf-role-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

/* 隱藏原始的圓圈 Radio Button */
.yf-role-selector input[type="radio"] {
    display: none;
}

/* 設計按鈕外觀 (Label) */
.yf-role-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    background-color: #fff;
    transition: all 0.2s ease;
    user-select: none; /* 防止點擊時選取文字 */
}

/* 裡面的圖示 */
.yf-role-option .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    margin-right: 15px;
    color: #94a3b8;
    transition: color 0.2s;
}

/* 裡面的文字區塊 */
.yf-role-text {
    display: flex;
    flex-direction: column;
}

.yf-role-text strong {
    font-size: 1rem;
    color: var(--yf-primary);
}

.yf-role-text small {
    font-size: 0.8rem;
    color: #888;
}

/* --- 滑鼠懸停效果 (Hover) --- */
.yf-role-option:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

/* --- 被選中時的效果 (Checked) --- */
/* 當 input 被 checked 時，改變它緊鄰的 label 樣式 */
.yf-role-selector input[type="radio"]:checked + .yf-role-option {
    border-color: var(--yf-accent);
    background-color: #f0f9ff; /* 淡淡的強調色背景 */
    box-shadow: 0 0 0 1px var(--yf-accent); /* 加強邊框感 */
}

/* 選中時改變圖示與標題顏色 */
.yf-role-selector input[type="radio"]:checked + .yf-role-option .dashicons,
.yf-role-selector input[type="radio"]:checked + .yf-role-option strong {
    color: var(--yf-accent);
}

/* 選中時的勾勾 (使用 CSS 偽元素) */
.yf-role-selector input[type="radio"]:checked + .yf-role-option::after {
    content: "\f147"; /* Dashicon 的勾勾代碼 */
    font-family: "dashicons";
    font-size: 20px;
    color: var(--yf-accent);
    margin-left: auto; /* 靠右對齊 */
}