/* ========================================
   统一移动端样式文件
   整合自: xys.css, styles.css, DD/css/style.css, hyzx.css, admin.css
   ======================================== */

/* ===== 移动端响应式断点 ===== */
@media (max-width: 768px) {
    
    /* ===== 基础样式重置 ===== */
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        font-size: 13px;
        line-height: 1.6;
    }

    /* ===== 统一移动端边距 ===== */
    :root {
        --mobile-padding: 10px;
    }

    /* ===== 容器样式 ===== */
    .container {
        max-width: 768px;
        margin: 10px auto;
        padding: 0 10px;
    }

    /* ===== 页面特定边距调整 ===== */
    /* 所有页面使用统一的边距，参考关于我们页面 */
    .container {
        padding: 0 10px !important;
        margin: 10px auto !important;
    }

    /* 首页 - 使用统一边距 */
    .container.index-page {
        padding: 0 10px !important;
    }

    /* 产品列表页 - 使用统一边距 */
    .container.product-page {
        padding: 0 10px !important;
    }

    /* 资讯页 - 使用统一边距 */
    .container.news-page {
        padding: 0 10px !important;
    }

    /* 联系我们页 - 使用统一边距 */
    .container.contact-page {
        padding: 0 10px !important;
        margin: 10px auto !important;
    }

    /* 关于我们页 - 保持现有边距 */
    .container.about-page {
        padding: 0 10px !important;
    }

    /* 会员中心页 - 使用统一边距 */
    .container.member-center-page {
        padding: 0 10px !important;
    }

    /* 登录页 - 使用统一边距 */
    .container.login-page {
        padding: 0 10px !important;
    }

    /* 重置section的边距 */
    .section {
        padding: 0 !important;
        margin-bottom: 80px !important;
    }



    /* ===== 头部样式 ===== */
    header {
        padding: 10px 0;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    /* 隐藏桌面导航，显示移动端导航 */
    .desktop-nav,
    .header-actions {
        display: none;
    }

    .mobile-nav {
        display: block;
    }

    /* ===== 移动端底部导航 ===== */
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #fff;
        padding: 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
        z-index: 99;
    }

    .mobile-nav-content {
        display: flex;
        justify-content: space-around;
        align-items: flex-end;
        height: 40px;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        height: 100%;
        font-size: 18px;
        font-weight: bold;
        text-decoration: none;
        color: #CC272B;
        transition: all 0.3s ease;
        background-color: transparent;
        letter-spacing: 0.5px;
        text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    .mobile-nav-item a span {
        font-size: 18px;
    }

    .mobile-login-btn {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        color: #CC272B;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: -5px;
        font-weight: bold;
        transition: all 0.3s ease;
        text-decoration: none;
        position: relative;
        z-index: 100;
        background: transparent;
        border: none;
    }

    .mobile-avatar {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        object-fit: cover;
        margin: 0;
        display: block;
        z-index: 101;
        border: 2px solid #CC272B;
        box-shadow: none;
        transition: all 0.3s ease;
        position: relative;
    }

    .mobile-avatar-text {
        display: none;
    }

    /* ===== 移动端顶部登录注册导航 ===== */
    .F-mobile-nav-content {
        display: block;
        justify-content: space-around;
    }

    .F-mobile-nav-content ul li {
        list-style-type: none;
        padding: 0;
        margin: 0;
        justify-content: space-around;
    }

    #mobile-nav-menu {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 15px;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    #mobile-nav-menu li {
        list-style: none;
        display: inline-flex;
        margin: 0;
    }

    #mobile-nav-menu li a {
        white-space: nowrap;
    }

    /* ===== 页脚样式 ===== */
    footer {
        background-color: #CC272B;
        color: white;
        padding: 15px 0;
        display: none;
    }

    .copyright {
        text-align: center;
        color: #d9c9b8;
        margin-bottom: 70px;
    }

    /* ===== 调整内容区域底部边距 ===== */
    .section:last-of-type {
        padding-bottom: 10px;
        margin-bottom: 60px;
    }

    /* ===== 首页样式 ===== */
    .hero-TP {
        height: 30vh;
    }

    .TP-title,
    .TP-desc {
        font-size: 1rem;
    }

    .works-grid {
        grid-template-columns: 1fr;
    }

    .works-grid .work-item .work-img {
        width: 100%;
        height: 220px;
        overflow: hidden;
        position: relative;
    }

    .work-img img {
        position: absolute;
        top: 0;
        left: 0;
        width: auto;
        height: 100%;
        min-width: 100%;
        object-fit: cover;
        object-position: center;
    }

    /* ===== 产品列表页样式 ===== */
    .product-page {
        flex-direction: column;
        padding-top: 15px;
        padding-bottom: 30px;
    }

    .sidebar {
        width: 100%;
        display: none;
    }

    /* 移动端隐藏收藏TOP10 */
    .top-collections {
        display: none;
    }

    /* 移动端分类一行显示两个 */
    .categories ul {
        display: flex;
        flex-wrap: wrap;
    }

    .categories li {
        width: 50%;
    }

    /* 移动端产品一列显示 */
    .product-grid {
        grid-template-columns: 1fr;
    }

    /* 移动端产品主图样式 */
    .main-image {
        width: 100% !important;
        height: 100% !important;
        min-height: auto;
    }

    .main-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
    }

    /* ===== 产品详情页样式 ===== */
    .product-media-content {
        flex-direction: column !important;
        gap: 10px;
    }

    .product-media-content .left,
    .product-media-content .right {
        width: 100%;
    }

    .product-info {
        margin-top: 20px;
    }

    .CPXQ-product-page {
        margin-top: 20px;
    }

    .product-media-section {
        margin-bottom: 10px;
    }

    .product-details-section {
        margin-bottom: 10px;
    }

    /* 只显示相关推荐中的前两个产品 */
    .CPXQ-section .related-products-grid .related-product-item:nth-child(n+3) {
        display: none;
    }

    /* 调整移动端同类推荐产品尺寸为48% */
    .CPXQ-section .related-products-grid {
        display: flex;
        flex-wrap: wrap;
    }

    .CPXQ-section .related-products-grid .related-product-item {
        width: 48%;
        flex: 0 0 48%;
    }

    /* 移动端产品详情页价格 */
    .current-price {
        color: #FFD700;
        font-weight: bold;
    }

    .current-price h3,
    .current-price h5 {
        color: red;
        display: inline;
    }

    /* 移动端使缩略图尺寸缩小 */
    .thumbnail {
        width: 100px;
        height: 100px;
    }

    .thumbnail-container {
        gap: 3px;
    }

    /* 移动端产品属性两列布局 */
    .product-specs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .spec-item {
        display: flex;
        flex-direction: row;
        padding: 0px 0;
        white-space: nowrap;
    }

    /* ===== 资讯列表页样式 ===== */
    .news-page {
        flex-direction: column;
        padding-top: 0px;
        padding-bottom: 0px;
    }

    .orders-list-grid {
        gap: 5px !important;
    }

    .pagination {
        margin-top: 20px !important;
        text-align: center !important;
    }

    .pagination-btn {
        margin: 0 3px !important;
        padding: 5px 10px !important;
    }

    .item-date {
        font-size: 0.75rem !important;
        color: #888 !important;
    }

    /* 移动端资讯详情页样式调整 */
    .about-page {
        padding: 0 !important;
        padding-bottom: 80px !important;
    }

    .news-detail-section {
        padding: 10px !important;
        border-radius: 4px !important;
    }

    .news-detail-section h1 p {
        font-size: 1rem !important;
    }

    .news-content {
        font-size: 14px !important;
        line-height: 1.5 !important;
        padding: 0 var(--mobile-padding) !important;
    }

    .news-meta {
        padding-bottom: 5px !important;
        margin-bottom: 5px !important;
    }

    .news-main-image {
        width: 100%;
        max-width: 100%;
        height: auto;
        display: block;
        margin: 5px 0 !important;
        border-radius: 4px !important;
    }

    .news-content-img {
        width: 100%;
        max-width: 100%;
        height: auto;
        display: block;
        margin: 5px 0 !important;
        border-radius: 4px !important;
    }

    .related-news-section {
        margin-top: 10px !important;
        padding-top: 10px !important;
    }

    .related-news-section .section-title {
        margin-bottom: 10px !important;
        font-size: 1rem !important;
    }

    .related-news-item {
        max-width: 100% !important;
    }

    .related-news-title {
        font-size: 0.9rem !important;
    }

    .back-button-container {
        margin-top: 5px !important;
    }

    /* ===== 关于和联系我们页面样式 ===== */
    .about-content {
        flex-direction: column-reverse;
        align-items: center;
        gap: 20px;
    }

    .about-content .left,
    .about-content .right {
        width: 100%;
        max-width: 500px;
    }

    .about-content .right img {
        width: 100%;
        height: auto;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .team-grid,
    .values-grid {
        grid-template-columns: 1fr;
    }

    .about-hero {
        background-color: #CC272B;
        color: white;
        text-align: center;
    }

    .about-hero img {
        width: 100%;
        height: 100%;
        overflow: hidden;
        background-color: white;
    }

    .about-hero h1 {
        font-size: 1.5rem;
    }

    /* ===== 登录注册页面样式 ===== */
    .htc__login__register {
        padding: 10px;
        min-height: calc(100vh - 60px);
        padding-bottom: 60px;
    }

    .htc__login__register__wrap {
        background-color: white;
        border-radius: 10px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        width: 100%;
        max-width: 480px;
        padding: 15px 20px;
    }

    .login__register__menu a {
        font-weight: bold;
        color: #CC272B;
        display: block;
        text-align: center;
    }

    .form-group input {
        width: 100%;
        padding: 10px;
        margin-bottom: 5px;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        transition: border-color 0.3s;
    }

    .tab-content {
        padding: 0px;
    }

    /* 登录页链接容器样式 */
    .forget-links {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }

    .forget-links .forget {
        margin: 0;
        padding: 0;
    }

    /* ===== 社交按钮样式 ===== */
    .social-btn {
        padding: 3px 6px;
    }

    .flex.flex-wrap.gap-4 {
        flex-direction: column;
        gap: 12px !important;
    }

    /* ===== 资讯卡片容器样式 ===== */
    .news-card-container {
        padding: var(--mobile-padding);
        margin-top: 20px;
        padding-bottom: var(--mobile-padding);
        margin-bottom: 50px;
    }

    .section {
        padding: var(--mobile-padding);
        margin-bottom: 100px;
    }

    .products {
        padding-bottom: 50px;
    }

    .pagination {
        margin-top: 15px;
        padding-bottom: 0;
    }

    .about-page {
        padding: var(--mobile-padding);
        padding-bottom: 80px;
    }

    /* ===== 资讯列表优化 ===== */
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .news-item img {
        height: 160px;
    }

    .news-title {
        font-size: 1rem;
    }

    .news-content {
        padding: 0 15px 20px;
    }

    .news-content p {
        text-indent: 1.5em;
    }

    /* 调整资讯列表左图右文样式 */
    .news-item {
        flex-direction: column;
    }

    .news-item .list-img {
        width: 100%;
        min-width: auto;
        height: 200px;
    }

    /* ===== 会员中心样式 ===== */
    .member-center-container {
        flex-direction: column;
        gap: 20px;
        padding: 2px;
    }

    .left-section,
    .right-section {
        flex: none;
        width: 100%;
        padding: 15px;
    }

    .direct-members-list,
    .favorites-list {
        grid-template-columns: 1fr;
    }

    .invite-link-container {
        flex-direction: column;
        gap: 10px;
    }

    .invite-link-container button {
        width: 100%;
        padding: 10px;
    }

    #avatar-preview {
        width: 110px;
        height: 110px;
    }

    /* ===== 订单列表样式 ===== */
    .orders-list-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .order-details {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .order-item {
        padding: var(--mobile-padding);
    }

    .orders-container {
        padding: var(--mobile-padding);
    }

    /* ===== 后台管理样式 ===== */
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        padding: 0 var(--mobile-padding);
        margin: 0;
    }

    .logo {
        order: 1;
        flex: 0 1 auto;
        min-width: auto;
    }

    .mobile-menu-btn {
        order: 2;
        display: flex;
        margin-left: 0;
        margin-right: var(--spacing-sm);
    }

    .navigation {
        order: 4;
        width: 100%;
    }

    .user-section {
        order: 3;
        flex: 0 1 auto;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        margin-left: 0;
        min-width: auto;
        gap: var(--spacing-sm);
    }

    .user-info {
        text-align: right;
    }

    .user-name {
        justify-content: flex-end;
        font-size: var(--font-sm);
        white-space: nowrap;
    }

    .logo-text {
        text-align: left;
        font-size: var(--font-base);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .navigation.show {
        display: block !important;
        position: absolute;
        top: calc(100% - 1px);
        right: 0;
        left: 0;
        background: var(--bg-primary);
        box-shadow: var(--shadow-lg);
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        z-index: var(--z-dropdown);
        width: 100%;
        animation: slideDown 0.3s ease-out;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
    }

    .nav-link {
        padding: 12px 20px;
        border-bottom: 1px solid var(--border-light);
        justify-content: flex-start;
        border-radius: 0;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .nav-link:hover {
        background: var(--bg-light);
    }

    /* 后台移动端表单样式 */
    .card {
        background: white;
        border-radius: var(--radius-lg);
        padding: var(--spacing-xs);
        box-shadow: var(--shadow-sm);
        margin-bottom: var(--spacing-sm);
    }

    .card-header h4.card-title {
        font-size: var(--font-base);
        color: var(--text-primary);
        margin-bottom: 0;
        text-align: left;
    }

    .card-header {
        padding: var(--spacing-xs) 0;
        margin-bottom: var(--spacing-xs);
    }

    .card-body form .mb-3 {
        display: flex;
        align-items: center;
        margin-bottom: var(--spacing-xs);
        gap: var(--spacing-sm);
    }

    .card-body form .mt-3 {
        margin-top: var(--spacing-sm);
    }

    .card-body form .mb-3 label {
        min-width: 80px;
        font-size: var(--font-sm);
        font-weight: 500;
        margin-bottom: 0;
        text-align: left;
        flex-shrink: 0;
    }

    .card-body form .mb-3 .form-select,
    .card-body form .mb-3 .form-input {
        flex-grow: 1;
        min-width: 0;
        padding: var(--spacing-xs) var(--spacing-sm);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-md);
        font-size: var(--font-sm);
        background: white;
        height: 36px;
    }

    .card-body form button[type="submit"] {
        background: #e74c3c;
        color: white;
        border: none;
        padding: var(--spacing-sm) var(--spacing-lg);
        border-radius: var(--radius-md);
        font-weight: 600;
        font-size: var(--font-sm);
        cursor: pointer;
        transition: all 0.3s ease;
        display: block;
        margin: var(--spacing-sm) auto 0;
        width: 100%;
        max-width: 150px;
        height: 36px;
    }

    #worker_section {
        display: none;
    }

    #worker_section.show {
        display: block;
    }

    /* 后台移动端表格样式 */
    .card-body .table.staff-table th:nth-child(4),
    .card-body .table.staff-table td:nth-child(4),
    .card-body .table.staff-table th:nth-child(5),
    .card-body .table.staff-table td:nth-child(5),
    .card-body .table.staff-table th:nth-child(6),
    .card-body .table.staff-table td:nth-child(6) {
        display: none;
    }

    .card-body .table.expenses-table th:nth-child(8),
    .card-body .table.expenses-table td:nth-child(8),
    .card-body .table.expenses-table th:nth-child(5),
    .card-body .table.expenses-table td:nth-child(5) {
        display: table-cell;
    }

    /* 后台统计网格 */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* 后台卡片布局 */
    .dashboard-card {
        flex: 1 0 100%;
        margin: 0 0 var(--spacing-sm) 0;
    }

    /* 后台登录页面 */
    .login-card {
        padding: 30px 20px;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .login-form .form-control {
        padding: 12px 14px 12px 40px;
        font-size: 14px;
    }

    /* ===== 图片放大弹窗移动端样式 ===== */
    .zoom-hint {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0,0,0,0.7);
        color: white;
        padding: 10px 20px;
        border-radius: 30px;
        z-index: 1001;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .zoom-modal:active .zoom-hint {
        opacity: 1;
    }

    /* ===== 费用表格移动端样式 ===== */
    .cost-table {
        font-size: 12px;
    }

    .cost-table td {
        padding: 6px 4px;
    }

    /* ===== 冥封打印移动端样式 ===== */
    .grid-layout {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .form-card,
    .preview-card {
        width: 100%;
        padding: 1rem;
    }

    .invite-link-container {
        flex-direction: column;
        gap: 10px;
    }

    .invite-link-container button {
        width: 100%;
        padding: 10px;
    }
}

/* ===== 小屏设备额外适配 ===== */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--mobile-padding);
    }

    .header,
    .navigation {
        margin: 10px 0;
        padding: 0;
    }

    .card {
        margin: 0 0 10px 0;
        padding: 0;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .display-4 {
        font-size: 1.8rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .btn {
        width: auto;
        justify-content: center;
    }

    .main-content {
        padding: 10px 0;
    }

    /* 会员中心小屏适配 */
    .left-section,
    .right-section {
        padding: var(--mobile-padding);
    }

    .direct-member-item,
    .favorite-item {
        padding: var(--mobile-padding);
    }

    #avatar-preview {
        width: 110px;
        height: 110px;
    }

    /* 后台登录页面小屏 */
    .login-card {
        padding: 30px var(--mobile-padding);
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .login-form .form-control {
        padding: 12px 14px 12px 40px;
        font-size: 14px;
    }
}
