@import url('/css/premium-ui.css');

/* ═══════════════════════════════════════════
    清湘的小卖部 — Shared Styles
   ═══════════════════════════════════════════ */

:root {
  --bg: #121018; --surface: #1c1a24; --surface-hover: #242230;
  --text: #eee6d4; --text-secondary: #b0a088; --border: #333046;
  --gold: #d4a853; --gold-light: #e8cc7a; --gold-dark: #b8922e;
  --amber: #f59e0b; --red: #e74c3c; --green: #27ae60; --blue: #5b9bd5; --purple: #9b7cf6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3); --shadow: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5); --radius: 16px; --radius-sm: 10px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #383448; border-radius: 3px; }

/* ── Header ── */
.header { position: sticky; top: 0; z-index: 100; background: rgba(18,16,24,0.88); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); padding: 0 24px; }
.header-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-tag { padding: 6px 14px; border-radius: 20px; background: var(--surface); font-size: 0.85rem; font-weight: 600; }
.hamburger { display: none; background: none; color: var(--text); font-size: 1.5rem; padding: 4px 8px; border-radius: 8px; }

/* ── Main Content ── */
.main-content { max-width: 1400px; margin: 0 auto; padding: 28px 32px; min-height: calc(100vh - 64px); }
.panel-header { margin-bottom: 24px; }
.panel-header h2 { font-size: 1.5rem; font-weight: 700; }
.panel-header p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

/* ── Loading & Empty States ── */
.loading-state, .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-secondary); gap: 12px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state .empty-icon { font-size: 3rem; }

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 20px 24px; border: 1px solid var(--border); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; }
.stat-value { font-size: 1.8rem; font-weight: 800; margin-top: 4px; }
.stat-value.gold { color: var(--gold); } .stat-value.green { color: var(--green); } .stat-value.blue { color: var(--blue); }

/* ── Tables ── */
.table-wrap { background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); margin-bottom: 20px; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th { text-align: left; padding: 12px 16px; font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table-wrap td { padding: 12px 16px; font-size: 0.9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--surface-hover); }

/* ── Buttons ── */
.btn { padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; transition: var(--transition); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; border-radius: 6px; }
.btn-gold { background: var(--gold); color: #1a1810; } .btn-gold:hover { background: var(--gold-light); }
.btn-red { background: var(--red); color: #fff; } .btn-red:hover { opacity: 0.85; }
.btn-green { background: var(--green); color: #fff; } .btn-green:hover { opacity: 0.85; }
.btn-blue { background: var(--blue); color: #fff; } .btn-blue:hover { opacity: 0.85; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); }

/* ── Forms ── */
.form-card { background: var(--surface); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; border: 1px solid var(--border); }
.form-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.form-field { flex: 1; min-width: 160px; }
.form-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; padding: 9px 14px; border-radius: 8px; border: 1.5px solid var(--border); font-size: 0.9rem; transition: var(--transition); background: var(--bg); color: var(--text); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--gold); background: var(--surface); }
.form-field textarea { resize: vertical; min-height: 60px; }
.form-field .field-hint { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { background: rgba(231,76,60,0.12); color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 12px; display: none; }

/* ── Login ── */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 64px); padding: 40px 20px; }
.login-card { background: var(--surface); border-radius: var(--radius); padding: 40px; width: 400px; max-width: 100%; box-shadow: var(--shadow-lg); text-align: center; border: 1px solid var(--border); }
.login-card .login-icon { font-size: 3rem; margin-bottom: 16px; }
.login-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.login-card p { color: var(--text-secondary); margin-bottom: 24px; font-size: 0.9rem; }
.login-card .form-group { margin-bottom: 12px; }
.login-card .form-group input { width: 100%; padding: 11px 16px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: 0.95rem; background: var(--bg); color: var(--text); transition: var(--transition); }
.login-card .form-group input:focus { border-color: var(--gold); }

/* ── Toasts ── */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; color: #fff; animation: toastIn 0.3s ease; box-shadow: var(--shadow); max-width: 360px; pointer-events: auto; display: flex; align-items: center; gap: 8px; }
.toast.success { background: var(--green); } .toast.error { background: var(--red); } .toast.info { background: var(--blue); }
.toast .toast-close { margin-left: auto; cursor: pointer; opacity: 0.7; font-size: 1rem; background: none; border: none; color: inherit; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.badge-success { background: rgba(39,174,96,0.18); color: var(--green); }
.badge-warning { background: rgba(245,158,11,0.18); color: var(--amber); }
.badge-danger { background: rgba(231,76,60,0.18); color: var(--red); }
.badge-info { background: rgba(91,155,213,0.18); color: var(--blue); }
.badge-admin { background: rgba(155,124,246,0.18); color: var(--purple); }

/* ── Token Box ── */
.token-box { font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace; font-size: 0.85rem; word-break: break-all; color: var(--gold); background: var(--bg); padding: 14px 18px; border-radius: 10px; border: 1px solid var(--border); user-select: all; }

/* ── Drop Zone ── */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 24px; text-align: center; transition: var(--transition); cursor: pointer; background: var(--bg); min-height: 100px; display: flex; align-items: center; justify-content: center; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--gold); background: rgba(212,168,83,0.08); }
.dz-icon { font-size: 2rem; margin-bottom: 6px; }
.dz-text { font-size: 0.85rem; color: var(--text-secondary); }
.drop-zone img { max-width: 100%; max-height: 180px; border-radius: 8px; }

/* ── QR Preview ── */
.qr-preview-wrap { background: #fff; display: inline-block; padding: 10px; border-radius: 10px; }
.qr-preview-wrap img { max-width: 140px; display: block; }

/* ── Recharge Layout ── */
.recharge-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hamburger { display: block; }
  .main-content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { overflow-x: auto; }
  .form-row { flex-direction: column; }
  .form-field { min-width: 100%; }
  .login-card { padding: 24px; }
  .header { padding: 0 12px; }
  .recharge-layout { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .header-right .btn-sm { font-size: 0.7rem; padding: 4px 8px; }
}
