/* TP2E Newsletter 前台樣式 */

/* 訂閱表單 */
.tp2e-newsletter-form {
    max-width: 500px;
    margin: 20px 0;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
}

.tp2e-form-group {
    margin-bottom: 15px;
}

.tp2e-form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tp2e-form-control:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.tp2e-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tp2e-btn-primary {
    background: #007cba;
    color: white;
}

.tp2e-btn-primary:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 124, 186, 0.3);
}

.tp2e-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 訊息顯示 */
.tp2e-newsletter-message {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 5px;
    font-size: 14px;
}

.tp2e-newsletter-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.tp2e-newsletter-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 側邊欄訂閱表單 */
.widget .tp2e-newsletter-form {
    padding: 15px;
    background: white;
}

.widget .tp2e-form-control {
    padding: 10px 12px;
    font-size: 13px;
}

.widget .tp2e-btn {
    width: 100%;
    padding: 10px 20px;
    font-size: 13px;
}

/* 彈出式訂閱表單 */
.tp2e-newsletter-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 500px;
    width: 90%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
}

.tp2e-newsletter-popup.show {
    display: block;
    animation: popupShow 0.3s ease;
}

@keyframes popupShow {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.tp2e-popup-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px 10px 0 0;
    position: relative;
}

.tp2e-popup-header h3 {
    margin: 0;
    font-size: 20px;
}

.tp2e-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tp2e-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.tp2e-popup-content {
    padding: 30px;
}

.tp2e-popup-content .tp2e-newsletter-form {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

/* 取消訂閱頁面 */
.tp2e-unsubscribe-form {
    max-width: 500px;
    margin: 40px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.tp2e-unsubscribe-form h2 {
    color: #333;
    margin-bottom: 20px;
}

.tp2e-unsubscribe-form p {
    color: #666;
    margin-bottom: 25px;
}

/* 響應式設計 */
@media (max-width: 600px) {
    .tp2e-newsletter-form {
        padding: 20px;
    }
    
    .tp2e-form-control {
        padding: 10px 12px;
        font-size: 16px; /* 防止 iOS 縮放 */
    }
    
    .tp2e-btn {
        width: 100%;
    }
    
    .tp2e-newsletter-popup {
        width: 95%;
    }
    
    .tp2e-popup-content {
        padding: 20px;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .tp2e-newsletter-form {
        background: #2c3338;
        border-color: #3c434a;
    }
    
    .tp2e-form-control {
        background: #23282d;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .tp2e-form-control:focus {
        border-color: #007cba;
        background: #23282d;
    }
    
    .tp2e-newsletter-popup {
        background: #2c3338;
    }
    
    .tp2e-unsubscribe-form {
        background: #2c3338;
        color: #f0f0f1;
    }
    
    .tp2e-unsubscribe-form h2 {
        color: #f0f0f1;
    }
    
    .tp2e-unsubscribe-form p {
        color: #c3c4c7;
    }
}

/* 載入動畫 */
.tp2e-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.tp2e-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: tp2e-spin 1s linear infinite;
}

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

/* 電子報內容樣式 */
.tp2e-newsletter-content {
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

.tp2e-newsletter-content h1,
.tp2e-newsletter-content h2,
.tp2e-newsletter-content h3 {
    color: #23282d;
    margin: 20px 0 10px;
}

.tp2e-newsletter-content img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

.tp2e-newsletter-content a {
    color: #007cba;
    text-decoration: none;
}

.tp2e-newsletter-content a:hover {
    text-decoration: underline;
}

.tp2e-newsletter-content .button {
    display: inline-block;
    padding: 10px 20px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin: 10px 0;
}

.tp2e-newsletter-content .button:hover {
    background: #005a87;
    text-decoration: none;
}