/* static/css/style.css */

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

body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      background: #f5f7fa;
      color: #333;
}

/* ========== 通用布局 ========== */
.container {
      display: flex;
      min-height: 100vh;
}

/* ========== 侧边栏（管理后台通用） ========== */
.sidebar {
      width: 260px;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 20px 0;
}

.sidebar h3 {
      padding: 0 20px 20px;
      font-size: 18px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.2);
      margin-bottom: 20px;
      text-align: center;
}

.sidebar nav a {
      display: block;
      padding: 12px 20px;
      color: rgba(255, 255, 255, 0.9);
      text-decoration: none;
      transition: all 0.3s;
      cursor: pointer;
}

.sidebar nav a:hover,
.sidebar nav a.active {
      background: rgba(255, 255, 255, 0.2);
      padding-left: 28px;
}

/* ========== 主内容区 ========== */
.main-content {
      flex: 1;
      padding: 20px;
}

.admin-body .main-content {
      margin-left: 260px;
}

/* ========== 顶部栏 ========== */
.top-bar {
      background: white;
      padding: 15px 20px;
      border-radius: 10px;
      margin-bottom: 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.top-bar h2 {
      margin: 0;
      color: #333;
      font-size: 20px;
}

.user-info {
      display: flex;
      align-items: center;
      gap: 12px;
}

.welcome-text {
      color: #666;
      font-size: 14px;
}

/* ========== 角色徽章 ========== */
.role-badge {
      display: inline-block;
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 500;
}

.role-badge[data-role="super"] {
      background: #ffd700;
      color: #8b6914;
}

.role-badge[data-role="operator"] {
      background: #667eea;
      color: white;
}

.role-badge[data-role="viewer"] {
      background: #95a5a6;
      color: white;
}

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

.stat-card {
      background: white;
      padding: 20px;
      border-radius: 10px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-card h4 {
      color: #666;
      font-size: 14px;
      margin-bottom: 10px;
}

.stat-card .value {
      font-size: 28px;
      font-weight: bold;
      color: #333;
}

/* ========== 卡片通用样式 ========== */
.card {
      background: white;
      border-radius: 10px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      margin-bottom: 20px;
      overflow: hidden;
}

.card-header {
      padding: 15px 20px;
      border-bottom: 1px solid #e0e0e0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
}

.card-header h3 {
      margin: 0;
      color: #333;
}

.card-header .buttons,
.card-header .header-actions {
      margin-left: auto;
      display: flex;
      gap: 10px;
}

.card-footer {
      padding: 15px 20px;
      border-top: 1px solid #e0e0e0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
}

/* ========== 筛选栏 ========== */
.filter-bar {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
      padding: 15px 20px;
      background: #f8f9fa;
      border-bottom: 1px solid #eee;
}

.filter-bar select,
.filter-bar input {
      padding: 6px 10px;
      border-radius: 6px;
      border: 1px solid #ddd;
      font-size: 13px;
      background: white;
}

.filter-bar .btn {
      padding: 6px 12px;
      font-size: 13px;
      width: auto;
}

.search-input {
      flex: 1;
      min-width: 200px;
      padding: 8px 12px;
      border: 1px solid #ddd;
      border-radius: 6px;
      font-size: 14px;
}

/* ========== 按钮样式 ========== */
.btn {
      padding: 8px 16px;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 14px;
      transition: all 0.3s;
}

.btn-primary {
      background: #667eea;
      color: white;
}

.btn-primary:hover {
      background: #5a67d8;
}

.btn-danger {
      background: #e53e3e;
      color: white;
}

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

.btn-secondary {
      background: #718096;
      color: white;
}

.btn-secondary:hover {
      background: #4a5568;
}

.btn-warning {
      background: #ed8936;
      color: white;
}

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

.btn-success {
      background: #27ae60;
      color: white;
}

.btn-success:hover {
      background: #229954;
}

.btn-info {
      background: #17a2b8;
      color: white;
}

.btn-info:hover {
      background: #138496;
}

.btn-sm {
      padding: 5px 10px;
      font-size: 12px;
      width: auto;
}

.btn-xs {
      padding: 4px 8px;
      font-size: 11px;
      border-radius: 4px;
      width: auto;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 52px;
      height: 28px;
}

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

/* ========== 表格样式 ========== */
.table-container {
      overflow-x: auto;
}

table {
      width: 100%;
      border-collapse: collapse;
}

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

th {
      background: #f8f9fa;
      font-weight: 600;
      color: #555;
}

.data-table {
      width: 100%;
      border-collapse: collapse;
}

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

.data-table th {
      background: #f8f9fa;
      font-weight: 600;
      color: #555;
}

.data-table tr:hover {
      background: #fafafa;
}

.table-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
}

/* ========== 余额单元格 ========== */
.balance-cell {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
}

.balance-amount {
      font-weight: bold;
      color: #333;
}

.balance-edit-btn {
      padding: 2px 8px;
      font-size: 11px;
      white-space: nowrap;
}

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

.modal-content {
      background: white;
      padding: 24px;
      border-radius: 12px;
      width: 90%;
      max-width: 500px;
}

.modal-content h3 {
      margin-bottom: 20px;
      color: #333;
}

.modal-content input,
.modal-content select {
      width: 100%;
      padding: 10px;
      margin-bottom: 15px;
      border: 1px solid #ddd;
      border-radius: 5px;
}

.modal-buttons {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 20px;
}

.modal-buttons .btn {
      width: auto;
      padding: 8px 16px;
}

/* ========== 输入组 ========== */
.input-group {
      margin-bottom: 15px;
}

.input-group label {
      display: block;
      margin-bottom: 5px;
      font-weight: 500;
      color: #555;
      font-size: 14px;
}

.input-group input {
      width: 100%;
      padding: 10px;
      border: 1px solid #ddd;
      border-radius: 5px;
}

.input-group input:focus {
      outline: none;
      border-color: #667eea;
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
      font-size: 12px;
      color: #999;
      margin-top: 5px;
      display: block;
}

/* ========== 验证码卡片 ========== */
.code-card {
      background: #f8f9fa;
      border-radius: 12px;
      padding: 15px;
      margin-bottom: 15px;
      border-left: 4px solid #1a73e8;
}

.code-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      flex-wrap: wrap;
      gap: 10px;
}

