/* 防止表格内容换行 */
table#salesTable td, table#salesTable th,
table#returnTable td, table#returnTable th {
    white-space: nowrap;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #f8f9fa;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

.container-fluid {
    padding: 10px;
    max-width: 1600px;
}

.form-section {
    background-color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}

.table th, .table td {
    vertical-align: middle;
    padding: 8px 6px;
    font-size: 15px;
}

.card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: none;
}

.card-body {
    padding: 12px;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 16px;
}

.input-group-text {
    background-color: #f8f9fa;
}

.summary-section {
    margin-bottom: 15px;
}

.summary-section h6 {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 3px;
}

.summary-section p {
    margin-bottom: 3px;
    font-size: 16px;
    line-height: 1.2;
}

.total-section {
    background-color: #f8f9fa;
    padding: 5px;
    border-radius: 8px;
    margin-top: 10px;
}

.total-section p {
    font-weight: 600;
    font-size: 20px;
}

.form-control, .form-select {
    border-radius: 4px;
    padding: 8px 12px;
}

.qty-input, .discounted-price-input {
    max-width: 80px;
}

.remark-input {
    min-width: 150px;
}

.remove-btn {
    min-width: 70px;
}

#refreshBtn, #checkoutBtn {
    width: 120px;
    margin-right: 10px;
}

.select2-container--default .select2-selection--single {
    height: 38px;
    border-radius: 4px;
    padding: 5px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

#barcodeInput, #productCodeInput {
    font-size: 16px;
}

.section-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.action-buttons {
    margin-top: 20px;
}

.coupon-controls {
    margin-top: 10px;
}

.payment-method {
    margin-bottom: 15px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 10px;
}

.payment-method.active {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.cash-input-container {
    display: block;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .form-section > div {
        margin-bottom: 15px;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .action-buttons .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    #salesTable td:nth-child(2), #salesTable th:nth-child(2),
    #returnTable td:nth-child(2), #returnTable th:nth-child(2) {
        display: none;
    }

    .qty-input {
        width: 100px !important;
    }

    .discounted-price-input {
        width: 300px !important;
    }

    .dropdown-container {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: -1px;
        border: 1px solid #dee2e6;
        border-top: none;
        border-radius: 0 0 4px 4px;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        max-height: 200px;
        overflow-y: auto;
        z-index: 1000;
    }
}

/* 关闭按钮样式 - 稍微小一点 */
.close-btn-sm {
    padding: 6px 12px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
}

/* 手机端隐藏关闭按钮 */
@media (max-width: 768px) {
    .close-btn-sm {
        display: none !important;
    }
}

/* 浮动应付金额样式 */
.floating-total-payable {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
    font-size: 18px;
    font-weight: bold;
    animation: slideInUp 0.3s ease-out;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.floating-total-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.floating-total-label {
    opacity: 0.95;
}

.floating-total-amount {
    font-size: 22px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.floating-total-unit {
    opacity: 0.9;
    font-size: 16px;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .floating-total-payable {
        bottom: 15px;
        right: 15px;
        padding: 12px 16px;
        font-size: 16px;
    }

    .floating-total-amount {
        font-size: 20px;
    }

    .floating-total-unit {
        font-size: 14px;
    }
}

/* 通知样式 */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 250px;
}

.toast-body {
    background-color: var(--success-color);
    color: white;
    border-radius: 4px;
    padding: 10px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    animation: fadeIn 0.3s, fadeOut 0.5s 1.7s;
    animation-fill-mode: forwards;
}

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

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

/* 确保Select2清除按钮可见 */
.select2-container--bootstrap .select2-selection--single .select2-selection__clear {
    display: inline-block !important;
    color: #dc3545 !important;
    font-size: 1.5em !important;
    margin-right: 5px !important;
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
}

@font-face {
    font-family: 'bootstrap-icons';
    src: url('css/bootstrap-icons.woff') format('woff');
}

/* 扫码按钮样式 - 紧凑布局 */
.input-group > .btn {
    margin-left: 0;
    border-radius: 0;
}

.input-group > .btn:first-child {
    border-radius: 0 0 0 4px;
}

.input-group > .btn:last-child {
    border-radius: 0 4px 4px 0;
}

/* 二维码扫描框样式 */
#qrScanVideo {
    background-color: #000;
    border-radius: 8px;
    width: 100%;
    height: auto;
    max-height: 60vh;
    position: relative;
}

.scan-hint {
    font-size: 14px;
    margin-top: 10px;
}

/* 扫码模态框样式 - 统一两个扫描模态框 */
#scanModal .modal-dialog,
#qrScanModal .modal-dialog {
    max-width: 60%;
    margin: 1rem auto;
    max-height: 70vh;
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
}

/* 二维码扫描框样式 */
#qrScanVideo {
    background-color: #000;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    max-height: 60vh;
}

#scanVideo {
    background-color: #000;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    max-height: 60vh;
}

/* 添加iOS特定样式 - 统一两个扫描模态框 */
@supports (-webkit-touch-callout: none) {
    #scanVideo,
    #qrScanVideo {
        max-height: 50vh;
    }
    #scanModal .modal-dialog,
    #qrScanModal .modal-dialog {
        max-width: 95%;
        margin: 10px auto;
        display: flex;
        align-items: center;
        min-height: calc(100% - 20px);
    }
}

/* 快捷注册会员样式 */
.quick-register-section {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    background-color: #f8f9fa;
    margin-top: 8px;
}

.quick-register-section .alert-warning {
    margin-bottom: 10px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.quick-register-section .input-group {
    margin-bottom: 0;
}

.quick-register-section #quickRegisterPhone {
    border-right: 0;
}

.quick-register-section #quickRegisterBtn {
    border-left: 0;
}

#registerStatus small {
    font-size: 0.8rem;
}

/* 会员信息显示样式 */
#currentMemberInfo {
    margin-bottom: 0;
    padding: 6px 10px;
    font-size: 0.9rem;
}

#currentMemberInfo.alert-success {
    background-color: #d1edff;
    border-color: #b8daff;
    color: #004085;
}

.member-item:hover {
    background-color: #f8f9fa;
}

.member-item:last-child {
    border-bottom: none;
}

.member-item.selected {
    background-color: #007bff !important;
    color: white;
}

/* 会员搜索下拉框样式 */
.dropdown-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: -1px;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 4px 4px;
    background: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1050;
}

.member-item {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.member-item:hover {
    background-color: #f8f9fa;
}

.member-item:last-child {
    border-bottom: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .dropdown-container {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: -1px;
        border: 1px solid #dee2e6;
        border-top: none;
        border-radius: 0 0 4px 4px;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        max-height: 200px;
        overflow-y: auto;
        z-index: 1050;
    }
}
