/* 手机版本专用CSS - 整合优化版 */

/* 原有手机版样式 (来自您的原始代码) */
@media (max-width: 767px) {
    .cz-info, .cz-info2 {
        display: none;
    }
    .ctd {
        display: none;
    }
    .table-responsive {
        width: 100%;
        margin-bottom: 15px;
        overflow-y: hidden;
        -ms-overflow-style: -ms-autohiding-scrollbar;
        border: none;
    }
}

/* 增强的手机版样式 - 让表单在移动设备上更友好 */
@media (max-width: 767px) {
    /* 全局调整 */
    body {
        padding: 10px 0;
        background: linear-gradient(135deg, #f1f8e9 0%, #e8f5e9 100%);
        min-height: 100vh;
    }

    .container {
        max-width: 100%;
        padding: 0 12px;
    }

    /* 头部优化 */
    .page-header {
        margin-bottom: 20px;
        padding-bottom: 10px;
    }

    .page-header h1 {
        font-size: 24px;
        line-height: 1.3;
    }

    .page-header p {
        font-size: 14px;
    }

    .top-logo {
        width: 90px;
        margin-bottom: 8px;
    }

    /* 主容器 */
    #info-container {
        padding: 20px 12px;
        border-width: 2px;
        margin: 0 auto;
        width: 100%;
        background: var(--white, #ffffff);
        border: 3px solid var(--primary-green, #2e7d32);
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
    }

    /* 装饰元素在手机上简化 */
    .health-decoration {
        font-size: 20px;
        opacity: 0.3;
    }

    .side-image {
        width: 60px;
        height: 60px;
        opacity: 0.2;
    }

    /* 表格转块级布局 - 关键优化 */
    .table-responsive {
        overflow-x: hidden;
        border: none;
        margin-bottom: 10px;
    }

    table, tbody, tr, td {
        display: block;
        width: 100% !important;
    }

    tr {
        margin-bottom: 16px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    }

    .td-info {
        display: block;
        width: 100% !important;
        padding: 8px 5px;
        text-align: left !important;
        border-bottom: none;
        font-size: 15px;
    }

    .td-info:nth-child(odd) {
        font-weight: 600;
        color: var(--primary-green-dark, #1b5e20);
        background: transparent;
        padding-bottom: 2px;
        font-size: 14px;
        letter-spacing: 0.3px;
        border-bottom: 1px dashed var(--border-color, #c8e6c9);
        margin-bottom: 5px;
    }

    .td-info:nth-child(even) {
        padding-top: 0;
        padding-bottom: 8px;
    }

    /* 输入控件优化 */
    input, select, textarea, .form-control {
        width: 100%;
        height: 45px;
        font-size: 16px;
        padding: 0 15px;
        border: 2px solid var(--border-color, #c8e6c9);
        border-radius: 8px;
        background: var(--white, #ffffff);
        color: var(--text-dark, #333333);
        -webkit-appearance: none;
        appearance: none;
        box-sizing: border-box;
    }

    textarea {
        height: auto;
        min-height: 80px;
        padding: 12px;
        line-height: 1.4;
    }

    select {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="%232e7d32" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>');
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 18px;
        padding-right: 40px;
    }

    input:focus, select:focus, textarea:focus {
        border-color: var(--primary-green, #2e7d32);
        box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
        outline: none;
    }

    /* 只读输入框样式 */
    input:read-only, input[readonly] {
        background: var(--light-green, #e8f5e9);
        border-color: var(--secondary-green, #81c784);
        color: #555;
    }

    /* 必填字段标识 */
    input:required, select:required {
        border-left-width: 4px;
        border-left-color: #f44336;
    }

    .error-message {
        font-size: 12px;
        margin-top: 4px;
        color: #f44336;
    }

    /* 地区选择器 */
    .input_s {
        width: 100% !important;
        min-width: auto;
        margin-bottom: 10px;
    }

    #province .select2-container,
    #products-container .select2-container {
        width: 100% !important;
        margin-bottom: 8px;
    }

    /* 地址切换按钮 */
    .address-toggle {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        padding: 5px 0;
    }

    .address-btn {
        padding: 12px 16px;
        font-size: 15px;
        flex: 1 1 auto;
        min-width: 140px;
        justify-content: center;
        border-radius: 50px;
        background: white;
        border: 2px solid #e0e0e0;
        font-weight: 600;
    }

    .address-btn.active {
        background: linear-gradient(145deg, #2e7d32, #1b5e20);
        color: white;
        border-color: #1b5e20;
    }

    /* 商品区块 */
    .product-section {
        padding: 16px 12px;
        margin-bottom: 20px;
        border: 2px solid var(--primary-green, #2e7d32);
        border-radius: 12px;
        background: var(--light-green, #e8f5e9);
    }

    .product-header {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .product-header h3 {
        font-size: 18px;
        margin: 0;
    }

    .remove-product-btn {
        padding: 8px 14px;
        font-size: 14px;
        background: #ff5722;
        color: white;
        border: none;
        border-radius: 6px;
    }

    .add-product-btn {
        padding: 14px;
        font-size: 16px;
        margin: 12px 0;
        background: var(--primary-green, #2e7d32);
        color: white;
        border: 2px solid var(--primary-green-dark, #1b5e20);
        border-radius: 10px;
        font-weight: 600;
    }

    .add-product-btn:disabled {
        background: #9e9e9e;
        border-color: #757575;
    }

    /* 按钮区域 */
    .action-buttons {
        margin-top: 20px;
        padding-top: 15px;
        border-top: 2px solid var(--border-color, #c8e6c9);
    }

    .btn-game {
        width: 100%;
        padding: 16px 20px;
        font-size: 20px;
        margin: 5px 0;
        background: linear-gradient(to bottom, var(--primary-green, #2e7d32), var(--primary-green-dark, #1b5e20));
        color: white;
        border: 2px solid var(--primary-green-dark, #1b5e20);
        border-radius: 10px;
        font-weight: bold;
        letter-spacing: 2px;
    }

    .btn-danger {
        display: inline-block;
        width: calc(50% - 6px);
        margin: 15px 2px 5px;
        padding: 14px 8px;
        font-size: 16px;
        background: #f44336;
        color: white;
        border: none;
        border-radius: 8px;
        text-align: center;
        text-decoration: none;
        box-sizing: border-box;
    }

    .btn-danger:hover {
        background: #d32f2f;
    }

    /* 时间选择弹窗 - 移动端优化 */
    .times_div {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 300px !important;
        max-width: 90% !important;
        z-index: 10000 !important;
        background: linear-gradient(145deg, #2e7d32, #1b5e20) !important;
        border-radius: 20px !important;
        padding: 20px !important;
        box-shadow: 0 15px 40px rgba(0,0,0,0.3) !important;
    }

    .times_div select {
        width: 100% !important;
        height: 200px !important;
        margin-bottom: 15px;
        border: 2px solid var(--border-color) !important;
        border-radius: 10px !important;
        background: white !important;
        font-size: 15px;
    }

    select[id^="explicit_trade_hour_"],
    select[id^="explicit_trade_minute_"] {
        width: 100% !important;
        height: 180px !important;
    }

    select[id^="explicit_trade_scsel_"] {
        width: 100% !important;
        height: 220px !important;
    }

    .times_div p {
        width: 100% !important;
        margin: 10px 0 0 !important;
        float: none !important;
        background: #ffd54f !important;
        color: #1b5e20 !important;
        font-weight: bold;
        border-radius: 30px;
        padding: 12px;
        text-align: center;
        font-size: 16px;
    }

    /* 提示文本 */
    #nonglishike_tip_ {
        margin-left: 0 !important;
        font-size: 13px;
        color: #f00;
        margin-top: 5px;
    }

    #trade_zishihint_ {
        display: block;
        font-size: 12px;
        margin-top: 8px;
        color: #d32f2f;
        background: #ffebee;
        padding: 8px;
        border-radius: 8px;
        line-height: 1.4;
    }

    /* 退出按钮 */
    #logout_btn {
        padding: 0 15px;
        font-size: 16px;
        height: 45px;
        line-height: 45px;
        display: inline-block;
        background: linear-gradient(to bottom, #2e7d32, #1b5e20);
        color: white;
        border-radius: 8px;
        text-decoration: none;
        font-weight: 600;
    }

    /* SweetAlert2 移动端 */
    .swal2-popup {
        width: 90% !important;
        max-width: 350px !important;
        font-size: 15px !important;
        padding: 20px !important;
        border-radius: 16px !important;
    }

    .swal2-select {
        width: 100% !important;
        margin: 15px 0 !important;
        padding: 12px !important;
        border-radius: 8px !important;
    }

    .swal2-confirm-green {
        background-color: #2e7d32 !important;
    }

    .swal2-cancel-red {
        background-color: #d32f2f !important;
    }

    /* Select2 移动端 */
    .select2-container--default .select2-selection--single {
        height: 45px;
        border: 2px solid var(--border-color, #c8e6c9);
        border-radius: 8px;
    }

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 45px;
        padding-left: 15px;
        font-size: 15px;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 43px;
    }

    .select2-results__options {
        max-height: 250px !important;
    }

    .select2-dropdown {
        border: 2px solid var(--primary-green, #2e7d32);
        border-radius: 8px !important;
    }


    /* 隐藏动画叶子，提升性能 */
    .leaf-animation {
        display: none;
    }

    /* 重做相关行 */
    .cz-info, .cz-info2 {
        display: none; /* 保持JS控制逻辑 */
    }

    .ctd {
        display: none; /* 保持JS控制逻辑 */
    }
}

/* 超小屏设备 (<=400px) 进一步优化 */
@media (max-width: 400px) {
    .page-header h1 {
        font-size: 20px;
    }

    .address-btn {
        min-width: 100%;
    }

    .btn-danger {
        width: 100%;
        margin: 8px 0 !important;
    }

    .product-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .remove-product-btn {
        align-self: flex-end;
    }

    .td-info {
        font-size: 14px;
    }

    .td-info:nth-child(odd) {
        font-size: 13px;
    }

    input, select {
        height: 42px;
        font-size: 15px;
    }
}

/* 横屏模式优化 */
@media (max-width: 767px) and (orientation: landscape) {
    .times_div {
        width: 400px !important;
    }

    .times_div select {
        height: 150px !important;
    }

    .product-section {
        padding: 12px;
    }

    tr {
        padding: 10px;
    }
}