.code-value {
      font-size: 24px;
      font-weight: bold;
      font-family: monospace;
      letter-spacing: 2px;
      color: #1a73e8;
}

.code-actions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
}

.code-actions .btn {
      padding: 3px 8px;
      font-size: 11px;
      width: auto;
}

.code-desc {
      color: #666;
      font-size: 13px;
}

.code-status {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 11px;
      margin-left: 8px;
}

.status-active {
      background: #d4edda;
      color: #155724;
}

.status-inactive {
      background: #f8d7da;
      color: #721c24;
}

/* ========== 二维码 ========== */
.qr-display {
      text-align: center;
      padding: 30px;
}

.qr-display img {
      border: 1px solid #ddd;
      border-radius: 10px;
      padding: 15px;
      background: white;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qr-tip {
      background: #e8f4fd;
      border-radius: 8px;
      padding: 15px;
      text-align: left;
      margin-top: 20px;
}

/* ========== Toast消息 ========== */
.toast-message {
      position: fixed;
      bottom: 20px;
      right: 20px;
      padding: 12px 20px;
      border-radius: 8px;
      color: white;
      z-index: 2000;
      animation: slideIn 0.3s ease;
}

.toast-success {
      background: #48bb78;
}

.toast-error {
      background: #f56565;
}

.toast-info {
      background: #4299e1;
}

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

      to {
            transform: translateX(0);
            opacity: 1;
      }
}

/* ========== 信息框 ========== */
.info-box {
      background: #f8f9fa;
      border-radius: 12px;
      padding: 15px;
      margin-top: 15px;
}

.balance-info {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 0;
      border-bottom: 1px solid #e9ecef;
}

.balance-info:last-child {
      border-bottom: none;
}

.balance-label {
      color: #666;
      font-size: 14px;
}

.balance-value {
      font-size: 18px;
      font-weight: bold;
      color: #333;
}

.balance-value.large {
      font-size: 32px;
      color: #667eea;
}

/* ========== 错误/成功消息 ========== */
.error-message {
      background: #fee;
      color: #e74c3c;
      padding: 12px;
      border-radius: 10px;
      margin-bottom: 15px;
      font-size: 14px;
}

