/* ============= 基础样式重置 ============= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --color-primary: #ff4d6d;
    --color-primary-dark: #ff2a54;
    --color-tag-bg: #eef3ff;
    --color-tag-text: #4a7dff;
    --color-claim: #ff3b5c;
    --color-desc: #333333;
    --color-title: #1f222b;
    --color-text-sub: #8a8f9b;
    --color-page-bg: #f5f6fb;
    --color-white: #ffffff;
    --color-body-bg: #fff0f1;
    --color-amount: #ff3b5c;
    --color-sidebar-bg: #ffffff;
    --color-sidebar-hover: #f8f9fa;
    --color-sidebar-active: #ffffff;
    --color-sidebar-active-border: #4a7dff;
    --radius-card: 16px;
    --radius-btn: 8px;
    --radius-tag: 999px;
    --radius-logo: 8px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC',
        'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-page-bg);
    min-height: 100vh;
    color: var(--color-title);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============= 顶部Banner ============= */
.header {
    background: linear-gradient(135deg, #9dd6ff 0%, #6ba7ff 50%, #8bc4ff 100%);
    padding: 0;
}

.banner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.banner-emoji {
    font-size: 36px;
    line-height: 1;
}

.banner-text {
    display: flex;
    flex-direction: column;
}

.banner-sub {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-bottom: 4px;
}

.banner-main {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.banner-right {
    display: flex;
    align-items: center;
}

.banner-badge {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 999px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ============= 主内容区：两栏布局 ============= */
.main {
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    min-height: calc(100vh - 80px);
}

/* 左侧分类导航 */
.sidebar {
    width: 180px;
    flex-shrink: 0;
    background: var(--color-sidebar-bg);
    border-right: 1px solid #f0f1f5;
}

.category-nav {
    padding: 10px 0;
}

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.category-item {
    padding: 14px 20px;
    font-size: 0.92rem;
    color: #4a4f59;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.category-item:hover {
    background: var(--color-sidebar-hover);
    color: #2d3138;
}

.category-item.active {
    background: var(--color-sidebar-active);
    color: #2d3138;
    font-weight: 600;
    border-left-color: var(--color-sidebar-active-border);
    background: linear-gradient(90deg, rgba(74, 125, 255, 0.06) 0%, transparent 100%);
}

/* 右侧内容区域 */
.content-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.coupons-section {
    padding-top: 0;
}

/* 优惠券容器：单列 + 竖向间距 */
.coupons-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============= 单个优惠券卡片（设计图复刻） ============= */
.coupon-card {
    background: var(--color-white);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(31, 34, 43, 0.04);
    position: relative;
    transition: box-shadow 0.2s ease;
}

.coupon-card:hover {
    box-shadow: 0 4px 16px rgba(31, 34, 43, 0.08);
}

/* 卡片顶部：白色行 */
.coupon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--color-white);
}

.coupon-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coupon-logo-wrap {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-logo);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(31, 34, 43, 0.08);
}

.coupon-logo-wrap.no-logo::after {
    content: '🎟';
    font-size: 18px;
}

