/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 移动端性能优化 */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: rgba(255, 255, 255, 0.95);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 219, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* 容器 */
.container {
    max-width: 414px;
    margin: 0 auto;
    padding: 0 12px 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 100vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* 公告栏 */
.announcement-bar {
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.9), rgba(74, 85, 104, 0.9));
    backdrop-filter: blur(10px);
    border-radius: 0 0 15px 15px;
    margin: -1px -12px 12px -12px;
    padding: 12px 16px;
    position: relative;
    border: 1px solid rgba(99, 179, 237, 0.2);
}

.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.announcement-item {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.4;
    padding: 2px 0;
    display: block;
}

.announcement-item:before {
    content: "• ";
    color: rgba(255, 255, 255, 0.8);
    font-weight: bold;
    margin-right: 4px;
}



/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px 0;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* 主要内容区域 */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 卡片容器 */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

/* 流量卡卡片 */
.card {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 12px;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    will-change: transform;
    transform: translateZ(0);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 20px;
    z-index: -1;
}

.card:hover {
    transform: translateY(-4px) scale(1.02) translateZ(0);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}



/* 卡片头部 - h3和span在同一行 */
.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    position: relative;
}

/* 折叠状态下的卡片内容 */
.card-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    will-change: max-height, opacity;
    transform: translateZ(0);
}

/* 展开状态 */
.card.expanded .card-content {
    max-height: 300px;
    opacity: 1;
}



/* 价格信息 */
.price-info {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}

.card-header .card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, 
        rgba(120, 219, 255, 0.9) 0%, 
        rgba(255, 119, 198, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex: 1;
}

.card-header .price,
.card-header .data-info,
.card-header .duration {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 6px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
}

.card-header .price {
    background: rgba(120, 219, 255, 0.25);
    color: rgba(120, 219, 255, 1);
    border-color: rgba(120, 219, 255, 0.4);
}

.card-header .data-info {
    background: rgba(255, 119, 198, 0.25);
    color: rgba(255, 119, 198, 1);
    border-color: rgba(255, 119, 198, 0.4);
}

.card-header .duration {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.25);
}

/* 卡片底部 - div和a在同一行 */
.card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.card-footer .requirements {
    flex: 1;
    margin: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.4;
}

.card-footer .card-button {
    flex-shrink: 0;
    width: auto;
    min-width: 80px;
    padding: 8px 16px;
    margin: 0;
}

/* 运营商标识 */
.operator-badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 6px;
}

.operator-badge.广电 {
    background: #e8f5e8;
    color: #2e7d32;
}

.operator-badge.移动 {
    background: #e3f2fd;
    color: #1976d2;
}

.operator-badge.联通 {
    background: #fff3e0;
    color: #f57c00;
}

.operator-badge.电信 {
    background: #fce4ec;
    color: #c2185b;
}

/* 地区标识 */
.region-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    background: #ff5722;
    color: white;
    margin-left: 8px;
}

