/* =========================================================
   ENDSHOP — app.css   v2.0  Dark Premium
   ========================================================= */
:root {
  /* Colors */
  --bg:         #080810;
  --bg2:        #0e0e1a;
  --surface:    #12121f;
  --surface2:   #1a1a2e;
  --surface3:   #22223a;
  --border:     rgba(255,255,255,.06);
  --border2:    rgba(255,255,255,.12);

  /* Accent — Electric Blue + Cyan */
  --a1: #3b82f6;
  --a2: #06b6d4;
  --agrad: linear-gradient(135deg,#3b82f6,#06b6d4);
  --agrad-soft: linear-gradient(135deg,rgba(59,130,246,.15),rgba(6,182,212,.10));

  /* Status */
  --green:  #22c55e;
  --red:    #ef4444;
  --yellow: #f59e0b;
  --orange: #f97316;

  /* Text */
  --t1: #f1f5f9;
  --t2: #94a3b8;
  --t3: #475569;

  /* Spacing / Shape */
  --r:   12px;
  --r2:  8px;
  --r3:  20px;
  --sh:  0 4px 24px rgba(0,0,0,.5);
  --sh2: 0 8px 40px rgba(0,0,0,.7);
  --tr:  .18s ease;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Sarabun', sans-serif; background: var(--bg); color: var(--t1); min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--a1); border-radius: 99px; }

/* ── Layout ── */
.page-shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); position: fixed; height: 100vh; overflow-y: auto; z-index: 100; transition: transform var(--tr); }
.main-content { flex: 1; margin-left: 240px; min-height: 100vh; }
@media(max-width:768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ── Sidebar ── */
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo .brand { font-family: 'Space Grotesk', sans-serif; font-size: 1.4rem; font-weight: 700; background: var(--agrad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-logo .brand span { -webkit-text-fill-color: var(--t2); font-weight: 400; font-size: .8rem; display: block; margin-top: 2px; }
.sidebar-wallet { margin: 12px 14px; padding: 14px; background: var(--agrad-soft); border: 1px solid rgba(59,130,246,.2); border-radius: var(--r); }
.sidebar-wallet .label { font-size: .72rem; color: var(--t2); text-transform: uppercase; letter-spacing: .5px; }
.sidebar-wallet .amount { font-size: 1.5rem; font-weight: 700; color: var(--t1); font-family: 'Space Grotesk', sans-serif; }
.sidebar-wallet .amount small { font-size: .75rem; color: var(--t2); font-weight: 400; }
.sidebar-nav { padding: 8px 0; }
.sidebar-section { padding: 12px 18px 4px; font-size: .68rem; color: var(--t3); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--t2); font-size: .9rem; transition: var(--tr); border-left: 3px solid transparent; }
.sidebar-link i { width: 18px; text-align: center; font-size: .9rem; }
.sidebar-link:hover { color: var(--t1); background: rgba(255,255,255,.04); }
.sidebar-link.active { color: var(--a1); background: rgba(59,130,246,.08); border-left-color: var(--a1); }

/* ── Topbar ── */
.topbar { height: 60px; background: rgba(8,8,16,.8); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.menu-toggle { background: none; border: none; color: var(--t2); font-size: 1.1rem; cursor: pointer; padding: 6px; border-radius: var(--r2); }
.menu-toggle:hover { background: var(--surface2); color: var(--t1); }
.page-title { font-size: 1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface2); border-radius: 99px; font-size: .85rem; cursor: pointer; }
.topbar-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--agrad); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; }

/* ── Cards ── */
.es-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.es-card:hover { border-color: var(--border2); box-shadow: var(--sh2); }
.card-pad { padding: 20px; }

