:root {
    --primary-color: #ff4d4f; /* Meituan Red */
}
body {
    background-color: #f6f6f6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.search-keyword-hidden {
    display: none;
}

.results-view-hidden {
    display: none;
}

.pagination-hidden {
    display: none;
}

.footer-badge-icon {
    margin-right: 8px;
}

.official-name {
    color: #333;
    font-weight: 600;
}

/* Initial Centered View */
.initial-view {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #fff0f0 0%, #ffffff 100%);
    transition: all 0.5s ease;
    position: relative;
    overflow: hidden;
}
/* Decorative background elements */
.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
}
.bg-blob-1 {
    width: 400px;
    height: 400px;
    background: #ffccc7; /* light red */
    top: -100px;
    left: -100px;
}
.bg-blob-2 {
    width: 300px;
    height: 300px;
    background: #fff1f0;
    bottom: -50px;
    right: -50px;
}

.initial-view .content-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.initial-view .logo-title {
    font-size: 48px;
    font-weight: 600;
    background: linear-gradient(45deg, #ff4d4f, #ff7875);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-align: center;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    text-shadow: 0 10px 20px rgba(255, 77, 79, 0.1);
}

.initial-view .sub-title {
    font-size: 16px;
    color: #888;
    margin-bottom: 20px;
    letter-spacing: 4px;
    font-weight: 300;
}

.initial-view .search-wrapper {
    width: 100%;
    max-width: 720px;
    padding: 0 20px;
    box-sizing: border-box; /* Prevent padding from overflowing width */
}
.initial-view .search-box {
    position: relative;
    transition: transform 0.3s;
}
.initial-view .search-box:hover {
    transform: translateY(-2px);
}
.initial-view .layui-input {
    height: 60px;
    border-radius: 30px;
    padding-left: 30px;
    padding-right: 140px;
    font-size: 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08); /* Stronger shadow */
    border: 1px solid white;
    transition: all 0.3s;
    background: rgba(255,255,255,0.9);
}
.initial-view .layui-input:focus {
    box-shadow: 0 12px 40px rgba(255, 77, 79, 0.15);
    border-color: var(--primary-color);
    background: #fff;
}
.initial-view .search-btn {
    position: absolute;
    right: 6px;
    top: 6px;
    height: 48px;
    border-radius: 24px;
    background: linear-gradient(135deg, #ff7875 0%, #ff4d4f 100%);
    border: none;
    padding: 0 35px;
    font-size: 18px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.3);
    transition: all 0.3s;
}
.initial-view .search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 77, 79, 0.4);
}

/* Hot Search Tags */
.hot-search {
    margin-top: 20px; /* Reduced top margin */
    display: flex;
    gap: 10px; /* Tighter gap */
    color: #666;
    font-size: 14px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    max-width: 600px; /* Constrain width to prevent too much spread */
    margin-left: auto;
    margin-right: auto;
}
.hot-tag {
    cursor: pointer;
    padding: 6px 14px; /* Slightly more compact */
    background: rgba(255,255,255,0.7); /* Slightly more opaque */
    border-radius: 20px;
    transition: all 0.2s;
    color: #555; /* Slightly darker to contrast better */
    font-size: 13px;
    white-space: nowrap; /* Prevent tag text wrapping */
}
.hot-tag:hover {
    color: var(--primary-color);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Coupon Buttons */
.coupon-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 800px;
}
.coupon-btn {
    cursor: pointer;
    border-radius: 50px;
    border: 1px solid #ffe5e5;
    background: #fff;
    color: #ff4d4f;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.08);
    white-space: nowrap;
}
.coupon-btn:hover {
    background: linear-gradient(135deg, #ff7875 0%, #ff4d4f 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 77, 79, 0.25);
}

/* Results View (Normal) */
.normal-view.layui-container {
    padding-top: 140px; /* Increased space to prevent header overlap */
    min-height: 100vh;
    padding-bottom: 0px;
}
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    z-index: 10000; /* High z-index */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* Stronger shadow */
    padding: 12px 10px; /* Adjusted padding */
    display: none;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}
.mini-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    cursor: pointer;
}
.header-search {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 10px;
}
.header-search input {
    border-radius: 20px;
    background: #f5f5f5;
    border: none;
}
.header-search input:focus {
    background: #fff;
    border: 1px solid var(--primary-color);
}
.header-search button {
    border-radius: 20px;
    background: var(--primary-color);
    color: #fff;
}

.header-search-btn {
    border: none;
    background: #ff4d4f;
    color: #fff;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-summary {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
    padding: 0 5px;
}

