/* 苏州新一蓝环保节能工程有限公司订单管理系统 - 基础样式 */

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 容器 */
.container {
    max-width: 1600px;
    margin: 0 auto;
/*    padding: 0 15px;*/
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #73d13d;
}

.btn-warning {
    background: #faad14;
    color: #fff;
}

.btn-warning:hover {
    background: #ffc53d;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #ff7875;
}

.btn-secondary {
    background: #d9d9d9;
    color: #333;
}

.btn-secondary:hover {
    background: #e6e6e6;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-width: 60px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    min-width: 120px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-control:disabled {
    background: #f5f5f5;
    color: #999;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

.table th {
    background: #fafafa;
    font-weight: 600;
    color: #333;
}

.table tbody tr:hover {
    background: #f5f5f5;
}

.table-responsive {
    overflow-x: auto;
}

/* 导航栏样式 */
.navbar {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
}

.navbar-brand img {
    height: 32px;
    margin-right: 10px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    list-style: none;
}

.navbar-menu li {
    margin-left: 30px;
}

.navbar-menu a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: #1890ff;
}

/* 汉堡菜单 */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 60px;
    right: -250px;
    width: 250px;
    height: calc(100vh - 60px);
    background: #fff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.sidebar.active {
    right: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #f0f9ff;
    color: #1890ff;
    border-left-color: #1890ff;
}

/* 主内容区域 */
.main-content {
    margin-top: 60px;
    padding: 20px;
    min-height: calc(100vh - 60px);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 5px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1890ff;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.pagination button.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.pagination button:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 消息提示 */
.message {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    z-index: 3000;
    min-width: 200px;
    animation: slideIn 0.3s ease;
}

.message.success {
    background: #52c41a;
}

.message.error {
    background: #ff4d4f;
}

.message.warning {
    background: #faad14;
}

.message.info {
    background: #1890ff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: #1890ff; }
.text-success { color: #52c41a; }
.text-warning { color: #faad14; }
.text-danger { color: #ff4d4f; }
.text-muted { color: #999; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-block { display: inline-block; }

.flex-1 { flex: 1; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar-menu {
        display: none;
    }
    
    .hamburger {
        display: flex;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .stats-grid {
/*        grid-template-columns: 1fr;*/
/*        gap: 15px;*/
    }
    
    .card-body {
        padding: 15px;
    }
    
    .table-responsive {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
    
    .form-control {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .navbar-content {
        padding: 0 15px;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .card-header,
    .card-body {
        padding: 15px;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}



/* ===== Customers: responsive search bar & sticky actions on mobile ===== */
.customer-search {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.customer-search .field-group {
    display: flex;
    gap: 12px;
    align-items: center;
}
.customer-search .field-group #searchInput {
    width: 260px;
}
.customer-search .field-group #customerTypeFilter {
    width: 140px;
}
.customer-search .btn-group-inline {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

@media (max-width: 768px) {
    .customer-search {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .customer-search .field-group {
        display: grid;
        grid-template-columns: 1fr 130px; /* input + select in one row */
        gap: 8px;
    }
    .customer-search .btn-group-inline {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* three buttons in the next row */
        gap: 8px;
        margin-left: 0;
    }
    .customer-search .btn-group-inline .btn {
        width: 100%;
    }

    /* Table on mobile: keep last (actions/details) column sticky on the right */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table th, .table td {
        white-space: nowrap;  /* avoid vertical stacking of cell content */
        padding: 6px 8px;
        font-size: 12px;
        line-height: 1.3;
    }
    .table thead th:last-child,
    .table tbody td:last-child {
        position: sticky;
        right: 0;
        background: #fff; /* keep header/last col readable */
        z-index: 2;
        box-shadow: -4px 0 6px rgba(0,0,0,0.06);
    }
    .table thead th:last-child {
        z-index: 3;
        background: #fafafa;
    }
}


/* === Re-assert mobile collapse for orders search === */
.search-toggle{ display:none; margin-left:auto; border:none; background:transparent; font-size:16px; cursor:pointer; }
@media (max-width:768px){
  .search-toggle{ display:inline-block; }
  #orderSearchPanel{ display:none; }
  #orderSearchPanel.open{ display:block; }
}

/* ===== Desktop-only: make orderModal fields one-per-row, keep mobile unchanged ===== */
@media (min-width: 769px) {
  #orderModal .d-flex {
    flex-direction: column !important;   /* stack vertically on desktop */
    align-items: stretch;
    gap: 15px !important;
  }
  #orderModal .form-group {
    width: 100%;
  }
  #orderModal .form-group.flex-1 {
    flex: 0 0 auto;
  }
}

/* ===== Mobile-only: stack label above input inside order modal ===== */
@media (max-width: 768px) {
  #orderModal .form-group {
    display: block !important;           /* cancel any flex row layout */
  }
  #orderModal .form-group .form-label {
    display: block !important;           /* force label to its own line */
    margin-bottom: 6px;
  }
  #orderModal .form-group .form-control,
  #orderModal .form-group select.form-control,
  #orderModal .form-group textarea.form-control {
    display: block !important;
    width: 100% !important;              /* full width inputs */
  }
  /* keep groups stacked with spacing on mobile */
  #orderModal .d-flex {
    flex-direction: column !important;
    gap: 10px !important;
  }
}

/* ===== Force order modal form: label + input inline on all devices ===== */
#orderModal .form-group {
  display: flex !important;
  align-items: center;
  gap: 10px;
}
#orderModal .form-group .form-label {
  flex: 0 0 120px;         /* fixed width for labels */
  margin-bottom: 0 !important;
  text-align: right;
}
#orderModal .form-group .form-control,
#orderModal .form-group select.form-control,
#orderModal .form-group textarea.form-control {
  flex: 1 1 auto;
  width: auto !important;
}
#orderModal .d-flex {
  flex-direction: column !important;   /* stack groups vertically */
  gap: 15px !important;
}

/* ===== Unify modal form layout: label + input on the same row (desktop & mobile) ===== */
#orderModal .d-flex{
  flex-wrap: wrap !important;            /* allow wrapping of groups, not label-input split */
  gap: 12px !important;
}

/* Regular form groups inside modal */
#orderModal .form-group{
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 12px;
}

/* Labels fixed width on the left */
#orderModal .form-group .form-label{
  flex: 0 0 110px !important;            /* adjust as needed */
  margin: 0 !important;
  text-align: right;
  line-height: 1.2;
  white-space: nowrap;
}

/* Inputs expand on the right */
#orderModal .form-group .form-control,
#orderModal .form-group select.form-control,
#orderModal .form-group textarea.form-control{
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0;
}

/* Remarks row uses the same inline layout */
#orderModal .form-group-horizontal{
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  margin-top: 8px;
}
#orderModal .form-group-horizontal .form-label{
  flex: 0 0 110px !important;
  margin: 0 !important;
  text-align: right;
  line-height: 1.2;
  white-space: nowrap;
}
#orderModal .form-group-horizontal .form-control{
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0;
}

/* Small screens: keep same-row; allow label to shrink a bit */
@media (max-width: 768px){
  #orderModal .form-group .form-label,
  #orderModal .form-group-horizontal .form-label{
    flex-basis: 90px !important;
  }
}