/* ── Product Card ── */
.prod-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3); overflow: hidden; transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr); }
.prod-card:hover { transform: translateY(-4px); box-shadow: var(--sh2); border-color: rgba(59,130,246,.3); }
.prod-card .thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--surface2); }
.prod-card .prod-body { padding: 16px; }
.prod-card .prod-name { font-weight: 600; font-size: .95rem; margin-bottom: 8px; }
.prod-card .prod-price { font-size: 1.5rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; background: var(--agrad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.prod-card .prod-price sub { font-size: .7rem; color: var(--t2); -webkit-text-fill-color: var(--t2); font-weight: 400; font-family: 'Sarabun', sans-serif; }
.prod-card .stock-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.stock-ok  { background: rgba(34,197,94,.12); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.stock-out { background: rgba(239,68,68,.12); color: var(--red);   border: 1px solid rgba(239,68,68,.25); }

/* ── Buttons ── */
.btn-es { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 22px; border-radius: 99px; font-family: 'Sarabun', sans-serif; font-size: .9rem; font-weight: 600; cursor: pointer; border: none; transition: var(--tr); }
.btn-es:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--agrad); color: #fff; }
.btn-primary:hover { opacity: .85; transform: translateY(-1px); color: #fff; }
.btn-success { background: linear-gradient(135deg,#16a34a,#22c55e); color: #fff; }
.btn-success:hover { opacity: .85; color: #fff; }
.btn-ghost  { background: var(--surface2); color: var(--t2); border: 1px solid var(--border2); }
.btn-ghost:hover  { color: var(--t1); background: var(--surface3); }
.btn-danger { background: linear-gradient(135deg,#dc2626,#ef4444); color: #fff; }
.btn-danger:hover { opacity: .85; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-w { width: 100%; }

/* ── Form Inputs ── */
.es-input { width: 100%; background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--r2); color: var(--t1); padding: 11px 14px; font-family: 'Sarabun', sans-serif; font-size: .92rem; transition: border var(--tr), box-shadow var(--tr); }
.es-input:focus { outline: none; border-color: var(--a1); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.es-input::placeholder { color: var(--t3); }
.es-label { display: block; font-size: .82rem; color: var(--t2); margin-bottom: 6px; font-weight: 500; }
.es-form-group { margin-bottom: 18px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .es-input { padding-left: 40px; }
.input-icon-wrap .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--t3); font-size: .85rem; }
.input-eye { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--t3); cursor: pointer; background: none; border: none; font-size: .85rem; }
.input-eye:hover { color: var(--t2); }

/* ── Auth pages ── */
.auth-page { min-height: 100vh; display: flex; }
.auth-visual { flex: 1; background: var(--agrad); position: relative; overflow: hidden; display: none; }
.auth-visual::before { content: ''; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
.auth-visual-inner { position: relative; z-index: 1; padding: 60px 40px; height: 100%; display: flex; flex-direction: column; justify-content: center; }
.auth-visual h1 { font-family: 'Space Grotesk', sans-serif; font-size: 2.5rem; font-weight: 700; color: #fff; margin-bottom: 16px; }
.auth-visual p { color: rgba(255,255,255,.8); font-size: 1.05rem; line-height: 1.7; }
.auth-box-wrap { width: 100%; max-width: 460px; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; }
.auth-brand { font-family: 'Space Grotesk', sans-serif; font-size: 1.8rem; font-weight: 700; margin-bottom: 6px; }
.auth-brand span { background: var(--agrad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-sub { color: var(--t2); font-size: .9rem; margin-bottom: 32px; }
.auth-divider { text-align: center; color: var(--t3); font-size: .8rem; margin: 16px 0; position: relative; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: 44%; height: 1px; background: var(--border2); }
.auth-divider::before { left: 0; } .auth-divider::after { right: 0; }
.auth-footer-link { color: var(--t2); font-size: .85rem; text-align: center; margin-top: 20px; }
.auth-footer-link a { color: var(--a1); font-weight: 500; }
@media(min-width:768px) { .auth-visual { display: flex; } .auth-page { justify-content: flex-end; } }

/* ── Stats ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: var(--r2); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 12px; }
.stat-card .stat-val { font-size: 1.8rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.stat-card .stat-label { font-size: .78rem; color: var(--t2); margin-top: 2px; }

/* ── Tables ── */
.es-table-wrap { overflow-x: auto; }
.es-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.es-table th { background: var(--surface2); color: var(--t2); font-weight: 600; padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border2); white-space: nowrap; }
.es-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.es-table tr:hover td { background: rgba(255,255,255,.02); }
.es-table .mono { font-family: 'Space Grotesk', monospace; font-size: .82rem; background: var(--surface2); border-radius: 4px; padding: 2px 7px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

/* ── Topup methods ── */
.topup-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 14px; }
.topup-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3); padding: 28px 20px; text-align: center; transition: var(--tr); cursor: pointer; }
.topup-card:hover { border-color: rgba(59,130,246,.4); background: var(--surface2); transform: translateY(-3px); }
.topup-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; }
.topup-card h5 { font-weight: 700; margin-bottom: 4px; }
.topup-card p { font-size: .78rem; color: var(--t2); }

/* ── Upload zone ── */
.upload-zone { border: 2px dashed var(--border2); border-radius: var(--r); padding: 40px 24px; text-align: center; cursor: pointer; transition: var(--tr); }
.upload-zone:hover, .upload-zone.drag { border-color: var(--a1); background: rgba(59,130,246,.04); }
.upload-zone i { font-size: 2.4rem; color: var(--t3); display: block; margin-bottom: 10px; }
.upload-zone h6 { font-weight: 600; margin-bottom: 4px; }
.upload-zone p { font-size: .8rem; color: var(--t2); }

/* ── Info box ── */
.info-box { background: var(--agrad-soft); border: 1px solid rgba(59,130,246,.2); border-radius: var(--r); padding: 18px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border: none; }
.info-label { font-size: .82rem; color: var(--t2); }
.info-value { font-weight: 600; font-family: 'Space Grotesk', sans-serif; }

/* ── Section heading ── */
.sec-head { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.sec-head::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Profile ── */
.profile-header { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3); padding: 28px; display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--agrad); display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.profile-wallet { background: var(--agrad); border-radius: var(--r); padding: 18px 24px; min-width: 180px; }
.profile-wallet .amount { font-size: 2rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; color: #fff; }
.profile-wallet .label { font-size: .75rem; color: rgba(255,255,255,.75); }

/* ── Badge ── */
.badge-es { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.badge-success { background: rgba(34,197,94,.12); color: var(--green); border: 1px solid rgba(34,197,94,.2); }
.badge-danger  { background: rgba(239,68,68,.12);  color: var(--red);   border: 1px solid rgba(239,68,68,.2); }
.badge-info    { background: rgba(59,130,246,.12);  color: var(--a1);    border: 1px solid rgba(59,130,246,.2); }
.badge-warn    { background: rgba(245,158,11,.12); color: var(--yellow); border: 1px solid rgba(245,158,11,.2); }

/* ── Alert ── */
.alert-es { border-radius: var(--r2); padding: 12px 16px; font-size: .88rem; display: flex; align-items: center; gap: 10px; }
.alert-err  { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #fca5a5; }
.alert-ok   { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.25);  color: #86efac; }
.alert-info { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25); color: #93c5fd; }

/* ── Admin sidebar separate ── */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); flex-shrink: 0; }

/* ── Order link feature ── */
.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 10px; }
.order-card .source { font-size: .72rem; color: var(--t3); text-transform: uppercase; letter-spacing: .5px; }
.order-card .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Animations ── */
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn .3s ease both; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.3} }
.pulse { animation: pulse-dot 1.5s ease infinite; }

/* ── Responsive ── */
.content-wrap { padding: 24px; }
@media(max-width:576px) { .content-wrap { padding: 16px; } .auth-box-wrap { padding: 28px 16px; } }