/* 描述信息 */
.description {
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* 归属地信息 */
.region-info {
    font-size: 11px;
    line-height: 1.3;
    color: rgba(255, 193, 7, 0.95);
    margin-bottom: 8px;
    background: rgba(255, 193, 7, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 193, 7, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: pre-line;
}

/* 按钮 */
.card-button {
    background: linear-gradient(135deg, 
        rgba(120, 219, 255, 0.9) 0%, 
        rgba(255, 119, 198, 0.9) 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 12px rgba(120, 219, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.card-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.card-button:hover::before {
    left: 100%;
}

.card-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 10px 25px rgba(120, 219, 255, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #ff77c6 0%, #78dbff 100%);
}

.card-button:active {
    transform: translateY(0) scale(1.02);
}

/* 底部版权 */
.footer {
    text-align: center;
    margin-top: 12px;
    padding: 12px 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    border-radius: 15px 15px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: -8px;
    flex-shrink: 0;
}

.footer p {
    margin: 2px 0;
    line-height: 1.4;
}

.footer p {
    margin: 4px 0;
}

/* 备案链接样式 */
.footer .beian-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.footer .beian-link:hover {
    color: inherit;
    text-decoration: none;
}

/* 工具按钮容器 */
.tools-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}



/* 筛选按钮容器 */
.filter-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    /* 移动端优化 */
    -webkit-overflow-scrolling: touch;
    padding: 0 10px;
}

/* 移动端特定样式 */
@media screen and (max-width: 768px) {
    .filter-buttons {
        gap: 4px;
        padding: 0 5px;
    }
    
    .filter-button {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        /* 移动端触摸优化 */
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
}

/* 筛选按钮 */
.filter-button {
    /* 备用背景色，兼容不支持rgba的浏览器 */
    background: #333;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid #666;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    /* 简化transition，提高兼容性 */
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    /* 移除backdrop-filter，使用更兼容的样式 */
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
    /* 添加webkit前缀支持 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* 防止文本选择 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.filter-button:hover,
.filter-button:focus {
    background: #555;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border-color: #999;
    border-color: rgba(255, 255, 255, 0.5);
    /* 移除transform，避免兼容性问题 */
}

.filter-button.active {
    /* 备用背景色 */
    background: #667eea;
    background: -webkit-linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: -moz-linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: -o-linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    /* 简化box-shadow */
    -webkit-box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    -moz-box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.filter-button.active:hover,
.filter-button.active:focus {
    background: #764ba2;
    background: -webkit-linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    background: -moz-linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    background: -o-linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    -webkit-box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
    -moz-box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
}

/* 一证通查按钮特殊样式 */
.filter-button.tool-modal-button {
    background: #667eea;
    background: -webkit-linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: -moz-linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: -o-linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    -webkit-box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    -moz-box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.filter-button.tool-modal-button:hover,
.filter-button.tool-modal-button:focus {
    background: #764ba2;
    background: -webkit-linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    background: -moz-linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    background: -o-linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    -webkit-box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
    -moz-box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
}

/* 弹窗遮罩 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

/* 弹窗内容 */
.modal-content {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    max-width: 320px;
    width: 80%;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

/* 弹窗头部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.close-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* 弹窗主体 */
.modal-body {
    padding: 16px;
}

/* 工具区块 */
.tool-section {
    margin-bottom: 14px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.tool-section:last-child {
    margin-bottom: 0;
}

.tool-section h4 {
    margin: 0 0 6px 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.tool-section p {
    margin: 0 0 10px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    line-height: 1.3;
}

/* 工具链接 */
.tool-link {
    display: inline-block;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 11px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 6px rgba(79, 172, 254, 0.3);
}

.tool-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(79, 172, 254, 0.4);
}

/* 运营商链接容器 */
.operator-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* 运营商链接 */
.operator-link {
    display: inline-block;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 11px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color: white;
}

.operator-link.mobile {
    background: linear-gradient(135deg, #00c851 0%, #007e33 100%);
    box-shadow: 0 2px 6px rgba(0, 200, 81, 0.3);
}

.operator-link.unicom {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    box-shadow: 0 2px 6px rgba(255, 68, 68, 0.3);
}

.operator-link.telecom {
    background: linear-gradient(135deg, #33b5e5 0%, #0099cc 100%);
    box-shadow: 0 2px 6px rgba(51, 181, 229, 0.3);
}

.operator-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* 步骤说明 */
.steps {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
}

.steps ol {
    padding-left: 14px;
    margin: 6px 0;
}

.steps li {
    margin: 4px 0;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.85);
}

.steps .note {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 6px;
    padding: 6px;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 10px;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 375px) {
    .container {
        padding: 16px 12px;
    }
    
    .header {
        margin: -16px -12px 24px -12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .price {
        font-size: 18px;
    }
}

/* 错误状态 */
.error {
    text-align: center;
    padding: 40px 20px;
    color: #f44336;
    background: #ffebee;
    border-radius: 8px;
    margin: 20px 0;
}

.error h3 {
    margin-bottom: 8px;
}

/* 动画效果 */
.card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}