/* 公告詳細頁面專用樣式 */

/* 頂部導航區 */
.announcement-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    max-width: 480px;
    margin: 0 auto;
}

.back-btn, .share-btn {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.back-btn:hover, .share-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    margin: 0;
    flex: 1;
    text-align: center;
}

/* 主要內容 */
.announcement-main {
    max-width: 480px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
    position: relative;
    background: var(--background-primary);
}

/* 載入狀態 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--background-secondary);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* 錯誤狀態 */
.error-container {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.error-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.error-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.retry-btn {
    background: var(--primary-color);
    border: none;
    border-radius: 25px;
    color: var(--white);
    cursor: pointer;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.retry-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 公告內容 */
.announcement-content {
    background: var(--white);
    min-height: calc(100vh - 70px);
}

/* 公告頭部 */
.announcement-hero {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 32px 20px;
}

.announcement-hero.has-image {
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.8) 0%, rgba(155, 89, 182, 0.8) 100%);
}

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

.announcement-type {
    display: inline-block;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

.announcement-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 16px 0;
}

.announcement-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
    opacity: 0.9;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 緊急公告樣式 */
.announcement-content.emergency .announcement-hero {
    background: linear-gradient(135deg, #ff4757 0%, #ff6b7a 100%);
}

.announcement-content.emergency .hero-overlay {
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.9) 0%, rgba(255, 107, 122, 0.9) 100%);
}

/* 活動公告樣式 */
.announcement-content.event .announcement-hero {
    background: linear-gradient(135deg, #3742fa 0%, #5a67d8 100%);
}

.announcement-content.event .hero-overlay {
    background: linear-gradient(135deg, rgba(55, 66, 250, 0.9) 0%, rgba(90, 103, 216, 0.9) 100%);
}

/* 活動資訊區塊 */
.event-info-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-bottom: 1px solid var(--background-secondary);
}

.event-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    max-width: 440px;
    margin: 0 auto;
}

.event-info-item {
    text-align: center;
    padding: 16px 12px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.event-info-icon {
    color: var(--primary-color);
    margin: 0 auto 8px auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 50%;
}

.event-info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0 0 4px 0;
}

.event-info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 公告主體內容 */
.announcement-body {
    padding: 24px 20px;
    max-width: 440px;
    margin: 0 auto;
}

.content-section {
    margin-bottom: 32px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0;
    white-space: pre-wrap;
}

/* 關鍵字標籤 */
.keywords-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tag {
    background: var(--primary-color);
    color: var(--white);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: 500;
}

/* 照片網格 */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.photo-item {
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.photo-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s;
}

.photo-item:hover::after {
    background: rgba(0,0,0,0.1);
}

/* 照片檢視器模態框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.photo-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.3s;
    z-index: 10;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.photo-viewer-content {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#photoViewerImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.photo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 16px;
    border-radius: 50%;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.photo-nav:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.photo-nav.prev {
    left: -60px;
}

.photo-nav.next {
    right: -60px;
}

.photo-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.photo-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
}

.photo-indicator.active {
    background: var(--white);
    transform: scale(1.3);
}

/* Toast 通知 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color, #2ed573);
    color: var(--white);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    max-width: 90%;
    min-width: 200px;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

.toast.error {
    background: #ff4757;
}

.toast.info {
    background: #3742fa;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
}

/* 響應式設計 */
@media (max-width: 480px) {
    .header-container {
        padding: 12px 15px;
    }
    
    .announcement-hero {
        padding: 24px 15px;
    }
    
    .announcement-title {
        font-size: 1.3rem;
    }
    
    .announcement-meta {
        gap: 16px;
    }
    
    .event-info-section {
        padding: 16px 15px;
    }
    
    .event-info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .event-info-item {
        padding: 12px;
    }
    
    .announcement-body {
        padding: 20px 15px;
    }
    
    .content-section {
        margin-bottom: 24px;
    }
    
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .photo-viewer-container {
        padding: 15px;
    }
    
    .photo-nav.prev {
        left: -50px;
    }
    
    .photo-nav.next {
        right: -50px;
    }
    
    .close-btn {
        top: 15px;
        right: 15px;
        padding: 10px;
    }
}

@media (max-width: 360px) {
    .announcement-title {
        font-size: 1.2rem;
    }
    
    .meta-item {
        font-size: 0.85rem;
    }
    
    .content-text {
        font-size: 0.95rem;
    }
    
    .photo-nav {
        padding: 12px;
    }
    
    .photo-nav.prev {
        left: -45px;
    }
    
    .photo-nav.next {
        right: -45px;
    }
}

/* 無障礙設計 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高對比模式支援 */
@media (prefers-contrast: high) {
    .announcement-hero {
        border-bottom: 2px solid var(--text-primary);
    }
    
    .photo-item {
        border: 2px solid var(--text-secondary);
    }
    
    .keyword-tag {
        border: 1px solid var(--white);
    }
}

/* 暗色主題支援 */
@media (prefers-color-scheme: dark) {
    .event-info-section {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .event-info-item {
        background: #34495e;
        color: var(--white);
    }
    
    .event-info-icon {
        background: rgba(52, 152, 219, 0.2);
    }
}
