/* ═══════════════════════════════════════════════════
   OTP24 Premium Store — Design System CSS
   Based on Claude Design handoff (Sarabun + Ant Blue)
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700;800&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
input, button, textarea, select { font-family: inherit; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ── Design Tokens ── */
:root {
  /* Primary */
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --primary-light: #e6f4ff;
  --primary-shadow: rgba(22,119,255,.3);

  /* Navy (sidebar) */
  --navy: #1a2456;
  --navy-2: #152047;

  /* Backgrounds */
  --bg: #f5f7fa;
  --bg-auth: #eef2f8;
  --surface: #ffffff;

  /* Borders */
  --border: #f0f0f0;
  --border-2: #e8e8e8;
  --border-input: #dde3ee;

  /* Text */
  --text-1: #262626;
  --text-2: #595959;
  --text-3: #3d4a5c;
  --text-muted: #8c8c8c;
  --text-muted-2: #8c95a8;
  --text-icon: #b0bac8;
  --text-placeholder: #c0c8d8;

  /* Status */
  --success: #52c41a;
  --success-dark: #389e0d;
  --success-bg: #f6ffed;
  --error: #ff4d4f;
  --error-bg: #fff2f0;
  --warning: #d46b08;
  --warning-bg: #fff7e6;
  --star: #faad14;

  /* Social */
  --discord: #5865F2;
  --line: #06C755;
  --google: #4285F4;

  /* Radius */
  --r-card: 14px;
  --r-modal: 22px;
  --r-btn: 10px;
  --r-btn-lg: 12px;
  --r-input: 10px;
  --r-badge: 6px;
  --r-sidebar-item: 10px;

  /* Shadows */
  --shadow-card: 0 4px 28px rgba(0,0,0,.06);
  --shadow-auth: 0 4px 32px rgba(22,60,120,.08);
  --shadow-btn: 0 6px 20px rgba(22,119,255,.32);
  --shadow-btn-hover: 0 8px 22px rgba(22,119,255,.3);

  /* Sidebar */
  --sidebar-w: 240px;
}

/* ── Typography ── */
body {
  font-family: 'Sarabun', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
}

/* ── Layout: Sidebar + Main ── */
.otp-layout {
  display: flex;
  min-height: 100vh;
}

.otp-sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}

.otp-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Sidebar Logo ── */
.otp-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
}

.otp-sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px var(--primary-shadow);
  flex-shrink: 0;
}

.otp-sidebar-logo-icon i {
  font-size: 18px;
  color: #fff;
}

.otp-sidebar-logo-text {
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  letter-spacing: -.4px;
  line-height: 1;
}

.otp-sidebar-logo-text span { color: var(--primary); }

.otp-sidebar-logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,.45);
  font-weight: 500;
  letter-spacing: .7px;
  text-transform: uppercase;
}

/* ── Sidebar Section Headers ── */
.otp-sidebar-section {
  color: rgba(255,255,255,.28);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 20px 20px 8px;
}

/* ── Sidebar Nav Items ── */
.otp-sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0 10px;
}

.otp-sidebar-nav li { margin-bottom: 2px; }

.otp-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-sidebar-item);
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s;
}

.otp-sidebar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
}

.otp-sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.otp-sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: .8;
}

.otp-sidebar-nav a.active i { opacity: 1; }

/* ── Sidebar Wallet ── */
.otp-sidebar-wallet {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.otp-sidebar-wallet-card {
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 14px;
}

.otp-sidebar-wallet-label {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  font-weight: 600;
  margin-bottom: 4px;
}

.otp-sidebar-wallet-amount {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.otp-sidebar-wallet-amount small {
  font-size: 12px;
  color: rgba(255,255,255,.45);
  font-weight: 500;
}

.otp-sidebar-wallet-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
}

.otp-sidebar-wallet-btn:hover { background: var(--primary-dark); }

/* ── Sidebar User ── */
.otp-sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.otp-sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.otp-sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.otp-sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,.4);
}

/* ── Top Header Bar ── */
.otp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.otp-header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
}

.otp-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Content Area ── */
.otp-content {
  padding: 24px 28px;
}

/* ── Cards ── */
.otp-card {
  background: var(--surface);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* ── Product Cards ── */
.otp-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.otp-product-card {
  background: var(--surface);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all .2s;
}

.otp-product-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  transform: translateY(-2px);
}

.otp-product-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.otp-product-card-body {
  padding: 14px;
}

.otp-product-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}

.otp-product-card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.otp-product-card-stock {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Buttons ── */
.otp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
}

.otp-btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.otp-btn-primary:hover { background: var(--primary-dark); }

.otp-btn-ghost {
  background: #fff;
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.otp-btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.otp-btn-lg {
  padding: 13px 24px;
  border-radius: var(--r-btn-lg);
  font-size: 15px;
}

.otp-btn-block { width: 100%; }

.otp-btn-sm {
  padding: 6px 14px;
  font-size: 12.5px;
  border-radius: 8px;
}

/* ── Inputs ── */
.otp-input-group { margin-bottom: 14px; }

.otp-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 7px;
}

