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

/* ==================== Header & Button ==================== */
.edm-header-actions {
    display: flex;
    margin-bottom: 30px;
}

.edm-subscribe-btn {
    background-color: #930B7F;
    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;
}

.edm-subscribe-btn:hover {
    background-color: #7a0860;
    transform: translateY(-2px);
}

/* ==================== Grid Layout (Default) ==================== */
.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(3, 1fr);
    }
}

/* Grid Card Styles */
.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%;
    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;
}

.edm-layout-grid .edm-date {
    color: #930B7F;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

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

/* ==================== List Layout (Compact) ==================== */
.edm-layout-list .edm-newsletters-list {
    display: flex;
    flex-direction: column;
    gap: 15px; /* 列表項目之間的間距 */
}

.edm-layout-list .edm-item {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    /* List 樣式不使用 shadow 讓畫面更乾淨 */
}

.edm-layout-list .edm-item:hover {
    background-color: #fcfcfc;
    border-color: #930B7F; /* Hover 時邊框變色 */
}

.edm-layout-list .edm-content {
    padding: 15px 20px;
    display: flex;
    flex-direction: row; /* 預設水平排列 */
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.edm-layout-list .edm-date {
    color: #930B7F;
    font-size: 14px;
    font-weight: 600;
    min-width: 120px; /* 固定日期寬度，讓標題對齊 */
    flex-shrink: 0;
}

.edm-layout-list .edm-title {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    flex-grow: 1; /* 標題佔據剩餘空間 */
    line-height: 1.4;
}

/* Mobile RWD for List View */
@media (max-width: 600px) {
    .edm-layout-list .edm-content {
        flex-direction: column; /* 手機版改為垂直排列 */
        align-items: flex-start;
        gap: 8px;
    }

    .edm-layout-list .edm-date {
        font-size: 12px;
        min-width: auto;
    }
}

/* ==================== Common Elements ==================== */
.edm-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.edm-excerpt {
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

/* ==================== Modal (彈窗) ==================== */
.edm-modal {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s;
}

.edm-modal-content {
    background-color: #fefefe;
    margin: 10vh auto;
    padding: 40px;
    border: 1px solid #888;
    width: 90%;
    max-width: 420px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: slideDown 0.3s;
}

.edm-close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.edm-close:hover,
.edm-close:focus {
    color: #333;
}

.edm-modal h2 {
    color: #930B7F;
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
    font-size: 24px;
}

#edmForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#edmForm input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
}

#edmForm input:focus {
    border-color: #930B7F;
    outline: none;
}

#edmForm button {
    background-color: #930B7F;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: background-color 0.3s;
}

#edmForm button:hover {
    background-color: #7a0860;
}

#edmMessage {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}