/**
 * 天偌装修平台 - Bootstrap 兼容层
 * 将常用 Bootstrap 类映射到设计系统，实现全局升级
 * 所有页面加入此 CSS 即可自动获得统一外观
 */

/* ----- Grid -------------------------- */
.row { display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; }
[class*="col-"] { padding: 0 8px; box-sizing: border-box; }
.col-1  { flex: 0 0 8.33%;  max-width: 8.33%;  }
.col-2  { flex: 0 0 16.66%; max-width: 16.66%; }
.col-3  { flex: 0 0 25%;    max-width: 25%;    }
.col-4  { flex: 0 0 33.33%; max-width: 33.33%; }
.col-5  { flex: 0 0 41.66%; max-width: 41.66%; }
.col-6  { flex: 0 0 50%;    max-width: 50%;    }
.col-7  { flex: 0 0 58.33%; max-width: 58.33%; }
.col-8  { flex: 0 0 66.66%; max-width: 66.66%; }
.col-9  { flex: 0 0 75%;    max-width: 75%;    }
.col-10 { flex: 0 0 83.33%; max-width: 83.33%; }
.col-11 { flex: 0 0 91.66%; max-width: 91.66%; }
.col-12 { flex: 0 0 100%;   max-width: 100%;   }

/* ----- Spacing -------------------------- */
.mt-0 { margin-top: 0; }         .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 4px; }       .mb-1 { margin-bottom: 4px; }
.mt-2 { margin-top: 8px; }       .mb-2 { margin-bottom: 8px; }
.mt-3 { margin-top: 16px; }      .mb-3 { margin-bottom: 16px; }
.mt-4 { margin-top: 24px; }      .mb-4 { margin-bottom: 24px; }
.mt-5 { margin-top: 48px; }      .mb-5 { margin-bottom: 48px; }
.me-1 { margin-right: 4px; }     .ms-1 { margin-left: 4px; }
.me-2 { margin-right: 8px; }     .ms-2 { margin-left: 8px; }
.me-3 { margin-right: 16px; }    .ms-3 { margin-left: 16px; }
.p-0 { padding: 0; }             .p-1 { padding: 4px; }
.p-2 { padding: 8px; }           .p-3 { padding: 16px; }
.p-4 { padding: 24px; }

/* ----- Text -------------------------- */
.text-start { text-align: left; }   .text-end { text-align: right; }
.text-bold, .fw-bold { font-weight: 700; }
.fw-normal { font-weight: 400; }
.text-white { color: var(--white); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger, .text-error { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-sm, .small { font-size: .85rem; }
.text-xs { font-size: .75rem; }

/* ----- Display & Flex -------------------------- */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.gap-1 { gap: 4px; }   .gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }  .gap-4 { gap: 24px; }
.flex-grow-1 { flex: 1; }

/* ----- Width/Height -------------------------- */
.w-25 { width: 25%; }   .w-50 { width: 50%; }   .w-75 { width: 75%; }   .w-100 { width: 100%; }

/* ----- Buttons -------------------------- */
.btn-secondary {
  background: var(--bg-page); color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-outline-primary {
  border: 2px solid var(--primary); color: var(--primary); background: transparent;
}
.btn-light {
  background: var(--bg-page); color: var(--text); border: 1px solid var(--border);
}
.btn-link { background: none; border: none; color: var(--primary); text-decoration: underline; cursor: pointer; }

/* ----- Badges -------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: .72rem; font-weight: 600;
}
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success, .bg-success { background: var(--success-bg); color: #065f46; }
.badge-danger, .bg-danger   { background: var(--danger-bg);  color: #991b1b; }
.badge-warning, .bg-warning { background: var(--warning-bg); color: #92400e; }
.badge-info, .bg-info       { background: var(--info-bg);    color: #1e40af; }
.badge-secondary { background: var(--bg-page); color: var(--text-secondary); }

/* ----- Alerts -------------------------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius); font-size: .85rem;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-success { background: var(--success-bg); color: #065f46; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; }
.alert-warning { background: var(--warning-bg); color: #92400e; }
.alert-info    { background: var(--info-bg);    color: #1e40af; }

/* ----- Tables -------------------------- */
.table {
  width: 100%; border-collapse: collapse; font-size: .85rem;
}
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-light); }
.table thead th { background: var(--bg-page); font-weight: 700; color: var(--text-secondary); font-size: .78rem; border-bottom-width: 2px; }
.table tbody tr:hover { background: var(--bg-hover); }
.table-sm th, .table-sm td { padding: 6px 10px; }
.table-striped tbody tr:nth-child(even) { background: var(--bg-page); }

/* ----- List Groups -------------------------- */
.list-group { display: flex; flex-direction: column; }
.list-group-item { padding: 12px 16px; border: 1px solid var(--border-light); background: var(--white); }
.list-group-item + .list-group-item { border-top: none; }

/* ----- Backgrounds -------------------------- */
.bg-white  { background: var(--white); }
.bg-light  { background: var(--bg-page); }
.bg-dark   { background: var(--dark); color: var(--white); }
.bg-primary { background: var(--primary-bg); }

/* ----- Shadows -------------------------- */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ----- Borders -------------------------- */
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.border { border: 1px solid var(--border); }

/* ----- Overflow -------------------------- */
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }

/* ----- Position -------------------------- */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.sticky-top { position: sticky; top: 0; z-index: 100; }

/* ----- Visibility -------------------------- */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* ----- Responsive -------------------------- */
@media (max-width: 768px) {
  [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.33%; max-width: 33.33%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-8 { flex: 0 0 66.66%; max-width: 66.66%; }
}
@media (max-width: 576px) {
  .col-md-3, .col-md-4, .col-md-6, .col-md-8 { flex: 0 0 100%; max-width: 100%; }
}
