/* 移动设备专用样式 */

/* 移动设备上的容器样式 */
@media (max-width: 640px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* 针对特小屏幕的优化 */
@media (max-width: 360px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* 防止iOS上的输入框自动缩放 */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
select,
textarea {
    font-size: 16px !important;
}

/* 移动设备特定样式 - 使用扁平样式而非原生样式 */
body.mobile-device select.player-select {
    -webkit-appearance: none !important;
    appearance: none !important;
    background-color: #fff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    height: 42px !important;
    padding: 6px 12px !important;
    width: 100% !important;
    font-size: 16px !important;
    color: #374151 !important;
    display: block !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    background-size: 1.5em 1.5em !important;
    padding-right: 2.5rem !important;
}

/* 允许在移动设备上显示Select2 */
body.mobile-device .select2-container {
    display: block !important;
}

/* 优化SweetAlert2在移动设备上的显示 */
.swal-mobile-container {
    z-index: 9999 !important;
    padding: 0 !important;
}

.swal-mobile-popup {
    position: relative !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 90% !important;
    max-width: 400px;
    padding: 1.25em;
    border-radius: 0.3125em;
    background: #fff;
    font-family: inherit;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    margin: 0 auto !important;
}

.swal-mobile-container .swal2-popup {
    font-size: 0.9rem;
    padding: 0.75rem;
    width: 90% !important;
    max-width: 400px;
    margin: auto !important;
}

.swal-mobile-container .swal2-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.swal-mobile-container .swal2-content {
    font-size: 0.9rem;
}

.swal-mobile-container .swal2-actions {
    margin-top: 0.75rem;
}

.swal-mobile-container .swal2-styled.swal2-confirm,
.swal-mobile-container .swal2-styled.swal2-cancel {
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
}

/* 优化Select2在移动设备上的显示 */
.select2-dropdown-responsive {
    max-width: 90vw;
}

.select2-dropdown-responsive .select2-results__option {
    padding: 8px;
    font-size: 0.9rem;
}

/* 修复原生select在移动设备上的样式 */
select.player-select {
    -webkit-appearance: menulist !important; /* 强制使用原生下拉样式 */
    appearance: menulist !important;
    background-color: #fff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    height: 42px !important;
    padding: 6px 12px !important;
    width: 100% !important;
    font-size: 16px !important;
    color: #374151 !important;
    display: block !important;
}

/* 确保积分总和模块在移动设备上正确显示 */
#totalProfitLoss {
    display: flex !important;
    margin-bottom: 1rem !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* 优化触摸区域 - 修改为不影响点击事件 */
button, 
.select2-selection, 
input[type="checkbox"], 
input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
    touch-action: auto !important; /* 确保触摸事件正常工作 */
    -webkit-tap-highlight-color: rgba(0,0,0,0); /* 移除点击高亮 */
}

/* 确保按钮可点击 */
button {
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none;
    -webkit-user-select: none;
}

/* 优化表格在小屏幕上的显示 */
@media (max-width: 480px) {
    #playerTable th:nth-child(3),
    #playerTable td:nth-child(3) {
        width: 40px;
        padding-left: 0;
        padding-right: 0;
    }
    
    #playerTable th:first-child,
    #playerTable td:first-child {
        width: 40%;
    }
    
    #playerTable th:nth-child(2),
    #playerTable td:nth-child(2) {
        width: 50%;
    }
    
    /* 确保原生select在移动设备上正确显示 */
    select.player-select {
        width: 100% !important;
        display: block !important;
        height: 42px !important;
        padding: 6px 12px !important;
        font-size: 16px !important;
        -webkit-appearance: menulist !important;
        appearance: menulist !important;
        background-color: #fff !important;
        border: 1px solid #d1d5db !important;
        border-radius: 0.375rem !important;
        color: #374151 !important;
    }
}

/* 优化底部固定按钮 */
@media (max-width: 640px) {
    .fixed-bottom-buttons {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 10px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
    }
    
    /* 为固定底部按钮添加额外的底部间距 */
    body.has-fixed-buttons {
        padding-bottom: 70px;
    }
    
    /* 确保创建对局按钮可点击 */
    #createSessionBtn {
        touch-action: auto !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        cursor: pointer !important;
        pointer-events: auto !important;
        position: relative;
        z-index: 10;
    }
}

/* 优化滚动体验 */
* {
    -webkit-overflow-scrolling: touch;
}

/* 禁用长按选择文本 - 但不影响点击事件 */
.no-select {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 移动设备上的玩家选择框样式 */
.player-select-mobile {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem;
    width: 100%;
    font-size: 16px; /* 防止iOS自动缩放 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.player-select-mobile:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* 自定义下拉框样式 */
.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-container::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #6b7280;
    pointer-events: none;
} 