.success-message {
      background: #e8f5e9;
      color: #4caf50;
      padding: 12px;
      border-radius: 10px;
      margin-bottom: 15px;
      font-size: 14px;
}

.result-box {
      text-align: center;
      padding: 20px;
}

.result-amount {
      font-size: 48px;
      font-weight: bold;
      color: #667eea;
      margin: 20px 0;
}

.hidden {
      display: none !important;
}

/* ========== 分页 ========== */
.pagination {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 10px;
      padding: 20px;
      border-top: 1px solid #eee;
}

.page-btn {
      padding: 6px 12px;
      background: white;
      border: 1px solid #ddd;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.3s;
}

.page-btn:hover {
      background: #667eea;
      color: white;
      border-color: #667eea;
}

.page-info {
      color: #666;
      font-size: 14px;
}

/* ========== 商户选择页面 ========== */
.merchant-select-body {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 20px;
}

.merchant-container {
      max-width: 500px;
      width: 100%;
      background: white;
      border-radius: 20px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
      overflow: hidden;
}

.merchant-header {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 30px 20px;
      text-align: center;
}

.merchant-header h1 {
      font-size: 28px;
      margin-bottom: 8px;
}

.merchant-header p {
      opacity: 0.9;
      font-size: 14px;
}

.merchant-list {
      padding: 20px;
}

.merchant-item {
      display: block;
      background: #f8f9fa;
      border-radius: 12px;
      padding: 20px;
      margin-bottom: 15px;
      text-decoration: none;
      transition: all 0.3s;
      border: 1px solid #e9ecef;
}

.merchant-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
      background: white;
}

.merchant-name {
      font-size: 18px;
      font-weight: bold;
      color: #333;
      margin-bottom: 5px;
}

.merchant-desc {
      font-size: 13px;
      color: #666;
}

.merchant-footer {
      padding: 15px 20px;
      text-align: center;
      border-top: 1px solid #eee;
      color: #999;
      font-size: 12px;
}

.no-merchants {
      text-align: center;
      padding: 40px;
      color: #999;
}

/* ========== 核销页面 ========== */
.verify-body {
      background: #f5f7fa;
      min-height: 100vh;
      padding: 20px;
}

.verify-container {
      max-width: 500px;
      margin: 0 auto;
}

.verify-header {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border-radius: 20px;
      padding: 30px 20px;
      color: white;
      text-align: center;
      margin-bottom: 20px;
}

.verify-header h1 {
      font-size: 24px;
      margin-bottom: 8px;
}

.verify-header p {
      opacity: 0.9;
      font-size: 14px;
}

.verify-card {
      background: white;
      border-radius: 16px;
      padding: 20px;
      margin-bottom: 20px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.card-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
      margin-bottom: 15px;
      padding-bottom: 10px;
      border-bottom: 2px solid #f0f0f0;
}

.verify-code-hint {
      font-size: 12px;
      color: #999;
      margin-top: 5px;
}

.loading-spinner {
      text-align: center;
      padding: 40px;
      color: #666;
}

/* ========== 管理后台专用 ========== */
.admin-body {
      background: #f5f7fa;
}

.admin-container {
      min-height: 100vh;
}

.admin-body .sidebar {
      position: fixed;
      left: 0;
      top: 0;
      width: 260px;
      height: 100%;
      background: #1a1a2e;
      color: white;
      padding: 20px 0;
}

.admin-body .sidebar h3 {
      text-align: center;
      padding: 20px;
      border-bottom: 1px solid #2a2a3e;
      margin-bottom: 20px;
}

.admin-body .sidebar nav a {
      display: block;
      padding: 12px 24px;
      color: #ccc;
      text-decoration: none;
      transition: all 0.3s;
}

.admin-body .sidebar nav a:hover {
      background: #2a2a3e;
      color: white;
}

.admin-body .sidebar nav a.active {
      background: #1a73e8;
      color: white;
}

