/*
 * sso-popup.css — front-page announcement ("credit") popup.
 *
 * Extracted from the inline <style> in render_credit_popup()
 * (announcement/announcement-popup.php) in Phase 2 (commit f2cde4c) so it can
 * be linted/minified/browser-cached. Enqueued by enqueue_credit_popup_styles().
 *
 * Visibility contract: the markup is always rendered cache-safe with
 * display:none; the inline popup JS flips display, then adds .is-visible via
 * double rAF so the opacity transition below actually runs (see
 * announcement-popup.php for why two frames are needed).
 */

    .popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色背景 */
    display: none;
    z-index: 999998; /* 比 popup 小 1 */
}

/* 修改 credit-popup */
.credit-popup {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    width: 100%;
    max-width: 600px;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* 置中 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 999999;
}

/* Fade-in: JS sets display first, then adds .is-visible via rAF so the transition runs */
#popupBackdrop,
#creditPopup {
    opacity: 0;
    transition: opacity .25s ease;
}

#popupBackdrop.is-visible,
#creditPopup.is-visible {
    opacity: 1;
}

.popup-header {
    padding: 0px 24px 0px 24px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.popup-header h2 {
    font-size: 1.7rem;
    font-weight: 700;
    color: #ff9c26;
    margin: 0;
    line-height: 1.4;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
    
}

.credit-popup-close {
    position: absolute;
    right: 4px;
    top: -1px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    padding: 4px;
    line-height: 1;
}

.announcement-content {
    color: #7e7f7f;
    font-size: 1.2rem;
    line-height: 1.5;
    text-align: left;
    padding: 0 3rem;
}

.announcement-item {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem; 
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); 
}



#announcementsContainer {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.credit-popup-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.credit-popup-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    position: relative;
    
}

.credit-popup-checkbox input[type="checkbox"] {
    /* 重置所有瀏覽器的默認樣式 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    /* 基本樣式 */
    width: 16px;
    height: 16px;
    min-width: 16px; /* 防止壓縮 */
    min-height: 16px; /* 防止壓縮 */
    border: 2px solid #cbd5e0;
    border-radius: 3px;
    cursor: pointer;
    margin: 0;
    padding: 0;
    background-color: #fff;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box;
    
}

/* 勾選狀態 */
.credit-popup-checkbox input[type="checkbox"]:checked {
    background-color: #ff9c26;
    border-color: #ff9c26;
}

/* 勾選標記 */
.credit-popup-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* label 樣式 */
.credit-popup-checkbox label {
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding-left: 4px;
    display: inline-block;
    vertical-align: middle;
}

/* 移除任何可能的框線效果 */
.credit-popup-checkbox input[type="checkbox"]:focus {
    outline: none;
    box-shadow: none;
}

/* 確保在不同瀏覽器中的一致性 */
.credit-popup-checkbox input[type="checkbox"]::before,
.credit-popup-checkbox input[type="checkbox"]::after {
    box-sizing: border-box;
    background: none !important;
}

.meta-info {
    display: flex;
    align-items: center;
    justify-content: right;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: #666;
    font-size: 1.2rem; /* 稍微縮小字體 */
}



.announcement-category,
.announcement-date, .meta-separator {
    color: #b5b5b5; /* 使用更柔和的灰色 */
}
.popup-main-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: #666666;
    text-align: center;
    padding: 0.5rem 0 1.5rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #edf2f7;
}


@media (max-width: 768px) {
    .credit-popup {
        width: 90%; 
        max-width: 90%; 
        margin: 0; 
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        padding: 1rem;
    }

    /* 確保內容容器不會超出邊界 */
    #announcementsContainer {
        padding-right: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* 調整公告項目的padding */
    .announcement-item {
        padding: 1rem;
        margin: 0 0 1rem 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* 調整內容padding */
    .announcement-content {
        padding: 0 1rem;
        width: 100%;
        box-sizing: border-box;
    }
}
