* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 280px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    margin-bottom: 10px;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.logout-btn {
    padding: 5px 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.profile-btn {
    padding: 5px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 10px;
}

.profile-btn:hover {
    background: #2980b9;
}

.logout-btn:hover {
    background: #c0392b;
}

.online-users {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.online-users h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.online-users ul {
    list-style: none;
}

.online-users li {
    padding: 10px;
    margin-bottom: 5px;
    background: #34495e;
    border-radius: 5px;
    font-size: 14px;
}

.admin-panel {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.admin-panel h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.admin-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.admin-btn:hover {
    background: #2980b9;
}

.virtual-number-section {
    padding: 15px;
    border-top: 1px solid #34495e;
}

.virtual-number-section h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.bind-form {
    display: flex;
    gap: 10px;
}

.bind-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.bind-btn {
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.bind-btn:hover {
    background: #219a52;
}

.bind-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.bind-result {
    margin-top: 15px;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 5px;
    border: 1px solid #a5d6a7;
}

.bind-info p {
    margin: 5px 0;
    font-size: 14px;
    color: #333;
}

.bind-info strong {
    color: #27ae60;
    font-size: 16px;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
    height: 100vh;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 20px;
    color: #333;
}

.notification-controls {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.notification-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-box input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    width: 150px;
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
}

.search-btn {
    padding: 6px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.search-btn:hover {
    background: #2980b9;
}

.clear-search-btn {
    padding: 6px 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.clear-search-btn:hover {
    background: #c0392b;
}

.message-item.highlight {
    background: #fffde7;
    border-left: 3px solid #ffc107;
}

.message-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9f9f9;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.message-item {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.message-username {
    font-weight: 600;
    color: #333;
}

.message-time {
    color: #999;
}

.message-content {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    word-wrap: break-word;
}

.message-item.has-order-info {
    border-left: 3px solid #3498db;
}

.order-info {
    margin-top: 12px;
    padding: 12px;
    background: #f0f8ff;
    border-radius: 5px;
    border: 1px solid #d0e7ff;
}

.order-info-title {
    font-size: 13px;
    font-weight: 600;
    color: #2980b9;
    margin-bottom: 8px;
}

.order-info-content {
    font-size: 14px;
    line-height: 1.8;
    color: #555;
}

.add-order-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.3s;
}

.add-order-btn:hover {
    background: #229954;
}

.order-info-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.dispatch-btn {
    padding: 8px 16px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.3s;
}

.dispatch-btn:hover {
    background: #7f8c8d;
}

.dispatch-btn.dispatched {
    background: #e74c3c;
}

.dispatch-btn.dispatched:hover {
    background: #c0392b;
}

.order-info.dispatched {
    background: #fff0f0;
    border-color: #ffcccc;
}

.order-info.dispatched .order-info-title {
    color: #e74c3c;
}

/* 催单消息样式 */
.message-item.is-reminder {
    border-left-color: #f39c12;
}

.order-info.reminder {
    background: #fff8e1;
    border-color: #ffcc80;
}

.order-info.reminder .order-info-title {
    color: #f39c12;
}

.order-info.reminder.processed {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.order-info.reminder.processed .order-info-title {
    color: #4caf50;
}

.order-list {
    margin-top: 10px;
}

.order-item {
    padding: 10px;
    background: white;
    border-radius: 5px;
    margin-bottom: 5px;
}

.order-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-number {
    font-size: 13px;
    color: #333;
}

.order-customer {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.order-address {
    font-size: 12px;
    color: #888;
    margin-top: 3px;
}

.order-technician {
    color: #2196F3;
    font-size: 13px;
    margin-bottom: 3px;
}

.technician-phone {
    color: #2196F3;
    text-decoration: none;
    margin-left: 5px;
}

.technician-phone:hover {
    text-decoration: underline;
}

.order-amount {
    color: #f44336;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 3px;
}

.order-info.warranty {
    border-left: 4px solid #2196F3;
    background: #e3f2fd;
}

.warranty-phone {
    font-size: 16px;
    font-weight: 600;
    color: #1976D2;
}

.warranty-tip {
    font-size: 13px;
    color: #666;
    margin: 10px 0;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
}

.warranty-order-list .order-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.order-service {
    color: #666;
    font-size: 13px;
    margin-bottom: 3px;
}

.order-create-time {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

.create-warranty-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.create-warranty-btn:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.load-more-trigger {
    text-align: center;
    padding: 15px;
    color: #999;
    font-size: 13px;
}

.load-more-text {
    display: inline-block;
    padding: 8px 20px;
    background: #f5f5f5;
    border-radius: 20px;
    cursor: pointer;
}

.load-more-text.loading {
    color: #2196F3;
    cursor: wait;
}

.order-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 3px;
}

.status-pending {
    background: #fff3e0;
    color: #e65100;
}

.status-waiting {
    background: #e8eaf6;
    color: #3949ab;
}

.status-waiting-service {
    background: #e3f2fd;
    color: #1565c0;
}

.status-processing {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-cancelled {
    background: #fafafa;
    color: #616161;
}

.status-serviced {
    background: #e0f7fa;
    color: #00838f;
}

.status-after-sale {
    background: #fff8e1;
    color: #ff8f00;
}

.status-frozen {
    background: #ffebee;
    color: #c62828;
}

.status-unknown {
    background: #f5f5f5;
    color: #757575;
}

.no-order {
    padding: 10px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.process-btn {
    padding: 8px 16px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.3s;
}

.process-btn:hover {
    background: #e67e22;
}

.process-btn.processed {
    background: #4caf50;
}

.process-btn.processed:hover {
    background: #388e3c;
}

.reminder-phone {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.message-input {
    padding: 20px;
    border-top: 1px solid #eee;
    background: white;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.message-input textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
}

.message-input textarea:focus {
    outline: none;
    border-color: #3498db;
}

.send-btn {
    margin-top: 10px;
    padding: 12px 30px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.send-btn:hover {
    background: #2980b9;
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-small {
    max-width: 500px;
}

.modal-header {
    padding: 20px;
    background: #3498db;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #ddd;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.user-table th,
.user-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.user-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.user-table tr:hover {
    background: #f9f9f9;
}

.add-btn,
.save-btn {
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.add-btn:hover,
.save-btn:hover {
    background: #229954;
}

.edit-btn,
.delete-btn {
    padding: 5px 10px;
    margin-right: 5px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.edit-btn {
    background: #3498db;
    color: white;
}

.edit-btn:hover {
    background: #2980b9;
}

.delete-btn {
    background: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background: #c0392b;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-group select {
    width: auto;
    margin-right: 10px;
    min-width: 120px;
}

.role-admin {
    color: #e74c3c;
    font-weight: 600;
}

.role-normal {
    color: #3498db;
}

.status-enabled {
    color: #27ae60;
}

.status-disabled {
    color: #e74c3c;
}

@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: hidden;
    }
    
    .container {
        flex-direction: column;
        height: 100vh;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        flex-shrink: 0;
    }
    
    .chat-area {
        flex: 1;
        height: auto;
        min-height: 0;
    }
    
    .message-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .message-input {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* 订单弹窗样式 */
.btn-primary {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 8px 16px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.tag-success {
    display: inline-block;
    padding: 2px 8px;
    background: #27ae60;
    color: white;
    border-radius: 3px;
    font-size: 12px;
}

.tag-warning {
    display: inline-block;
    padding: 2px 8px;
    background: #f39c12;
    color: white;
    border-radius: 3px;
    font-size: 12px;
}

.tag-info {
    display: inline-block;
    padding: 2px 8px;
    background: #3498db;
    color: white;
    border-radius: 3px;
    font-size: 12px;
    margin-left: 10px;
}

.store-name, .tech-name {
    font-weight: 500;
    color: #2c3e50;
    margin-left: 10px;
}

.selected-goods {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.goods-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.3s;
}

.goods-item:hover {
    background: #f8f9fa;
}

.goods-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goods-name {
    font-size: 14px;
    color: #333;
}

.goods-price {
    font-size: 14px;
    color: #e74c3c;
    font-weight: 500;
}

.technician-filter {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 20px;
}

.technician-filter label {
    font-weight: 500;
    color: #333;
}

.technician-filter input,
.technician-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.technician-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    transition: background 0.3s;
}

.technician-item:hover {
    background: #f8f9fa;
}

.technician-info {
    flex: 1;
}

.technician-name {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.technician-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.selected-technician {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.tag-danger {
    display: inline-block;
    padding: 2px 8px;
    background: #e74c3c;
    color: white;
    border-radius: 3px;
    font-size: 12px;
}

/* H5响应式适配 */
/* 移动端顶部导航 */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #2c3e50;
    color: white;
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.mobile-header h1 {
    font-size: 16px;
    font-weight: 500;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
}

.sidebar-overlay.active {
    display: block;
}

@media screen and (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .container {
        flex-direction: column;
        padding-top: 50px;
        height: calc(100vh - 50px);
    }
    
    .sidebar {
        position: fixed;
        top: 50px;
        left: -280px;
        width: 280px;
        height: calc(100vh - 50px);
        z-index: 1002;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar-header h2 {
        display: none;
    }
    
    .chat-area {
        width: 100%;
        height: 100%;
    }
    
    .chat-header {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .chat-header h2 {
        font-size: 16px;
    }
    
    .notification-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .notification-controls label {
        font-size: 12px;
    }
    
    .search-box {
        width: 100%;
        margin-top: 8px;
    }
    
    .search-box input {
        flex: 1;
        padding: 6px 8px;
        font-size: 12px;
        width: 100%;
    }
    
    .search-btn,
    .clear-search-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .message-list {
        padding: 10px;
    }
    
    .message-item {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .message-username {
        font-size: 12px;
    }
    
    .message-content {
        font-size: 13px;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    .order-list {
        margin-top: 8px;
    }
    
    .order-item {
        padding: 8px;
    }
    
    .order-number {
        font-size: 12px;
    }
    
    .order-customer,
    .order-address {
        font-size: 11px;
    }
    
    .order-status {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .chat-input {
        padding: 10px;
    }
    
    #messageInput {
        padding: 10px;
        font-size: 14px;
    }
    
    #sendBtn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* 弹窗适配 */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 14px;
    }
    
    /* 用户管理表格适配 */
    .user-table {
        font-size: 12px;
    }
    
    .user-table th,
    .user-table td {
        padding: 8px 5px;
    }
    
    .edit-btn,
    .delete-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    /* 订单弹窗适配 */
    .order-info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .goods-list {
        max-height: 200px;
    }
    
    .technician-list {
        max-height: 200px;
    }
    
    .btn-primary,
    .save-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* 搜索结果弹窗适配 */
    #searchResultsModal .modal-content {
        max-width: 95% !important;
    }
    
    .search-result-item {
        padding: 8px;
    }
    
    .search-result-item > div:first-child {
        flex-wrap: wrap;
    }
}

/* 更小屏幕适配 */
@media screen and (max-width: 480px) {
    .mobile-header h1 {
        font-size: 14px;
    }
    
    .menu-toggle {
        font-size: 18px;
    }
    
    .sidebar {
        width: 260px;
        left: -260px;
    }
    
    .sidebar-header {
        padding: 10px;
    }
    
    .user-info {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .profile-btn,
    .logout-btn {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .chat-header h2 {
        font-size: 14px;
    }
    
    .message-item {
        padding: 8px;
    }
    
    .message-content {
        font-size: 12px;
    }
    
    .order-item {
        padding: 6px;
    }
    
    .order-number {
        font-size: 11px;
    }
    
    .order-customer,
    .order-address {
        font-size: 10px;
    }
    
    /* 隐藏部分表格列 */
    .user-table th:nth-child(3),
    .user-table td:nth-child(3) {
        display: none;
    }
}

/* 横屏模式 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .mobile-header {
        height: 40px;
    }
    
    .container {
        padding-top: 40px;
        height: calc(100vh - 40px);
    }
    
    .sidebar {
        top: 40px;
        height: calc(100vh - 40px);
    }
}
