/* * File: assets/css/public-base.css
 * Description: 賣場活動前台基礎樣式 (RWD Enabled: Mobile -> Desktop -> Ultra-Wide)
 */

:root {
    --se-container-max: 1200px;
    /* 標準桌機寬度 */
    --se-grid-gap: 10px;
    --se-card-min-width: 11rem;
}

/* --- 容器與重置 (Mobile First Base) --- */
.se-app-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f3f4f6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

/* 確保橫幅圓角生效 */
.se-banner-row,
.se-banner-row img,
.se-banner-row picture {
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
}

.se-app-container * {
    box-sizing: border-box;
}

/* 核心佈局容器 (前身為 .se-mobile-view) */
.se-mobile-view {
    width: 100%;
    /* [RWD Change] 移除 max-width: 390px 限制，預設 100% */
    background-color: #ffffff;
    min-height: 100vh;
    box-shadow: none;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 80px;
    transition: max-width 0.3s ease, margin 0.3s ease;
}

/* Ad Label */
.se-ad-label {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-top-left-radius: 6px;
    pointer-events: none;
    /* Ignore clicks */
    z-index: 10;
}

/* --- 通用工具 --- */
.se-flex {
    display: flex;
}

.se-items-center {
    align-items: center;
}

.se-justify-between {
    justify-content: space-between;
}

.se-flex-col {
    flex-direction: column;
}

/* Spacing */
.se-gap-2 {
    gap: 0.5rem;
}

.se-gap-3 {
    gap: 0.75rem;
}

.se-p-4 {
    padding: 1rem;
}

.se-mb-3 {
    margin-bottom: 0.75rem;
}

.se-mb-4 {
    margin-bottom: 1rem;
}

.se-mb-6 {
    margin-bottom: 1.5rem;
}

/* Text */
.se-text-center {
    text-align: center;
}

.se-font-bold {
    font-weight: 700;
}

.se-text-sm {
    font-size: 0.875rem;
}

.se-text-lg {
    font-size: 1.125rem;
}

.se-text-xl {
    font-size: 1.25rem;
}

.se-text-red {
    color: #dc2626;
}

.se-text-through {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.75rem;
    margin-left: 4px;
}

/* Price Blacklist V3 */
.se-price-blacklist-text,
.se-price-blacklist-link {
    display: inline-block;
    color: #dc2626;
    /* Red to match price style, or theme primary */
    font-weight: 700;
    font-size: 1rem;
    max-width: 7.5em;
    /* Approx 7 Chinese characters */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.se-price-blacklist-link {
    color: #2563eb;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: none;
    /* Reset shared limit */
}

.se-price-blacklist-link span {
    display: inline-block;
    max-width: 7.5em;
    /* 7 Characters */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.se-price-blacklist-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Savings Row (Landmark) */
.se-savings-row {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #ef4444;
    /* Tailwind red-500 */
    font-weight: 500;
}

/* Scrollbar Helper (Mobile Only) */
.se-hide-scrollbar {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.se-hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* --- 通用區塊佈局 --- */
.se-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin: 1.5rem 0 1rem 0;
    padding-left: 0.75rem;
    border-left: 4px solid #dc2626;
    line-height: 1.2;
}

/* 預設容器：水平捲動 (Mobile) */
.se-scroll-container {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 10px;
    overflow-x: auto;
    align-items: stretch;
}

/* 預設網格 (Mobile) */
.se-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: stretch;
}

/* [Universal Scrollbar] */
.se-progress-container {
    height: 4px;
    background: #e5e7eb;
    border-radius: 9999px;
    margin: 10px 10px 0 10px;
    position: relative;
    overflow: hidden;
    width: auto;
    max-width: 100%;
    /* display: block; Controlled by JS (none if no overflow) */
}

/* Specific Style for Theme Hall (Short) */
.se-theme-progress-mode {
    width: 60px;
    margin: 10px auto;
    /* Centered */
}

.se-progress-bar {
    position: absolute;
    height: 100%;
    width: 40px;
    background: #ec4899;
    border-radius: 9999px;
    top: 0;
    left: 0;
    transition: left 0.1s linear;
}

/* --- 頁面轉場 --- */
.se-page-view {
    display: none;
    animation: seFadeIn 0.3s ease-out;
}

.se-page-view.active {
    display: block;
}

@keyframes seFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* =========================================
   RWD Breakpoints Strategy
   ========================================= */

/* 1. Tablet (>= 768px): 解鎖滿版，增加間距 */
@media (min-width: 768px) {
    .se-app-container {
        padding: 20px;
        /* 讓內容不要貼齊瀏覽器邊緣 */
    }

    .se-mobile-view {
        border-radius: 8px;
        /* 增加卡片感 */
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        padding-bottom: 40px;
    }
}

/* 2. Desktop (>= 1024px): 網格化與佈局重組 */
@media (min-width: 1024px) {
    .se-mobile-view {
        max-width: var(--se-container-max);
        margin: 0 auto;
        /* 置中 */
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

    /* [Critical] 將水平捲動容器改為網格佈局 */
    .se-scroll-container {
        display: grid;
        /* 自動填滿，最小寬度 200px */
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
        overflow-x: visible;
        /* 停止捲動 */
        padding-bottom: 0;
    }

    .se-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }

    /* 隱藏捲動進度條 (因為已變為網格) */
    .se-progress-container {
        display: none;
    }

    /* 調整字體大小，提升閱讀舒適度 */
    .se-section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .se-font-bold {
        font-weight: 600;
    }
}

/* 3. Ultra-Wide (>= 1600px): 1920px & 4K 聚焦策略 */
@media (min-width: 1600px) {
    :root {
        --se-container-max: 1600px;
        /* 鎖定最大寬度，避免無限拉伸 */
    }

    .se-mobile-view {
        margin-top: 40px;
        margin-bottom: 40px;
        border-radius: 16px;
        /* 增加更深的陰影，營造「浮動」效果 */
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    }

    /* 增加網格密度，卡片稍微加大 */
    .se-scroll-container,
    .se-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 24px;
    }
}