/* ===== 积分会员管理系统 - 豪华主题样式 ===== */

/* ---------- CSS Variables ---------- */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --bg-input: #152040;
  --bg-hover: #1a2950;
  --gold: #e2c17d;
  --gold-light: #f0d89c;
  --gold-dark: #c4a35a;
  --white: #e8e8e8;
  --white-dim: #8892a4;
  --text-primary: #e8e8e8;
  --text-secondary: #8892a4;
  --text-muted: #5a6478;
  --border-color: #2a2a4a;
  --danger: #e74c3c;
  --success: #2ecc71;
  --info: #3498db;
  --warning: #f39c12;
  --regular-color: #95a5a6;
  --silver-color: #bdc3c7;
  --gold-color: #e2c17d;
  --diamond-color: #3498db;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--gold-light);
}

ul {
  list-style: none;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== Layout ===== */
#app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--bg-primary);
  font-weight: 700;
}

.sidebar-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  font-size: 15px;
  position: relative;
}

.sidebar-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  color: var(--gold);
  background: rgba(226, 193, 125, 0.08);
  border-left-color: var(--gold);
}

.sidebar-nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-nav-item .nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--bg-primary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top Bar ---------- */
.top-bar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb span {
  color: var(--gold);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.top-bar-date {
  color: var(--text-secondary);
  font-size: 14px;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.top-bar-username {
  font-size: 14px;
  color: var(--text-primary);
}

/* ---------- Page Container ---------- */
.page-container {
  padding: 28px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ---------- Page Transitions ---------- */
.page {
  display: none;
  animation: fadeSlideIn 0.35s ease;
}

.page.active {
  display: block;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(226, 193, 125, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(30px, -30px);
}

.stat-card-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}

.stat-card-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 24px;
}

.card-body.no-padding {
  padding: 0;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  min-width: 240px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition-fast);
  outline: none;
}

.search-box input:focus {
  border-color: var(--gold);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  outline: none;
  line-height: 1.4;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-primary);
  border-color: var(--gold);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 16px rgba(226, 193, 125, 0.3);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #c0392b;
  border-color: #c0392b;
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ---------- Form Elements ---------- */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--gold);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control.error {
  border-color: var(--danger);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-control.error + .form-error {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892a4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--bg-secondary);
}

thead th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

thead th:hover {
  color: var(--gold);
}

thead th.sort-asc::after,
thead th.sort-desc::after {
  margin-left: 4px;
  font-size: 10px;
}

thead th.sort-asc::after {
  content: '\25B2';
}