.coupon-logo-wrap.logo-meituan {
    background: linear-gradient(135deg, #ffe58a, #ffca3a);
}

.coupon-logo-wrap.logo-eleme {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
}

.coupon-logo-wrap.logo-taobao {
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
}

.coupon-logo-wrap.logo-didi {
    background: linear-gradient(135deg, #ffd93d, #ff9f43);
}

.coupon-logo-wrap.logo-jingdong {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.coupon-logo-wrap.logo-taopiaopiao {
    background: linear-gradient(135deg, #ff6b6b, #c0392b);
}

.coupon-logo-wrap.logo-maoyan {
    background: linear-gradient(135deg, #ff6b6b, #e74c3c);
}

.coupon-logo-wrap.logo-douyin {
    background: linear-gradient(135deg, #fe4a49, #ff9f43);
}

.coupon-logo-wrap.logo-pinduoduo {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
}

.coupon-logo-wrap.logo-weixin {
    background: linear-gradient(135deg, #00c6fb, #005bea);
}

.coupon-logo-wrap.logo-kendeji {
    background: linear-gradient(135deg, #ff6b6b, #c0392b);
}

.coupon-logo-wrap.logo-ruixing {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
}

.coupon-logo-wrap.logo-xingbake {
    background: linear-gradient(135deg, #ff9f43, #fdcb6e);
}

.coupon-logo-wrap.logo-gaode {
    background: linear-gradient(135deg, #00c6fb, #00cec9);
}

.coupon-logo-wrap.logo-tongcheng {
    background: linear-gradient(135deg, #fdcb6e, #ff9f43);
}

.coupon-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.coupon-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-title);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 右上角领取人数：红色 */
.claim-count {
    font-size: 0.82rem;
    color: var(--color-claim);
    font-weight: 500;
    white-space: nowrap;
    padding: 4px 0;
}

/* 卡片底部：粉色背景行 */
.coupon-body {
    display: flex;
    background: var(--color-body-bg);
    padding: 14px 16px;
}

/* 左侧金额区 */
.coupon-amount {
    width: 110px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px dashed #f5c6cd;
}

.amount-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-amount);
    white-space: nowrap;
}

/* 右侧信息区 */
.coupon-info {
    flex: 1;
    padding-left: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.coupon-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

/* 标签胶囊：浅蓝底蓝字 */
.coupon-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-tag-text);
    background: var(--color-tag-bg);
    border-radius: var(--radius-tag);
    white-space: nowrap;
}

/* 描述文字：黑色/灰色 */
.coupon-desc {
    font-size: 0.82rem;
    color: var(--color-desc);
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 右下角领取按钮：矩形带 8px 圆角 + 红色渐变 */
.coupon-action-btn {
    align-self: flex-end;
    flex-shrink: 0;
    min-width: 76px;
    padding: 7px 16px;
    border: none;
    border-radius: var(--radius-btn);
    background: linear-gradient(135deg, #ff5d78 0%, #ff2a54 100%);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 58, 92, 0.2);
    transition: all 0.15s ease;
}

.coupon-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 58, 92, 0.25);
}

.coupon-action-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(255, 58, 92, 0.2);
}

.coupon-action-btn.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.2);
}

/* ============= 加载与空状态 ============= */
.loading,
.no-data,
.error {
    text-align: center;
    padding: 48px 20px;
    background: #fff;
    border-radius: var(--radius-card);
    color: var(--color-text-sub);
    font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(31, 34, 43, 0.04);
}

.error {
    color: #ef4444;
}

.loading-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(75, 107, 255, 0.12);
    border-top-color: #4a6fff;
    border-radius: 50%;
    margin: 0 auto 12px auto;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============= 复制成功提示 Toast ============= */
.copy-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translate(-50%, -120%);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.05rem;
}

/* ============= 二维码模态框 ============= */
.qr-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.qr-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
}

.qr-modal-content {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 28px 24px 24px 24px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: modalIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.qr-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 30px;
    height: 30px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    font-size: 1.3rem;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
}

.qr-modal-close:hover,
.qr-modal-close:active {
    background: #f3f4f6;
    color: #374151;
}

.qr-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 18px;
}

.qr-modal-code {
    width: 220px;
    height: 220px;
    margin: 0 auto;
    padding: 10px;
    background: #fff;
    border: 2px solid #eef0f6;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-modal-code img,
.qr-modal-code canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.qr-modal-hint {
    margin-top: 14px;
    font-size: 0.82rem;
    color: var(--color-text-sub);
    font-weight: 500;
}

/* ============= 响应式适配 ============= */
@media (max-width: 768px) {
    .sidebar {
        width: 120px;
    }

    .category-item {
        padding: 12px 10px;
        font-size: 0.85rem;
        text-align: center;
    }

    .content-area {
        padding: 10px;
    }

    .banner-main {
        font-size: 1.5rem;
    }

    .banner-emoji {
        font-size: 28px;
    }

    .coupon-title {
        font-size: 1.05rem;
    }

    .coupon-action-btn {
        min-width: 70px;
        padding: 6px 14px;
        font-size: 0.84rem;
    }

    .coupon-logo-wrap {
        width: 32px;
        height: 32px;
    }

    .amount-text {
        font-size: 1.35rem;
    }

    .coupon-desc {
        font-size: 0.78rem;
    }

    .coupon-amount {
        width: 85px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1100px;
    }

    .sidebar {
        width: 200px;
    }

    .category-item {
        padding: 16px 24px;
        font-size: 0.95rem;
    }
}
