/* ==================== Container ==================== */
.edm-newsletter-container {
    position: relative;
    margin: 0 auto;
    padding: 20px 0;
}

/* ==================== Header & Actions ==================== */
.edm-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.edm-subscribe-btn {
    background: #ef821d !important;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-decoration: none; /* 確保連結沒有下底線 */
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.edm-subscribe-btn:hover {
    background: #e3740c !important;
    transform: translateY(-2px);
    color: white;
}

/* View Switcher Buttons */
.edm-view-switcher {
    display: flex;
    gap: 5px;
}

.edm-view-btn {
    background: #fff;
    border: 1px solid #ddd;
    color: #666;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.edm-view-btn:hover {
    background: #f9f9f9;
    color: #333;
}

.edm-view-btn.active {
    background: #ef821d;
    color: #fff;
    border-color: #ef821d;
}

/* ==================== 1. Grid Layout (Card View - 保持原樣) ==================== */
.edm-layout-grid .edm-newsletters-list {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 30px;
}

@media (min-width: 768px) {
    .edm-layout-grid .edm-newsletters-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .edm-layout-grid .edm-newsletters-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

.edm-layout-grid .edm-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid #eee;
}

.edm-layout-grid .edm-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.edm-layout-grid .edm-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #f0f0f0;
}

.edm-layout-grid .edm-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.edm-layout-grid .edm-item:hover .edm-image-wrapper img {
    transform: scale(1.05);
}

.edm-layout-grid .edm-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column-reverse; /* 讓 Grid 模式下日期在標題上面 (如果需要) */
}
/* 因為 PHP 改了順序 (標題在前，日期在後)，Grid 模式下若想維持 日期在標題上方，
   可以用 flex-direction: column-reverse，或者保留 PHP 標題在下。
   這裡假設 Grid 模式也顯示 標題 -> 日期 是可接受的，或者使用 order CSS。
*/
.edm-layout-grid .edm-date {
    color: #2C92B8;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px; /* 標題下方的間距 */
}

.edm-layout-grid .edm-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
    color: #333;
    font-weight: 700;
}

/* ==================== 2. List Layout (Compact View - 仿 sris-events) ==================== */

/* 外層容器：表格化 */
.edm-layout-list .edm-newsletters-list {
    display: flex;
    flex-direction: column;
    gap: 0; 
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

/* 單列樣式：列分隔 */
.edm-layout-list .edm-item {
    background-color: #fff;
    border: none;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    position: relative;
    transition: background-color 0.2s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    min-height: 60px; /* 緊湊高度 */
}

.edm-layout-list .edm-item:last-child {
    border-bottom: none;
}

.edm-layout-list .edm-item:hover {
    background-color: #f8fcfd; /* Hover 淡藍色 */
}

/* [關鍵] 列表模式隱藏圖片 */
.edm-layout-list .edm-image-wrapper {
    display: none;
}

/* 內容區：橫向排列 */
.edm-layout-list .edm-content {
    flex: 1;
    width: 100%;
    padding: 15px 25px;
    display: flex;
    flex-direction: row; 
    align-items: center;
    justify-content: space-between; /* 標題靠左，日期靠右 */
    gap: 20px;
}

/* 標題欄位：自動填滿 */
.edm-layout-list .edm-title {
    flex: 1 1 auto;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

/* 日期欄位：固定寬度靠右 */
.edm-layout-list .edm-date {
    flex: 0 0 120px; /* 固定寬度 */
    color: #888;     /* 灰色 */
    font-size: 14px;
    font-weight: normal;
    text-align: right; /* 文字靠右對齊 */
}

/* 共用連結覆蓋層 */
.edm-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* Mobile RWD for List View */
@media (max-width: 600px) {
    .edm-layout-list .edm-content {
        flex-direction: column; /* 手機版變回上下堆疊 */
        align-items: flex-start;
        gap: 5px;
        padding: 12px 15px;
    }
    
    .edm-layout-list .edm-date {
        flex: 0 0 auto;
        width: 100%;
        text-align: left; /* 手機版日期靠左 */
        font-size: 12px;
        color: #999;
    }
}