/**
 * Events Page Styles
 * 活動頁面樣式
 */

/* ========================================
   CSS Variables (defaults, overridden by inline styles)
   ======================================== */
.events-page {
    --events-columns: 3;
    --events-gap: 24px;
    --events-bg: #ffffff;
    --events-card-bg: #f8f8f8;
    --events-text: #1a1a1a;
    --events-text-muted: rgba(0, 0, 0, 0.6);
    --events-accent: #e63946;
    --events-secondary: #e63946;
    --events-radius: 12px;
    --events-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --events-border: rgba(0, 0, 0, 0.08);
}

/* ========================================
   Base Layout
   ======================================== */
.events-page {
    background-color: var(--events-bg);
    color: var(--events-text);
    min-height: 100vh;
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
}

.events-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.events-main {
    padding: 40px 0 80px;
}

/* ========================================
   Hero Section
   ======================================== */
.events-hero {
    position: relative;
    padding: 100px 24px;
    background-color: var(--events-card-bg);
    background-size: cover;
    background-position: center;
    text-align: center;
    overflow: hidden;
}

.events-hero .hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

.events-hero .hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.events-hero .hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin: 0 0 16px;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.events-hero .hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.6;
}

/* ========================================
   Toolbar
   ======================================== */
.events-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--events-border);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Time Filter Tabs */
.time-filter {
    display: flex;
    background: white;
    border: 2px solid var(--events-border);
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--events-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--events-transition);
    white-space: nowrap;
}

.filter-tab:hover {
    color: var(--events-text);
    background: rgba(0, 0, 0, 0.03);
}

.filter-tab.active {
    background: var(--events-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.2);
}

.filter-tab svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Events Count */
.events-count {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--events-text);
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--events-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Search */
.events-search {
    display: flex;
    align-items: stretch;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--events-border);
    transition: var(--events-transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.events-search:focus-within {
    border-color: var(--events-accent);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.08);
}

.events-search input {
    flex: 1;
    background: transparent;
    border: none !important;
    border-bottom: none !important;
    text-decoration: none !important;
    padding: 16px 24px;
    color: var(--events-text);
    font-size: 0.95rem;
    min-width: 200px;
    outline: none !important;
    box-shadow: none !important;
    font-family: inherit;
    line-height: 1.5;
}

.events-search input:focus {
    border: none !important;
    border-bottom: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 20px;
}

.events-search input::placeholder {
    color: var(--events-text-muted);
    opacity: 0.6;
    padding: 20px;
}

.events-search button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 14px 18px;
    color: var(--events-text-muted);
    cursor: pointer;
    transition: var(--events-transition);
    border-left: 1px solid var(--events-border);
}

.events-search button:hover {
    color: var(--events-accent);
    background: rgba(230, 57, 70, 0.04);
}

.events-search button svg {
    flex-shrink: 0;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: white;
    border: 2px solid var(--events-border);
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--events-text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--events-transition);
}

.view-btn:hover {
    color: var(--events-text);
    background: rgba(0, 0, 0, 0.03);
}

.view-btn.active {
    background: var(--events-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.2);
}

/* Search Results Info */
.search-results-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 24px;
    background: white;
    border: 2px solid var(--events-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
    color: var(--events-text);
}

.clear-search {
    color: var(--events-accent);
    text-decoration: none;
    font-weight: 600;
    padding: 4px 12px;
    background: rgba(230, 57, 70, 0.08);
    border-radius: 6px;
    transition: var(--events-transition);
}

.clear-search:hover {
    background: rgba(230, 57, 70, 0.15);
    text-decoration: none;
}

/* ========================================
   Events Grid
   ======================================== */
.events-grid {
    display: grid;
    gap: var(--events-gap);
}

.events-grid.grid-view {
    grid-template-columns: repeat(var(--events-columns), 1fr);
}

.events-grid.list-view {
    grid-template-columns: 1fr;
}

/* ========================================
   Event Card - Grid View
   ======================================== */
.event-card {
    background: var(--events-card-bg);
    border-radius: var(--events-radius);
    overflow: hidden;
    transition: var(--events-transition);
    border: 1px solid var(--events-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.event-card .event-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Event Image */
.event-card .event-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

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

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

/* Date Badge */
.event-card .event-date-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--events-accent);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

.event-date-badge .date-day {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.event-date-badge .date-month {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 2px;
    opacity: 0.9;
}

/* Status Badge */
.event-card .event-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--events-text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

/* Past Event Styling */
.event-card.past .event-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.event-card.past .event-date-badge {
    background: #6b7280;
    box-shadow: none;
}

.event-card .event-status-badge.past-badge {
    background: rgba(107, 114, 128, 0.9);
    color: #ffffff;
}

/* Ongoing Event Styling */
.event-card.ongoing .event-date-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    animation: pulse-badge 2s ease-in-out infinite;
}

.event-card .event-status-badge.ongoing-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* Upcoming Soon Badge (within 7 days) */
.event-card .event-status-badge.upcoming-soon-badge {
    background: linear-gradient(135deg, var(--events-accent), #dc2626);
    color: #ffffff;
}

/* Event Content */
.event-card .event-content {
    padding: 20px;
}

.event-card .event-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Event Meta */
.event-card .event-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.event-card .meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--events-text-muted);
}