thead th.sort-desc::after {
  content: '\25BC';
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody tr.clickable {
  cursor: pointer;
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.table-empty-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

/* ---------- Status & Level Badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-earn {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
}

.badge-spend {
  background: rgba(231, 76, 60, 0.15);
  color: var(--danger);
}

.badge-level {
  color: #fff;
}

.badge-level.regular {
  background: var(--regular-color);
}

.badge-level.silver {
  background: #7f8c8d;
}

.badge-level.gold {
  background: var(--gold-dark);
  color: var(--bg-primary);
}

.badge-level.diamond {
  background: var(--diamond-color);
}

/* ---------- Avatar ---------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--bg-primary);
  flex-shrink: 0;
}

.avatar.regular {
  background: var(--regular-color);
}

.avatar.silver {
  background: #bdc3c7;
}

.avatar.gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

.avatar.diamond {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 28px;
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: 36px;
}

/* ---------- Member info row ---------- */
.member-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-info .member-name {
  font-weight: 600;
}

.member-info .member-id {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Search/Filter Row ===== */
.member-search-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.member-search-row select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  min-width: 180px;
  outline: none;
  cursor: pointer;
}

.member-search-row select:focus {
  border-color: var(--gold);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.pagination button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.pagination button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.pagination button.active {
  background: var(--gold);
  color: var(--bg-primary);
  border-color: var(--gold);
  font-weight: 700;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== Member Detail Page ===== */
.detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 300px;
}

.detail-info h2 {
  font-size: 22px;
  font-weight: 700;
}

.detail-info .member-meta {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-points-box {
  text-align: center;
  min-width: 140px;
}

.detail-points-box .points-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--gold);
}

.detail-points-box .points-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-grid-full {
  grid-column: 1 / -1;
}

/* Info list */
.info-list {
  display: grid;
  gap: 0;
}

.info-item {
  display: flex;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.info-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== Level Progress ===== */
.level-progress {
  margin-top: 16px;
}

.level-progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.level-progress-current {
  color: var(--text-secondary);
}

.level-progress-next {
  color: var(--gold);
}

.level-progress-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

.level-progress-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===== Benefits list ===== */
.benefits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.benefit-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: rgba(226, 193, 125, 0.1);
  border: 1px solid rgba(226, 193, 125, 0.2);
  border-radius: 20px;
  color: var(--gold-light);
  font-size: 13px;
}

/* ===== Points Transaction Log ===== */
.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row input,
.filter-row select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.filter-row input:focus,
.filter-row select:focus {
  border-color: var(--gold);
}

.filter-row input[type="date"] {
  color-scheme: dark;
}

.filter-row label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Amount formatting */
.amount-earn {
  color: var(--success);
  font-weight: 600;
}

.amount-spend {
  color: var(--danger);
  font-weight: 600;
}

/* ===== Form: Add Member ===== */
.form-card {
  max-width: 680px;
}

.form-card .card-body {
  padding: 28px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ===== Levels Config Page ===== */
.level-config-table td {
  vertical-align: middle;
}

.level-color-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.level-name-cell {
  display: flex;
  align-items: center;
  font-weight: 600;
}

.level-benefits-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.level-benefits-cell .benefit-tag {
  font-size: 11px;
  padding: 3px 10px;
}

/* Editable fields */
.editable-field {
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  width: 100px;
  text-align: center;
  font-size: 14px;
  outline: none;
}

.editable-field:focus {
  border-color: var(--gold);
}

.discount-input {
  width: 80px;
}

/* ===== Rules Page ===== */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition-fast);
}

.rule-card:hover {
  border-color: var(--gold);
}

.rule-card-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.rule-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.rule-card-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rule-card-field label {
  font-size: 14px;
  color: var(--text-secondary);
}

.rule-card-field input {
  width: 120px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
  outline: none;
}

.rule-card-field input:focus {
  border-color: var(--gold);
}

.rule-card-field .input-suffix {
  color: var(--text-muted);
  font-size: 14px;
  margin-left: 4px;
}

.rule-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.5;
}

/* ===== Toast / Notifications ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success {
  background: #27ae60;
}

.toast-error {
  background: #c0392b;
}

.toast-info {
  background: #2980b9;
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: fadeSlideIn 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== Responsive: Mobile ===== */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}

.mobile-nav-overlay.show {
  display: block;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  .hamburger-btn {
    display: block;
  }

  .page-container {
    padding: 20px 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
  }

  .search-box {
    flex: 1;
  }

  .member-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .member-search-row select {
    width: 100%;
  }

  .top-bar {
    padding: 0 16px;
  }

  .breadcrumb {
    font-size: 13px;
  }

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

  .page-title {
    font-size: 20px;
  }

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

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-container {
    padding: 16px 12px;
  }

  .card-body {
    padding: 16px;
  }

  .form-card .card-body {
    padding: 16px;
  }

  .detail-profile {
    flex-direction: column;
    text-align: center;
  }

  .detail-profile .detail-info .member-meta {
    justify-content: center;
  }

  .top-bar-date {
    display: none;
  }

  thead th,
  tbody td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* ===== Print-friendly adjustments ===== */
@media print {
  .sidebar,
  .top-bar,
  .hamburger-btn,
  .btn {
    display: none !important;
  }

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

  body {
    background: #fff;
    color: #000;
  }

  .card {
    break-inside: avoid;
  }
}