.result-count {
    color: #ff4d4f;
    font-weight: bold;
}

.mobile-home-btn {
    display: none;
}

/* Card Styles */
#couponList.layui-col-space15 > * {
    padding-bottom: 6px;
}

.coupon-card {
    background: #fff;
    border-radius: 16px;
    transition: all 0.3s;
    min-height: 132px;
    height: auto;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
    margin-bottom: 0;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}
.coupon-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}
.list-img-wrap {
    position: relative;
    width: 132px;
    min-width: 132px;
    max-width: 132px;
    height: 132px;
    flex-shrink: 0;
    background: #f8f8f8;
    overflow: hidden;
}
.coupon-img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.coupon-card:hover .coupon-img {
    transform: scale(1.05);
}
.card-content {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 38px;
}
.sale-text {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}
.shop-info {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.shop-main {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.shop-icon {
    font-size: 13px;
}
.shop-main .layui-icon {
    color: #ff4d4f;
}
.shop-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.distance-text {
    color: #8f8f8f;
    font-size: 12px;
    white-space: nowrap;
}
.card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.price-wrap {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 24px;
}
.price-currency {
    font-size: 14px;
}
.price-orig {
    font-size: 11px;
    color: #ccc;
    text-decoration: line-through;
    margin-left: 8px;
    font-weight: normal;
}
.action-btn {
    background: linear-gradient(135deg, #ff7875 0%, #ff4d4f 100%);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
}
.action-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.4);
}
.action-btn[disabled] {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
}
.biz-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff4d4f;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 12px;
    z-index: 2;
}
.biz-tag-waimai {
    background: #1890ff;
}
.biz-tag-tuangou {
    background: #ff4d4f;
}
.soldout-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 16px;
    font-weight: 600;
    z-index: 3;
}

/* Loading */
.loading-wrap {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Pagination Styling */
.pagination-wrapper {
    text-align: center;
    margin: 50px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.pagination-btn {
    height: 40px;
    padding: 0 24px;
    border-radius: 20px;
    border: 1px solid #eee;
    background: #fff;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.pagination-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.15);
}

.pagination-btn:active {
    transform: scale(0.98);
}

.page-num {
    height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1px;
}

.page-icon {
    font-size: 14px;
}

.results-qr-entry {
    cursor: pointer;
}

.results-official-name {
    color: #999;
    font-weight: bold;
}

.results-icp-wrap {
    margin-top: 10px;
}

.results-icp-link {
    color: #ccc;
    text-decoration: none;
}

/* Mobile specific adjustments */
@media screen and (max-width: 768px) {
    .normal-view.layui-container {
        padding-top: 80px; /* Increased mobile padding to prevent overlap with 2 lines */
    }
    .initial-view .logo-title {
        font-size: 28px;
        margin-bottom: 20px;
    }
    .initial-view .search-wrapper {
        padding: 0 10px; /* More space on sides for mobile */
    }
    .layui-container {
        padding: 0 10px;
    }
    .header-content {
        flex-direction: column;
        align-items: stretch; /* Stretch to fill width */
        gap: 10px;
    }
    .mini-title {
        display: none;
    }
    .header-search {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }
    .mobile-home-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        width: 38px;
        height: 38px;
        background: #f5f5f5;
        border-radius: 50%;
        color: #666;
        cursor: pointer;
        margin-right: 5px; /* Adjust gap */
    }
    .mobile-home-btn:active {
        background: #e6e6e6;
        color: var(--primary-color);
    }

    #couponList.layui-col-space15 > * {
        padding-bottom: 4px;
    }

    .coupon-card {
        border-radius: 14px;
        height: 122px;
        margin-bottom: 0;
    }
    .list-img-wrap {
        width: 122px;
        min-width: 122px;
        max-width: 122px;
        height: 122px;
    }
    .card-content {
        padding: 8px 10px 7px;
    }
    .card-title {
        font-size: 14px;
        margin-bottom: 3px;
        min-height: 30px;
    }
    .sale-text {
        font-size: 11px;
        margin-bottom: 3px;
    }
    .shop-info {
        font-size: 12px;
        margin-bottom: 4px;
    }
    .distance-text {
        font-size: 12px;
    }
    .price-wrap {
        font-size: 20px;
    }
    .price-currency {
        font-size: 13px;
    }
    .price-orig {
        font-size: 10px;
        margin-left: 6px;
    }
    .action-btn {
        font-size: 12px;
        padding: 7px 12px;
        border-radius: 16px;
    }
    .biz-tag {
        top: 6px;
        right: 6px;
        padding: 5px 7px;
        font-size: 11px;
    }
}