.otp-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-input);
  padding: 11px 14px;
  transition: border-color .15s;
}

.otp-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,.08);
}

.otp-input-wrap i {
  font-size: 13px;
  color: var(--text-icon);
}

.otp-input-wrap input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--navy);
  min-width: 0;
}

.otp-input-wrap input::placeholder { color: var(--text-placeholder); }

/* ── Status Badges ── */
.otp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-badge);
  font-size: 12px;
  font-weight: 600;
}

.otp-badge-success { background: var(--success-bg); color: var(--success-dark); }
.otp-badge-warning { background: var(--warning-bg); color: var(--warning); }
.otp-badge-error   { background: var(--error-bg);   color: var(--error); }
.otp-badge-info    { background: var(--primary-light); color: var(--primary); }

/* ── Data Tables (div-based grid) ── */
.otp-table-header {
  display: grid;
  padding: 10px 22px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  gap: 8px;
}

.otp-table-row {
  display: grid;
  padding: 12px 22px;
  border-bottom: 1px solid #f5f7fa;
  font-size: 13.5px;
  align-items: center;
  gap: 8px;
  transition: background .1s;
}

.otp-table-row:hover { background: #fafbfc; }

/* ── Stats Cards (admin dashboard) ── */
.otp-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.otp-stat-card {
  background: var(--surface);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  padding: 20px;
}

.otp-stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.otp-stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-1);
}

.otp-stat-card-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

/* ── Auth Page ── */
.otp-auth-page {
  min-height: 100vh;
  background: var(--bg-auth);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.otp-auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--r-modal);
  padding: 36px;
  box-shadow: var(--shadow-auth);
}

.otp-auth-tabs {
  display: flex;
  background: #f0f3f8;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 30px;
  gap: 4px;
}

.otp-auth-tab {
  flex: 1;
  border: none;
  font-family: inherit;
  padding: 10px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  background: transparent;
  color: var(--text-muted-2);
}

.otp-auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 6px rgba(0,0,0,.09);
}

.otp-auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.otp-auth-subtitle {
  font-size: 13.5px;
  color: var(--text-muted-2);
  margin-bottom: 24px;
}

.otp-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
}

.otp-auth-divider::before,
.otp-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #edf0f6;
}

.otp-auth-divider span {
  font-size: 12.5px;
  color: var(--text-icon);
  white-space: nowrap;
  font-weight: 500;
}

.otp-auth-social {
  display: flex;
  gap: 10px;
}

.otp-auth-social button {
  flex: 1;
  border: 1.5px solid var(--border-input);
  font-family: inherit;
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: var(--r-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: border-color .15s, background .15s;
}

.otp-auth-social button:hover {
  border-color: var(--primary);
  background: #fafbff;
}

/* ── Payment Cards ── */
.otp-payment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.otp-payment-card {
  background: var(--surface);
  border-radius: var(--r-card);
  border: 2px solid var(--border);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
}

.otp-payment-card:hover,
.otp-payment-card.active {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(22,119,255,.12);
}

.otp-payment-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  font-size: 22px;
  color: #fff;
}

/* ── Order History Cards ── */
.otp-order-card {
  background: var(--surface);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow .15s;
  cursor: pointer;
}

.otp-order-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .otp-sidebar {
    transform: translateX(-100%);
  }

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

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

  .otp-content {
    padding: 16px;
  }

  .otp-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .otp-auth-card {
    padding: 28px 24px;
  }

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

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

  .otp-stats-grid {
    grid-template-columns: 1fr;
  }

  .otp-auth-social {
    flex-direction: column;
  }
}

/* ── Sidebar overlay for mobile ── */
.otp-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

.otp-sidebar-overlay.show { display: block; }

/* ── Mobile header (shown when sidebar hidden) ── */
.otp-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

@media (max-width: 768px) {
  .otp-mobile-header { display: flex; }
}

.otp-mobile-header-menu {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: 18px;
  color: var(--text-1);
  cursor: pointer;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.otp-mobile-header-menu:hover { background: var(--bg); }

/* ── Utilities ── */
.text-primary { color: var(--primary) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-success  { color: var(--success-dark) !important; }
.text-error    { color: var(--error) !important; }
.text-warning  { color: var(--warning) !important; }
.bg-primary    { background: var(--primary) !important; }
.bg-primary-light { background: var(--primary-light) !important; }

/* ── Scrollbar ── */
.otp-sidebar::-webkit-scrollbar { width: 4px; }
.otp-sidebar::-webkit-scrollbar-track { background: transparent; }
.otp-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* ── Transition helpers ── */
.otp-fade-in { animation: otpFadeIn .3s ease; }

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