/**
 * DAYOFF 彈出廣告樣式
 * 頁面一半大小，響應式設計
 */

/* 背景遮罩 */
.dayoff-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dayoff-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 彈出容器 - 頁面一半大小 */
.dayoff-popup-container {
    position: relative;
    width: 50vw;
    height: auto;
    max-width: 800px;
    max-height: 80vh;
    min-width: 300px;
    min-height: 250px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: visible;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dayoff-popup-overlay.active .dayoff-popup-container {
    transform: scale(1);
}

/* 關閉按鈕 */
.dayoff-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: #333;
    transition: background-color 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dayoff-popup-close:hover {
    background-color: #f44336;
    color: #fff;
}

.dayoff-popup-close span {
    display: block;
    margin-top: -2px;
}

/* 內容區域 */
.dayoff-popup-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    min-height: 0; /* 重要：讓 flex 子元素可以正確收縮 */
}

/* 標題 */
.dayoff-popup-title {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* 媒體區域 */
.dayoff-popup-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5f5f5;
    min-height: 300px;
    max-height: 70vh;
}

.dayoff-popup-media img,
.dayoff-popup-media video {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.dayoff-popup-media a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

/* 描述 */
.dayoff-popup-description {
    margin: 15px 0 0 0;
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

/* 按鈕區域 */
.dayoff-popup-buttons {
    margin-top: 15px;
    text-align: center;
}

.dayoff-popup-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.dayoff-popup-btn-primary {
    background-color: #007cba;
    color: #fff;
}

.dayoff-popup-btn-primary:hover {
    background-color: #005a87;
    color: #fff;
}

/* 響應式設計 */
@media screen and (max-width: 768px) {
    .dayoff-popup-container {
        width: 90vw;
        height: 60vh;
        max-width: none;
        max-height: none;
    }
    
    .dayoff-popup-title {
        font-size: 20px;
    }
    
    .dayoff-popup-content {
        padding: 15px;
    }
    
    .dayoff-popup-btn {
        padding: 10px 24px;
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .dayoff-popup-container {
        width: 95vw;
        height: 70vh;
    }
    
    .dayoff-popup-title {
        font-size: 18px;
    }
    
    .dayoff-popup-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* 動畫效果 */
@keyframes dayoff-popup-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dayoff-popup-overlay.active .dayoff-popup-container {
    animation: dayoff-popup-fade-in 0.3s ease forwards;
}

/* 防止背景滾動 */
body.dayoff-popup-open {
    overflow: hidden;
}

/* 優惠碼區域 */
.dayoff-popup-coupon {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    text-align: center;
}

.dayoff-popup-coupon-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.dayoff-popup-coupon-code {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 6px;
    border: 2px dashed #667eea;
}

.dayoff-popup-coupon-code .coupon-text {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

.dayoff-popup-copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background-color: #667eea;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dayoff-popup-copy-btn:hover {
    background-color: #5a6fd6;
}

.dayoff-popup-copy-btn.copied {
    background-color: #4caf50;
}

.dayoff-popup-copy-btn svg {
    width: 14px;
    height: 14px;
}

/* 響應式優惠碼 */
@media screen and (max-width: 768px) {
    .dayoff-popup-coupon {
        padding: 12px;
    }
    
    .dayoff-popup-coupon-code {
        padding: 8px 15px;
    }
    
    .dayoff-popup-coupon-code .coupon-text {
        font-size: 16px;
    }
    
    .dayoff-popup-copy-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}

@media screen and (max-width: 480px) {
    .dayoff-popup-coupon-code {
        flex-direction: column;
        gap: 8px;
    }
    
    .dayoff-popup-coupon-code .coupon-text {
        font-size: 18px;
    }
}