.event-card .meta-item svg {
    flex-shrink: 0;
    color: var(--events-secondary);
}

.event-card .meta-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Event Footer */
.event-card .event-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--events-border);
}

.event-card .event-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--events-secondary);
}

.event-card .event-price .woocommerce-Price-amount {
    color: var(--events-secondary);
}

.event-card .free-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.event-card .event-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--events-accent);
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--events-transition);
}

.event-card:hover .event-button {
    background: #c9303c;
}

/* ========================================
   Event Card - List View
   ======================================== */
.events-grid.list-view .event-card .event-link {
    display: grid;
    grid-template-columns: 280px 1fr;
    align-items: stretch;
}

.events-grid.list-view .event-card .event-image {
    aspect-ratio: 16 / 10;
    height: 100%;
    min-height: 180px;
}

.events-grid.list-view .event-card .event-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 32px;
}

.events-grid.list-view .event-card .event-title {
    font-size: 1.25rem;
    -webkit-line-clamp: 1;
}

.events-grid.list-view .event-card .event-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
}

.events-grid.list-view .event-card .event-date-badge {
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
}

/* ========================================
   Empty State
   ======================================== */
.events-empty {
    text-align: center;
    padding: 80px 24px;
}

.events-empty .empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    margin-bottom: 24px;
}

.events-empty .empty-icon svg {
    color: var(--events-text-muted);
}

.events-empty .empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--events-text);
}

.events-empty .empty-message {
    font-size: 1rem;
    color: var(--events-text-muted);
    margin: 0 0 24px;
}

.events-empty .empty-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--events-accent);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--events-transition);
}

.events-empty .empty-action:hover {
    background: #c9303c;
}

/* ========================================
   Pagination
   ======================================== */
.events-pagination {
    display: flex;
    justify-content: center;
    margin-top: 48px;
}

.events-pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    margin: 0 4px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--events-text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--events-transition);
}

.events-pagination .page-numbers:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--events-text);
}

.events-pagination .page-numbers.current {
    background: var(--events-accent);
    color: white;
}

.events-pagination .prev,
.events-pagination .next {
    background: transparent;
}

.events-pagination .dots {
    background: transparent;
    pointer-events: none;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1200px) {
    .events-grid.grid-view {
        --events-columns: 2;
    }
}

@media (max-width: 900px) {
    .events-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .toolbar-left,
    .toolbar-right {
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .events-count {
        flex: 1;
        text-align: center;
    }
    
    .events-search {
        flex: 1;
        min-width: 0;
    }
    
    .events-search input {
        min-width: 0;
        width: 100%;
    }
    
    .events-grid.list-view .event-card .event-link {
        grid-template-columns: 200px 1fr;
    }
}

@media (max-width: 768px) {
    .events-hero {
        padding: 60px 16px;
    }
    
    .events-container {
        padding: 0 16px;
    }
    
    .events-main {
        padding: 24px 0 60px;
    }
    
    .events-grid.grid-view {
        --events-columns: 1;
    }
    
    .events-grid.list-view .event-card .event-link {
        grid-template-columns: 1fr;
    }
    
    .events-grid.list-view .event-card .event-image {
        min-height: 200px;
    }
    
    .events-grid.list-view .event-card .event-content {
        padding: 20px;
    }
    
    .time-filter {
        width: 100%;
    }
    
    .filter-tab {
        flex: 1;
        justify-content: center;
    }
    
    .view-toggle {
        display: none;
    }
}

@media (max-width: 480px) {
    .events-hero .hero-title {
        font-size: 1.75rem;
    }
    
    .toolbar-left,
    .toolbar-right {
        flex-direction: column;
        width: 100%;
    }
    
    .time-filter,
    .events-search,
    .view-toggle,
    .events-count {
        width: 100%;
    }
    
    .time-filter {
        justify-content: stretch;
    }
    
    .filter-tab {
        flex: 1;
        justify-content: center;
    }
    
    .events-search input {
        padding: 16px 18px;
    }
    
    .events-search button {
        padding: 16px 18px;
    }
    
    .event-card .event-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .event-card .event-button {
        justify-content: center;
    }
}

/* ========================================
   Animation
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-card {
    animation: fadeInUp 0.5s ease forwards;
}

.event-card:nth-child(1) { animation-delay: 0.05s; }
.event-card:nth-child(2) { animation-delay: 0.1s; }
.event-card:nth-child(3) { animation-delay: 0.15s; }
.event-card:nth-child(4) { animation-delay: 0.2s; }
.event-card:nth-child(5) { animation-delay: 0.25s; }
.event-card:nth-child(6) { animation-delay: 0.3s; }
.event-card:nth-child(7) { animation-delay: 0.35s; }
.event-card:nth-child(8) { animation-delay: 0.4s; }
.event-card:nth-child(9) { animation-delay: 0.45s; }

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .event-card,
    .event-card .event-image img {
        animation: none;
        transition: none;
    }
}

