/* 首页专属样式 */

/* 第一块：分级导航、轮播图、登录 */
.hero-section {
    display: grid;
    grid-template-columns: 220px 1fr 260px;
    gap: 15px;
    padding: 20px 0;
}

/* 分类导航 */
.category-nav {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: visible;
    position: relative;
    z-index: 100;
}

.category-nav-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 12px 15px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-list {
    padding: 5px 0;
}

.category-item {
    position: relative;
    z-index: 101;
}

.category-item:hover {
    z-index: 102;
}

.category-item > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    color: var(--text-dark);
    font-size: 13px;
    transition: var(--transition);
}

.category-item:hover > a {
    background: var(--bg-light);
    color: var(--primary-color);
}

.category-item i {
    font-size: 12px;
    color: var(--text-light);
}

.category-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    width: 500px;
    background: var(--white);
    border-radius: 0 12px 12px 0;
    box-shadow: var(--shadow-hover);
    padding: 15px;
    display: none;
    z-index: 1000;
}

.category-item:hover > .category-submenu {
    display: block;
}

.submenu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.submenu-column h4 {
    font-size: 13px;
    color: var(--primary-color);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.submenu-column ul li {
    margin-bottom: 6px;
}

.submenu-column ul li a {
    font-size: 12px;
    color: var(--text-light);
}

.submenu-column ul li a:hover {
    color: var(--primary-color);
}

/* 轮播图 */
.carousel-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 1;
}

.carousel {
    position: relative;
    height: 380px;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 25px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: var(--white);
}

.carousel-content h3 {
    font-size: 22px;
    margin-bottom: 8px;
}

.carousel-content p {
    font-size: 13px;
    opacity: 0.9;
}

.carousel-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.4);
    padding: 6px 14px;
    border-radius: 18px;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.carousel-dot:hover {
    background: rgba(255,255,255,0.8);
    transform: scale(1.1);
}

.carousel-dot.active {
    background: var(--primary-color);
    width: 28px;
    border-radius: 5px;
    border-color: var(--white);
    box-shadow: 0 0 6px rgba(201, 162, 39, 0.5);
}

/* 左右翻页按钮 */
.carousel-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.carousel-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.carousel-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: scale(1.1);
}

.carousel-btn i {
    font-size: 16px;
    color: var(--text-dark);
}

.carousel-btn:hover i {
    color: var(--white);
}

/* 登录面板 */
.login-panel {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
    z-index: 1;
}