.admin-body .main-content {
      margin-left: 260px;
      padding: 20px 30px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
      .admin-body .sidebar {
            width: 100%;
            height: auto;
            position: relative;
      }

      .admin-body .main-content {
            margin-left: 0;
      }

      .stats-grid {
            grid-template-columns: 1fr 1fr;
            gap: 12px;
      }

      .stat-card {
            padding: 12px;
      }

      .stat-card .value {
            font-size: 22px;
      }

      .code-card-header {
            flex-direction: column;
            align-items: flex-start;
      }

      .filter-bar {
            width: 100%;
      }

      .filter-bar select,
      .filter-bar input {
            flex: 1;
      }

      .action-buttons {
            flex-direction: column;
            gap: 4px;
            min-width: auto;
      }

      .action-buttons .btn {
            width: 100%;
            text-align: center;
      }
}

/* ========== 登录页面样式 ========== */
.login-body {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 20px;
      font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.login-container {
      background: white;
      border-radius: 16px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
      width: 420px;
      max-width: 100%;
      overflow: hidden;
}

.login-header {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 30px;
      text-align: center;
}

.login-header h1 {
      font-size: 24px;
      margin-bottom: 8px;
}

.login-header p {
      opacity: 0.9;
      font-size: 14px;
}

.login-tabs {
      display: flex;
      border-bottom: 1px solid #eee;
}

.login-tabs .tab-btn {
      flex: 1;
      padding: 15px;
      background: none;
      border: none;
      font-size: 16px;
      cursor: pointer;
      transition: all 0.3s;
}

.login-tabs .tab-btn.active {
      color: #667eea;
      border-bottom: 2px solid #667eea;
}

.login-form {
      padding: 30px;
}

.sms-group {
      display: flex;
      gap: 10px;
}

.sms-group input {
      flex: 1;
}

.sms-group button {
      width: 120px;
      padding: 12px;
      background: #f0f0f0;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      font-size: 14px;
}

.sms-group button:hover {
      background: #e0e0e0;
}

.btn-login {
      width: 100%;
      padding: 14px;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
      margin-top: 10px;
}

.btn-login:hover {
      transform: translateY(-1px);
      box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.loading {
      display: none;
      text-align: center;
      margin-top: 15px;
      color: #999;
}
#customConfirmModal .modal-content {
      background: white;
      padding: 24px;
      border-radius: 12px;
      width: 90%;
      max-width: 400px;
      text-align: center;
}
.expire-info {
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 500;
}

.expire-info.normal {
      background: #e8f5e9;
      color: #2e7d32;
}

.expire-info.warning {
      background: #fff3e0;
      color: #e65100;
}

.expire-info.danger {
      background: #ffebee;
      color: #c62828;
}
/* 广告图片加载失败时显示占位符 */
.ad-image-placeholder {
      background: #f5f5f5;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #999;
      font-size: 12px;
      min-height: 100px;
      border-radius: 8px;
}
/* 固定广告区域样式 */
.fixed-ad-image {
      max-width: 100%;
      max-height: 100px;
      width: auto;
      height: auto;
      border-radius: 8px;
      object-fit: contain;
}

.fixed-ad-text {
      padding: 15px;
      text-align: center;
      font-size: 14px;
      border-radius: 8px;
}

/* 固定容器尺寸 */
#fixedAdContent {
      min-height: 120px;
      max-height: 150px;
      overflow: hidden;
}

/* 支付窗口相关样式 */
.payment-modal .modal-content {
      max-width: 500px;
      border-radius: 16px;
      box-shadow: 0 20px 35px rgba(0, 0, 0, 0.2);
}

.payment-option {
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 12px;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 12px;
}

.payment-option:hover {
      background-color: #f7fafc;
      border-color: #3182ce;
}

.payment-option.selected {
      background-color: #ebf8ff;
      border-color: #3182ce;
      box-shadow: 0 2px 6px rgba(49, 130, 206, 0.2);
}

.payment-icon {
      font-size: 32px;
}

.payment-detail {
      flex: 1;
}

.payment-detail strong {
      font-size: 16px;
}

.payment-detail small {
      color: #718096;
      font-size: 12px;
}

.fake-qr {
      text-align: center;
      padding: 20px;
      background: #f8f9fa;
      border-radius: 12px;
      margin: 15px 0;
}

.fake-qr .qr-placeholder {
      font-size: 80px;
      letter-spacing: 8px;
}

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