/* ============================================================
   Merchant UI - app.css (Modern Flat)
   ============================================================ */

/* ---- Base ---- */
body {
  background-color: #f0f2f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #333;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Breadcrumb
   ============================================================ */
.layui-breadcrumb span[lay-separator] {
  margin: 0 5px;
  color: #bbb;
}
.layui-breadcrumb a,
.layui-breadcrumb a:hover {
  color: #888 !important;
  font-size: 13px;
}
.layui-breadcrumb a:last-child,
.layui-breadcrumb a:last-child:hover {
  color: #333 !important;
  font-weight: 500;
}
.layui-breadcrumb a:first-child,
.layui-breadcrumb a:first-child:hover {
  color: #888 !important;
}

/* ============================================================
   Pagination
   ============================================================ */
.layui-laypage .layui-laypage-curr .layui-laypage-em {
  background-color: #4474ff;
}
.layui-laypage a:hover {
  color: #4474ff;
}
.layui-laypage input:focus,
.layui-laypage select:focus {
  border-color: #4474ff !important;
}

/* ============================================================
   Layer (Modal / Dialog)
   ============================================================ */
.layui-layer.layui-layer-dialog,
.layui-layer.layui-layer-iframe {
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
  border: none !important;
}
.layui-layer.layui-layer-dialog .layui-layer-title,
.layui-layer.layui-layer-iframe .layui-layer-title {
  padding: 24px 72px 8px 24px;
  line-height: 1.4;
  height: auto;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  border-bottom: 1px solid #f0f2f5;
  background: #fff;
  border-radius: 12px 12px 0 0;
}
.layui-layer.layui-layer-dialog .layui-layer-setwin,
.layui-layer.layui-layer-iframe .layui-layer-setwin {
  top: 24px;
  right: 20px;
}
.layui-layer-btn {
  padding: 12px 16px;
  border-top: 1px solid #f0f2f5;
}

.layui-table-page {
  box-sizing: border-box;
}

/* ============================================================
   Top Navbar
   ============================================================ */
.x-navbar {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  width: 100%;
  height: 54px;
  display: flex;
  gap: 8px;
  align-items: center;
  background-color: #ffffff;
  z-index: 999;
  border-bottom: 1px solid #f0f2f5;
}

.x-navbar .x-navbar-space {
  flex: 1;
}

.x-navbar .x-navbar-logo {
  box-sizing: border-box;
  padding: 0 24px;
  width: 220px;
  display: flex;
  align-items: center;
}

.x-navbar .x-navbar-notification {
  position: relative;
  padding: 8px;
}

.x-navbar .x-navbar-notification .layui-badge {
  border-radius: 100%;
  background-color: #ff4d4f;
  transform: scale(0.75);
  position: absolute;
  top: 0;
  right: 0;
}

.x-navbar .x-navbar-userinfo {
  margin: 0 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s;
}

.x-navbar .x-navbar-userinfo:hover {
  background: #f5f7ff;
}

.x-navbar .x-navbar-userinfo span {
  margin: 0;
}

/* ============================================================
   Layout
   ============================================================ */
.x-layout {
  display: flex;
  min-height: calc(100vh - 54px);
}

/* ============================================================
   Sidebar
   ============================================================ */
.x-layout-sider {
  position: sticky;
  top: 54px;
  left: 0;
  overflow-x: hidden;
  z-index: 99;
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
  flex: 0;
  transition: flex 0.25s ease;
}

.x-layout-sider-show .x-layout-sider {
  flex: 220px 0 0;
}

.x-layout-sider-hide .x-layout-sider {
  flex: 0;
}

/* Sidebar nav bar indicator */
.x-layout-sider.layui-nav-tree .layui-nav-bar {
  display: none;
}

/* Active state */
.x-layout-sider.layui-nav-tree .layui-nav-child dd.layui-this,
.x-layout-sider.layui-nav-tree .layui-nav-child dd.layui-this a,
.x-layout-sider.layui-nav-tree .layui-this,
.x-layout-sider.layui-nav-tree .layui-this > a,
.x-layout-sider.layui-nav-tree .layui-this > a:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.x-layout-sider .layui-this-wrapper {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.x-layout-sider .layui-this-wrapper .layui-this {
  color: #fff;
  background-color: transparent;
}

/* Submenu */
.x-layout-sider .layui-nav-itemed > .layui-nav-child {
  background-color: rgba(0, 0, 0, 0.15) !important;
}

.x-layout-sider.layui-nav-tree .layui-nav-item .layui-nav-child dd {
  padding-left: 40px;
}

/* Nav item links */
.x-layout-sider .layui-nav-item > a {
  display: flex;
  cursor: pointer;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 13px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.x-layout-sider .layui-nav-item > a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
}

.x-layout-sider .layui-nav-item a img {
  width: 16px;
  height: 16px;
  opacity: 0.85;
}

.x-layout-sider .layui-nav-item > a:hover img {
  opacity: 1;
}

/* ============================================================
   Content Area
   ============================================================ */
.x-layout-content {
  padding: 16px 20px;
  flex: 1;
  overflow-x: hidden;
  min-width: 0;
}

/* ============================================================
   Breadcrumb bar
   ============================================================ */
.x-breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  background: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.x-breadcrumb .toggle {
  width: 16px;
  height: 16px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.x-breadcrumb .toggle:hover {
  opacity: 1;
}

/* ============================================================
   Page container
   ============================================================ */
.x-page {
  padding: 20px;
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* ============================================================
   Card
   ============================================================ */
.x-card {
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  border-radius: 10px;
}

/* ============================================================
   Title / Divider
   ============================================================ */
.x-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 12px;
}

.x-divider {
  width: 100%;
  height: 1px;
  background: #f0f2f5;
  margin: 12px 0;
}

.x-divider-dashed {
  width: 100%;
  height: 1px;
  margin: 12px 0;
  border-bottom: 1px dashed #e4e6f0;
}

/* ============================================================
   Buttons
   ============================================================ */
.x-btn {
  min-width: 90px;
}

/* Layui button overrides */
.layui-btn {
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.layui-btn-radius {
  border-radius: 20px;
}

.layui-btn-normal {
  background-color: #4474ff;
  border-color: #4474ff;
}

.layui-btn-normal:hover {
  filter: brightness(110%);
  box-shadow: 0 2px 8px rgba(68, 116, 255, 0.3);
}

.layui-btn-danger {
  background-color: #4474ff;
  border-color: #4474ff;
}

.layui-btn-danger:hover {
  background-color: #5585ff;
  box-shadow: 0 2px 8px rgba(68, 116, 255, 0.3);
}

/* ============================================================
   Forms (Layui)
   ============================================================ */
.x-form-vertical .layui-form-label {
  float: none;
  padding: 9px 0;
  text-align: left;
  font-weight: 500;
  color: #555;
}

.x-form-vertical .layui-input-block {
  margin-left: 0;
}

.layui-input,
.layui-select,
.layui-textarea {
  border-radius: 6px !important;
  border-color: #e0e0e0 !important;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.layui-input:focus,
.layui-textarea:focus {
  border-color: #4474ff !important;
  box-shadow: 0 0 0 3px rgba(68, 116, 255, 0.1) !important;
}

/* ============================================================
   Form required indicator
   ============================================================ */
.x-form-required:after {
  content: '';
  width: 16px;
  height: 16px;
  position: relative;
  display: inline-block;
  left: 0;
  top: 0;
  background-image: -webkit-image-set(
    url(../img/required.png) 1x,
    url(../img/required@2x.png) 2x
  );
  background-image: image-set(
    url(../img/required.png) 1x,
    url(../img/required@2x.png) 2x
  );
  background-size: 6px 6px;
  background-position: center 8px;
  background-repeat: no-repeat;
}

/* ============================================================
   Layui Table — enhanced
   ============================================================ */

/* Outer wrapper */
.layui-table-view {
  border-radius: 10px !important;
  overflow: hidden;
  border: 1px solid #eaecf4 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
  margin-top: 2px;
}

/* Header */
.layui-table th {
  background: #f0f4ff !important;
  color: #444 !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  border-right: 1px solid #e4eaf8 !important;
  padding: 12px 15px !important;
  white-space: nowrap;
}

/* Body cells */
.layui-table td {
  font-size: 13px;
  color: #444;
  padding: 10px 15px !important;
  border-right: 1px solid #f3f4fb !important;
  vertical-align: middle !important;
}

/* Alternate rows */
.layui-table tbody tr:nth-child(even) td {
  background: #fafbff;
}

/* Hover row */
.layui-table tr:hover td {
  background: #edf2ff !important;
}

/* Fixed column shadow */
.layui-table-fixed-r {
  box-shadow: -3px 0 8px rgba(0, 0, 0, .06) !important;
}
.layui-table-fixed-l {
  box-shadow: 3px 0 8px rgba(0, 0, 0, .06) !important;
}

/* Table action links */
.layui-table-link,
.layui-table a {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 4px;
  transition: background .15s;
  white-space: nowrap;
}
.layui-font-blue.layui-table-link,
.layui-font-blue {
  color: #4474ff;
  background: #edf2ff;
}
.layui-font-blue:hover {
  background: #d6e4ff;
  color: #2255dd;
}
.layui-font-orange {
  color: #f7651c;
  background: #fff4ee;
  border-radius: 4px;
  padding: 2px 8px;
}
.layui-font-orange:hover { background: #ffe5d5; }
.layui-font-red {
  color: #ff4d4f;
  background: #fff1f0;
  border-radius: 4px;
  padding: 2px 8px;
}
.layui-font-red:hover { background: #ffd6d6; }

/* Status badge — used in templet functions */
.x-td-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}
.x-td-badge-success { background: #e6f7f0; color: #00a830; }
.x-td-badge-warning { background: #fff4e5; color: #f7651c; }
.x-td-badge-primary { background: #e8edff; color: #4474ff; }
.x-td-badge-danger  { background: #fff1f0; color: #ff4d4f; }
.x-td-badge-default { background: #f5f5f5; color: #666; }

/* ============================================================
   Responsive: Mobile (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  body {
    background: #f0f2f5;
  }

  .x-navbar {
    height: 50px;
    padding: 0 8px;
  }

  .x-navbar .x-navbar-logo {
    width: auto;
    padding: 0 12px;
  }

  .x-navbar .x-navbar-logo img {
    height: 32px !important;
  }

  .x-navbar .x-navbar-userinfo {
    margin: 0 4px;
    padding: 4px 8px;
    font-size: 12px;
  }

  /* Sidebar collapsed by default on mobile */
  .x-layout-sider {
    position: fixed;
    top: 50px;
    left: 0;
    height: calc(100vh - 50px);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .x-layout-sider-show .x-layout-sider {
    transform: translateX(0);
    flex: 200px 0 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .x-layout-sider-hide .x-layout-sider {
    transform: translateX(-100%);
  }

  .x-layout {
    min-height: calc(100vh - 50px);
  }

  .x-layout-content {
    padding: 10px 12px 16px;
    width: 100%;
  }

  .x-breadcrumb {
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
  }

  .x-page {
    padding: 14px 12px;
    border-radius: 8px;
  }

  .x-title {
    font-size: 15px;
    margin-bottom: 10px;
  }

  /* Table horizontal scroll on mobile */
  .layui-table-view {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
  }

  /* Layui table page controls */
  .layui-table-page {
    padding: 8px 0;
  }

  /* Layui laypage on mobile */
  .layui-laypage {
    font-size: 12px;
  }

  .layui-laypage a,
  .layui-laypage span {
    padding: 4px 8px;
    min-width: 28px;
    height: 28px;
    line-height: 28px;
  }

  /* Form elements on mobile */
  .layui-form-item {
    margin-bottom: 10px;
  }

  .layui-input,
  .layui-select {
    height: 36px;
    line-height: 36px;
    font-size: 13px;
  }

  /* Buttons on mobile */
  .layui-btn {
    font-size: 12px;
    padding: 0 12px;
    height: 34px;
    line-height: 34px;
  }

  .x-btn {
    min-width: 72px;
  }
}

/* ============================================================
   Responsive: Small mobile (≤480px)
   ============================================================ */
@media (max-width: 480px) {
  .x-navbar .x-navbar-logo {
    padding: 0 10px;
  }

  .x-layout-content {
    padding: 8px 10px 12px;
  }

  .x-page {
    padding: 12px 10px;
  }
}

/* ============================================================
   Toolbar (action button row above tables)
   ============================================================ */
.x-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* ============================================================
   Status badges
   ============================================================ */
.x-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

.x-badge-success { background: #e6f7f0; color: #00a830; }
.x-badge-warning { background: #fff4e5; color: #f7651c; }
.x-badge-info    { background: #e8edff; color: #4474ff; }
.x-badge-danger  { background: #fff1f0; color: #ff4d4f; }

/* ============================================================
   Info / tip box
   ============================================================ */
.x-info-box {
  background: #f0f4ff;
  border-left: 3px solid #4474ff;
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  color: #444;
  font-size: 13px;
  line-height: 1.7;
}

.x-tip-box {
  background: #f7f9fc;
  border-radius: 6px;
  padding: 12px 16px;
  color: #555;
  font-size: 13px;
  line-height: 1.7;
}

/* ============================================================
   Wallet address row
   ============================================================ */
.x-wallet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7f9fc;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  flex-wrap: wrap;
}

.x-wallet-value {
  color: #f7651c;
  font-weight: 500;
  word-break: break-all;
}

/* ============================================================
   Tab overrides
   ============================================================ */
.x-tab.layui-tab {
  margin-bottom: 16px;
}

.x-tab.layui-tab .layui-tab-title li {
  font-size: 14px;
  padding: 9px 18px;
}

.x-tab.layui-tab .layui-tab-title li.layui-this {
  color: #4474ff;
  font-weight: 600;
}

.x-tab.layui-tab .layui-tab-title .layui-this::after {
  background-color: #4474ff;
  height: 2px;
}

/* ============================================================
   Two-column settings layout
   ============================================================ */
.x-settings-grid {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.x-settings-grid > .x-settings-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.x-settings-grid > .x-settings-col .x-title {
  margin-bottom: 8px;
}

/* Upload area */
.x-upload-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 0;
}

.x-upload-tip {
  color: #888;
  font-size: 13px;
}

/* Instruction list */
.x-notes {
  padding-left: 0;
  list-style: none;
  margin: 8px 0 16px;
  color: #555;
  font-size: 13px;
  line-height: 1.9;
}

@media (max-width: 768px) {
  .x-toolbar {
    gap: 6px;
    flex-wrap: wrap;
  }

  .x-settings-grid {
    flex-direction: column;
  }

  .x-wallet-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