.login-panel h3 {
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.login-form input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.login-form input:focus {
    border-color: var(--primary-color);
}

.login-form button {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
}

.login-links {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.login-links a {
    color: var(--text-light);
}

.login-links a:hover {
    color: var(--primary-color);
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
}

.stat-item .number {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-item .label {
    font-size: 12px;
    color: var(--text-light);
}

/* 第二块：最新成交、当日成交数据 */
.deals-section {
    padding: 30px 0;
    background: var(--white);
    margin: 20px 0;
}

.deals-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.latest-deals {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
}

.deals-carousel {
    position: relative;
    overflow: hidden;
    height: 360px; /* 调整高度以完全显示3条完整条目 */
}

.deals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.5s ease;
}

.deal-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    padding: 12px;
}

.deal-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.deal-img {
    width: 80px;
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    border-radius: 8px;
}

.deal-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-count {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.deal-info {
    flex: 1;
    min-width: 0;
}

.deal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.deal-tag {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.deal-tag.supply {
    background: var(--success-color);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(72, 187, 120, 0.3);
}

.deal-tag.recycle {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(201, 162, 39, 0.3);
}

.deal-info h4 {
    font-size: 14px;
    margin: 0;
    color: var(--text-dark);
    line-height: 1.4;
}

.deal-info p {
    font-size: 12px;
    color: var(--text-light);
    margin: 0 0 8px 0;
}

.deal-user {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.deal-user img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.deal-user span {
    font-size: 12px;
    color: var(--text-dark);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.deal-price .price {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-color);
}

.deal-price .time {
    font-size: 12px;
    color: var(--text-light);
}

/* 轮播导航按钮 */
.deals-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.deals-nav-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.deals-nav-btn:hover i {
    color: var(--white);
}

.deals-nav-btn i {
    font-size: 14px;
    color: var(--text-dark);
}

.deals-nav-btn.prev {
    left: 5px;
}

.deals-nav-btn.next {
    right: 5px;
}

/* 当日成交数据 */
.daily-stats {
    background: linear-gradient(135deg, rgba(233, 236, 239, 0.9) 0%, rgba(222, 226, 230, 0.9) 100%);
    border-radius: 12px;
    padding: 20px;
    color: var(--text-dark);
}

.platform-announcement {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.platform-announcement h4 {
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.platform-announcement ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.platform-announcement li {
    font-size: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.platform-announcement li i {
    color: var(--primary-color);
    margin-top: 2px;
    flex-shrink: 0;
}

.platform-announcement li a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.platform-announcement li a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.daily-stats h3 {
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-box {
    background: rgba(255,255,255,0.8);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-box i {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-box .value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-box .label {
    font-size: 13px;
    opacity: 0.8;
}

/* 第三块：热门品种行情 */
.market-section {
    padding: 30px 0;
}

.market-content {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.market-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.market-right {
    width: 300px;
    flex-shrink: 0;
}

.market-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.market-tab {
    padding: 8px 20px;
    background: var(--white);
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.market-tab.active,
.market-tab:hover {
    background: var(--primary-color);
    color: var(--white);
}

.market-carousel {
    position: relative;
    overflow: hidden;
    flex: 1;
    margin-top: 15px;
}

.market-carousel {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.market-table {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    flex: 1;
    max-height: 440px; /* 限制高度，只显示8条条目 */
    overflow-y: hidden;
}

.market-table table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 固定表格布局，确保列宽一致 */
}

.market-table thead {
    background: var(--bg-light);
}

.market-table th,
.market-table td {
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

/* 为每列设置固定宽度 */
.market-table th:nth-child(1),
.market-table td:nth-child(1) {
    width: 30%; /* 品种名称列 */
}

.market-table th:nth-child(2),
.market-table td:nth-child(2) {
    width: 20%; /* 最新价格列 */
}

.market-table th:nth-child(3),
.market-table td:nth-child(3) {
    width: 15%; /* 涨跌列 */
}

.market-table th:nth-child(4),
.market-table td:nth-child(4) {
    width: 20%; /* 成交量列 */
}

.market-table th:nth-child(5),
.market-table td:nth-child(5) {
    width: 15%; /* 操作列 */
}

.market-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
}

.market-table tr:last-child td {
    border-bottom: none;
}

.market-table .coin-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.market-table .coin-name img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.market-table .coin-name span {
    font-weight: 600;
    color: var(--text-dark);
}

.market-table .price-up {
    color: #4caf50;
}

.market-table .price-down {
    color: #e94560;
}

/* 分页按钮样式 */
.market-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
}

.market-page-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--text-dark);
}

.market-page-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.market-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.market-nav-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.market-nav-btn:hover i {
    color: var(--white);
}

.market-nav-btn i {
    font-size: 14px;
    color: var(--text-dark);
}

.market-nav-btn.prev {
    left: 10px;
}

.market-nav-btn.next {
    right: 10px;
}

.market-list .coin-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.market-list .coin-name img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.market-list .coin-name span {
    font-weight: 600;
    color: var(--text-dark);
}

.market-list .price-up {
    color: #4caf50;
}

.market-list .price-down {
    color: #e94560;
}

/* 右侧综合指数样式 */
.market-overview {
    background: linear-gradient(135deg, rgba(222, 226, 230, 0.9) 0%, rgba(206, 212, 218, 0.9) 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: 100%;
}

.market-overview h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.market-overview h3 i {
    color: var(--primary-color);
}

.overview-card {
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.overview-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
    background: var(--white);
}

.overview-card .icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.overview-card .content {
    flex: 1;
}

.overview-card .title {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.overview-card .price {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.overview-card .change {
    font-size: 12px;
    font-weight: 500;
}

.overview-card .change.up {
    color: #4caf50;
}

.overview-card .change.down {
    color: #e94560;
}

/* 供应/回收板块 */
.supply-section,
.recycle-section {
    padding: 30px 0;
}

.supply-section {
    background: var(--white);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.card-badge.supply {
    background: #e8f5e9;
    color: #4caf50;
}

.card-badge.recycle {
    background: #fff3e0;
    color: #ff9800;
}

.card-badge.buy {
    background: #e3f2fd;
    color: #2196f3;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.card-meta .user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
}

.card-meta .user img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.card-meta .location {
    font-size: 12px;
    color: var(--text-light);
}

/* 资讯板块 */
.news-section {
    padding: 30px 0;
    background: var(--white);
}

.news-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.news-featured {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 280px;
}

.news-featured img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-featured-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: var(--white);
}

.news-featured-content .tag {
    margin-bottom: 10px;
}

.news-featured-content h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.news-featured-content .date {
    font-size: 12px;
    opacity: 0.8;
}

.news-list-small {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.news-item-small {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: var(--transition);
}

.news-item-small:hover {
    box-shadow: var(--shadow);
}

.news-item-small img {
    width: 100px;
    height: 70px;
    border-radius: 6px;
    object-fit: cover;
}

.news-item-content {
    flex: 1;
}

.news-item-content .category {
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.news-item-content h4 {
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-dark);
    line-height: 1.4;
}

.news-item-content .date {
    font-size: 12px;
    color: var(--text-light);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .hero-section {
        grid-template-columns: 200px 1fr 280px;
    }

    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .hero-section {
        grid-template-columns: 1fr;
    }

    .category-nav {
        display: none;
    }

    .carousel {
        height: 300px;
    }

    .deals-grid {
        grid-template-columns: 1fr;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .news-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .carousel {
        height: 200px;
    }

    .carousel-content h3 {
        font-size: 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .market-table {
        overflow-x: auto;
    }

    .market-table table {
        min-width: 600px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .deal-item {
        flex-direction: column;
        text-align: center;
    }

    .deal-price {
        text-align: center;
    }
}
