/* ==========================================
   ReyPub Client Frontend - Shared CSS Styles
   ========================================== */

:root {
  --primary: #6C63FF;
  --primary-dark: #5A52D5;
  --primary-light: #8B85FF;
  --secondary: #2D3748;
  --success: #48BB78;
  --danger: #F56565;
  --warning: #ECC94B;
  --info: #4299E1;
  --bg: #F7FAFC;
  --card: #FFFFFF;
  --text: #2D3748;
  --text-light: #718096;
  --border: #E2E8F0;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Layout ── */
.app-container { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar { width: 260px; background: linear-gradient(180deg, #1A202C 0%, #2D3748 100%); color: white; padding: 24px 16px; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; transition: transform 0.3s; z-index: 100; display: flex; flex-direction: column; }
.main-content { flex: 1; margin-left: 260px; padding: 24px; min-height: 100vh; max-width: 100%; overflow-x: hidden; }

.sidebar .logo { font-size: 1.5rem; font-weight: 800; color: var(--primary-light); margin-bottom: 32px; text-align: center; letter-spacing: -0.5px; }
.sidebar .logo span { color: white; }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 8px;
  color: #A0AEC0; cursor: pointer; transition: all 0.2s; margin-bottom: 4px; font-size: 0.9rem; text-decoration: none;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.1); color: white; }
.nav-item i { width: 20px; text-align: center; }
.nav-badge { background: var(--danger); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; margin-left: auto; }

/* ── Cards ── */
.card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 1.1rem; font-weight: 700; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 12px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.stat-card .stat-label { color: var(--text-light); font-size: 0.85rem; margin-top: 4px; }

.stat-purple .stat-icon { background: #E9D8FD; color: #6B46C1; }
.stat-green .stat-icon { background: #C6F6D5; color: #276749; }
.stat-blue .stat-icon { background: #BEE3F8; color: #2B6CB0; }
.stat-orange .stat-icon { background: #FEFCBF; color: #C05621; }
.stat-red .stat-icon { background: #FED7D7; color: #C53030; }

/* ── Buttons ── */
.btn {
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600;
  font-size: 0.9rem; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #38A169; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #E53E3E; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-input {
  width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px;
  font-size: 0.95rem; transition: border-color 0.2s; outline: none; background: white;
}
.form-input:focus { border-color: var(--primary); }
textarea.form-input { resize: vertical; min-height: 60px; font-family: inherit; }
.form-select { 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 d='M6 8L1 3h10z' fill='%23718096'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ── Tables ── */
.table-container { overflow-x: auto; }
.card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 600px; }
th { text-align: left; padding: 12px 16px; background: #F7FAFC; color: var(--text-light); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
tr:hover { background: #F7FAFC; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-success { background: #C6F6D5; color: #276749; }
.badge-danger { background: #FED7D7; color: #C53030; }
.badge-warning { background: #FEFCBF; color: #C05621; }
.badge-info { background: #BEE3F8; color: #2B6CB0; }
.badge-pending { background: #E9D8FD; color: #6B46C1; }

/* ── Debit Card Visual ── */
.debit-card {
  background: linear-gradient(135deg, #6C63FF 0%, #3B3486 100%);
  border-radius: 16px; padding: 28px; color: white; position: relative; overflow: hidden;
  max-width: 420px; min-height: 220px; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 20px 60px rgba(108, 99, 255, 0.4);
}
.debit-card::before { content: ''; position: absolute; top: -50%; right: -50%; width: 100%; height: 100%; background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%); }
.debit-card .card-brand { font-size: 1.4rem; font-weight: 800; letter-spacing: 1px; }
.debit-card .card-chip { width: 45px; height: 35px; background: linear-gradient(135deg, #FFD700, #FFA500); border-radius: 6px; margin: 16px 0; }
.debit-card .card-number { font-size: 1.3rem; letter-spacing: 3px; font-family: 'Courier New', monospace; margin: 8px 0; }
.debit-card .card-footer { display: flex; justify-content: space-between; align-items: flex-end; }
.debit-card .card-name { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
.debit-card .card-expiry { font-size: 0.85rem; }
.debit-card .card-expiry span { font-size: 0.65rem; display: block; opacity: 0.7; }
.card-frozen { filter: grayscale(1); opacity: 0.6; }

/* ── Premium Debit Card ── */
.premium-card-wrapper { position: relative; max-width: 420px; }
.premium-debit-card {
  position: relative; border-radius: 20px; overflow: hidden;
  aspect-ratio: 1.586; max-width: 420px; color: white;
  box-shadow: 0 20px 60px rgba(108, 99, 255, 0.35), 0 8px 20px rgba(0,0,0,0.15);
  transition: transform 0.3s, box-shadow 0.3s;
}
.premium-debit-card:hover { transform: translateY(-4px); box-shadow: 0 24px 70px rgba(108, 99, 255, 0.4), 0 12px 28px rgba(0,0,0,0.15); }
.premium-card-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #1a1a3e 0%, #2d2b6b 30%, #6C63FF 70%, #764ba2 100%);
}
.premium-card-bg::before {
  content: ''; position: absolute; top: -30%; right: -20%; width: 60%; height: 80%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%); border-radius: 50%;
}
.premium-card-bg::after {
  content: ''; position: absolute; bottom: -40%; left: -20%; width: 70%; height: 80%;
  background: radial-gradient(circle, rgba(108,99,255,0.2) 0%, transparent 70%); border-radius: 50%;
}
.premium-card-content { position: relative; z-index: 1; padding: 24px 28px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.premium-card-top { display: flex; justify-content: space-between; align-items: center; }
.premium-card-brand { font-size: 1.5rem; font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.premium-card-type { opacity: 0.6; font-size: 1.2rem; }
.premium-card-chip {
  width: 48px; height: 36px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(135deg, #e8c547 0%, #d4a935 50%, #c49b29 100%);
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.chip-line { background: rgba(255,255,255,0.25); border-radius: 2px; }
.premium-card-number { display: flex; gap: 12px; font-size: 1.2rem; font-weight: 600; letter-spacing: 2px; font-family: 'Courier New', monospace; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.card-num-group { min-width: 56px; }
.premium-card-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.premium-card-holder, .premium-card-expiry { display: flex; flex-direction: column; gap: 2px; }
.premium-card-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.6; }
.premium-card-value { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.5px; }
.premium-card-network { opacity: 0.8; }
.premium-card-frozen { filter: grayscale(0.8) brightness(0.7); }
.premium-card-frozen::after {
  content: ''; position: absolute; inset: 0; z-index: 2;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 2px, transparent 2px, transparent 10px);
}
.card-reveal-btn {
  position: absolute; bottom: 12px; right: 12px; z-index: 5;
  background: rgba(255,255,255,0.2); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.3); color: white;
  padding: 6px 14px; border-radius: 20px; font-size: 0.78rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.card-reveal-btn:hover { background: rgba(255,255,255,0.35); }

/* ── PIN Setup Boxes ── */
.pin-boxes-container {
  display: flex; gap: 8px; justify-content: center; margin: 8px 0;
  max-width: 100%; padding: 0 4px; box-sizing: border-box;
}
.pin-box {
  width: 40px; height: 48px; text-align: center; font-size: 1.3rem; font-weight: 700;
  border: 2px solid #E2E8F0; border-radius: 10px; outline: none;
  transition: all 0.2s; background: #F7FAFC; color: #2D3748;
  flex-shrink: 0;
}
.pin-box:focus { border-color: #6C63FF; background: white; box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }
@media (max-width: 400px) {
  .pin-boxes-container { gap: 6px; }
  .pin-box { width: 36px; height: 44px; font-size: 1.1rem; border-radius: 8px; }
}

/* ── Expandable Transactions ── */
.expandable-txn {
  background: white; border-radius: 12px; margin-bottom: 8px;
  border: 1px solid #EDF2F7; cursor: pointer; transition: all 0.2s;
  overflow: hidden;
}
.expandable-txn:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(108,99,255,0.08); }
.expandable-txn-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
}
.expandable-txn-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 0.95rem; flex-shrink: 0;
}
.expandable-txn-info { flex: 1; min-width: 0; }
.expandable-txn-desc { font-weight: 600; font-size: 0.9rem; color: #2D3748; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expandable-txn-date { font-size: 0.78rem; color: #A0AEC0; margin-top: 2px; }
.expandable-txn-right { text-align: right; flex-shrink: 0; }
.expandable-txn-amount { font-weight: 800; font-size: 1rem; }
.expandable-txn-chevron {
  color: #CBD5E0; font-size: 0.8rem; transition: transform 0.3s; flex-shrink: 0; margin-left: 4px;
}
.expandable-txn.expanded .expandable-txn-chevron { transform: rotate(180deg); }
.expandable-txn-details {
  max-height: 0; overflow: hidden; transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 16px; background: #FAFBFC;
}
.expandable-txn.expanded .expandable-txn-details {
  max-height: 500px; padding: 12px 16px 16px; border-top: 1px solid #EDF2F7;
}
.expandable-txn-detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 0.85rem; border-bottom: 1px dashed #EDF2F7;
}
.expandable-txn-detail-row:last-child { border-bottom: none; }
.expandable-txn-detail-row span { color: #718096; }
.expandable-txn-detail-row strong { color: #2D3748; }

/* ── Payment Request Card ── */
.payment-request {
  border: 2px solid var(--primary); border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  position: relative; background: white;
}
.payment-request .pr-amount { font-size: 2rem; font-weight: 800; color: var(--primary); }
.payment-request .pr-merchant { font-size: 1.1rem; color: var(--text); font-weight: 600; }
.payment-request .pr-timer { color: var(--danger); font-weight: 600; }
.payment-request .pr-actions { display: flex; gap: 12px; margin-top: 16px; }

/* ── Auth Pages ── */
.auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.auth-card { background: #FFFFFF; border-radius: 20px; padding: 32px; max-width: 440px; width: 100%; box-shadow: var(--shadow-lg); color: #2D3748; overflow: hidden; box-sizing: border-box; }
.auth-card .logo { text-align: center; font-size: 2rem; font-weight: 800; color: #6C63FF; margin-bottom: 8px; }
.auth-card .subtitle { text-align: center; color: #718096; margin-bottom: 32px; }
.auth-card .form-label { color: #2D3748; }
.auth-card .form-input { background: #FFFFFF; color: #2D3748; border: 2px solid #E2E8F0; }
.auth-card .form-input:focus { border-color: #6C63FF; }
.auth-card .form-input::placeholder { color: #A0AEC0; }
.auth-card .auth-toggle { text-align: center; margin-top: 16px; color: #718096; font-size: 0.95rem; }
.auth-card .auth-toggle a { color: #6C63FF; font-weight: 600; text-decoration: none; }
.auth-card .auth-toggle a:hover { color: #5A52D5; text-decoration: underline; }
.auth-card .btn-primary { background: #6C63FF; color: #FFFFFF; }
.auth-card .btn-primary:hover { background: #5A52D5; }

/* ── Modals ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: white; border-radius: var(--radius); padding: 32px; max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }

/* ── Toast Notifications ── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; }
.toast { padding: 14px 20px; border-radius: 8px; color: white; margin-bottom: 8px; font-weight: 500; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; min-width: 300px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Loading ── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; z-index: 999; }
.loading-spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; color: var(--text-light); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── QR Code ── */
.qr-container { text-align: center; padding: 20px; }
.qr-code { display: inline-block; padding: 16px; background: white; border-radius: 12px; box-shadow: var(--shadow); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-light); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* ── Mobile Responsive ── */
.mobile-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 200; background: var(--primary); color: white; border: none; border-radius: 8px; padding: 10px 12px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* Mobile overlay when sidebar is open */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding-top: 64px; overflow-x: hidden; }
  .mobile-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .debit-card { max-width: 100%; }
  .payment-request .pr-actions { flex-direction: column; }
  .top-bar { flex-direction: column; gap: 12px; align-items: flex-start; }
  .top-bar h1 { font-size: 1.3rem; }
  table { font-size: 0.8rem; min-width: 580px; }
  th, td { padding: 8px 10px; }
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px; padding-top: 64px; }
  .stat-card .stat-value { font-size: 1.4rem; }
}

/* ── Page Transitions ── */
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Deposit/Withdrawal Flow ── */
.deposit-countdown-circle { position: relative; display: inline-block; }
.gateway-card { background: white; border-radius: 12px; padding: 20px; margin-bottom: 12px; border: 2px solid var(--border); cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 16px; }
.gateway-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(108,99,255,0.1); transform: translateY(-2px); }
.gateway-card .gw-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.gateway-card .gw-icon-deposit { background: #E9D8FD; color: #6B46C1; }
.gateway-card .gw-icon-withdraw { background: #FED7D7; color: #C53030; }
.gateway-card .gw-info { flex: 1; }
.gateway-card .gw-name { font-weight: 700; font-size: 1rem; }
.gateway-card .gw-detail { font-size: 0.82rem; color: var(--text-light); margin-top: 2px; }
.gateway-card .gw-arrow { color: var(--text-light); font-size: 1.1rem; }

/* ── Notification Bell ── */
.notif-bell { position: relative; cursor: pointer; font-size: 1.2rem; color: var(--text-light); }
.notif-bell .notif-count { position: absolute; top: -8px; right: -8px; background: var(--danger); color: white; font-size: 0.65rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* ── Top Bar ── */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.top-bar h1 { font-size: 1.5rem; font-weight: 700; }
.top-bar .user-info { display: flex; align-items: center; gap: 16px; }

/* ══════════════════════════════════════════
   P2P Trading - Premium Styles 
   ══════════════════════════════════════════ */

/* Bottom Navigation */
.p2p-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid #E2E8F0;
  display: flex; justify-content: space-around; padding: 8px 0 12px;
  z-index: 50;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
/* Add padding-bottom to P2P page so content isn't hidden behind fixed nav */
#page-p2p { padding-bottom: 80px; }
.p2p-bottom-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 8px 16px;
  color: #A0AEC0; font-size: 0.7rem; font-weight: 600; transition: all 0.2s;
  border-radius: 8px;
}
.p2p-bottom-nav-btn i { font-size: 1.2rem; }
.p2p-bottom-nav-btn.p2p-nav-active { color: var(--primary); }
.p2p-bottom-nav-btn.p2p-nav-active i { transform: scale(1.1); }

/* Filter Bar */
.p2p-filter-bar {
  background: white; border-radius: 12px; padding: 16px;
  margin-bottom: 16px; box-shadow: var(--shadow);
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.p2p-filter-toggle {
  display: flex; gap: 0; background: #EDF2F7; border-radius: 10px; padding: 3px; overflow: hidden;
}
.p2p-filter-btn {
  padding: 8px 20px; border: none; cursor: pointer; font-weight: 700;
  font-size: 0.85rem; border-radius: 8px; transition: all 0.2s;
  background: transparent; color: #718096;
}
.p2p-filter-active-buy { background: #48BB78 !important; color: white !important; }
.p2p-filter-active-sell { background: #F56565 !important; color: white !important; }
.p2p-filter-controls { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.p2p-select { width: auto !important; min-width: 100px; font-size: 0.85rem !important; padding: 8px 12px !important; }

/* Ad Cards */
.p2p-ad-card {
  background: white; border-radius: 12px; padding: 20px;
  margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid #EDF2F7; transition: all 0.2s;
}
.p2p-ad-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(108,99,255,0.08); }
.p2p-ad-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.p2p-ad-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
.p2p-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #6C63FF, #764ba2); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; position: relative; flex-shrink: 0;
}
.p2p-avatar.p2p-online::after {
  content: ''; position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #48BB78; border: 2px solid white;
}
.p2p-ad-username { font-weight: 700; font-size: 0.95rem; }
.p2p-ad-stats { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: #A0AEC0; }
.p2p-dot { width: 3px; height: 3px; border-radius: 50%; background: #CBD5E0; }
.p2p-ad-price-block { text-align: right; min-width: 160px; }
.p2p-ad-price { font-size: 1.3rem; font-weight: 800; }
.p2p-price-buy { color: #48BB78; }
.p2p-price-sell { color: #F56565; }
.p2p-price-curr { font-size: 0.8rem; font-weight: 600; opacity: 0.7; }
.p2p-ad-avail { font-size: 0.8rem; color: #718096; margin-top: 2px; }
.p2p-ad-limit { font-size: 0.75rem; color: #A0AEC0; }
.p2p-ad-bottom {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid #F7FAFC;
}
.p2p-ad-methods { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.p2p-method-tag {
  padding: 3px 10px; border-radius: 6px; font-size: 0.72rem;
  font-weight: 600; background: #F0F0FF; color: #6C63FF;
}
.p2p-trade-btn {
  padding: 10px 24px; border: none; border-radius: 10px; cursor: pointer;
  font-weight: 700; font-size: 0.85rem; display: inline-flex; align-items: center;
  gap: 6px; transition: all 0.2s;
}
.p2p-trade-buy { background: #48BB78; color: white; }
.p2p-trade-buy:hover { background: #38A169; }
.p2p-trade-sell { background: #F56565; color: white; }
.p2p-trade-sell:hover { background: #E53E3E; }
.p2p-ad-terms {
  margin-top: 10px; padding: 8px 12px; background: #FFFAF0;
  border-radius: 8px; font-size: 0.8rem; color: #C05621;
  border: 1px solid #FEEBC8;
}

/* Empty States */
.p2p-empty {
  text-align: center; padding: 40px 20px; color: #A0AEC0;
}
.p2p-empty i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.3; display: block; }
.p2p-empty h3 { color: #4A5568; margin-bottom: 6px; font-size: 1.1rem; }
.p2p-empty p { font-size: 0.9rem; }

/* Adv Sub-tabs */
.adv-tab-row { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid #EDF2F7; }
.adv-tab-btn {
  padding: 12px 20px; border: none; cursor: pointer;
  background: none; color: #A0AEC0; font-weight: 600;
  font-size: 0.85rem; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.adv-tab-btn:hover { color: var(--primary); }
.adv-tab-btn.adv-tab-active { color: var(--primary); border-bottom-color: var(--primary); }

/* Ad type badges */
.p2p-type-badge {
  padding: 4px 10px; border-radius: 6px; font-size: 0.72rem;
  font-weight: 700; text-transform: uppercase;
}
.p2p-badge-buy { background: #C6F6D5; color: #276749; }
.p2p-badge-sell { background: #FED7D7; color: #C53030; }
.p2p-status-pill {
  padding: 4px 12px; border-radius: 20px; font-size: 0.72rem;
  font-weight: 700;
}
.p2p-status-active { background: #C6F6D5; color: #276749; }
.p2p-status-paused { background: #FEFCBF; color: #C05621; }

/* Order Cards */
.p2p-order-card {
  background: white; border-radius: 12px; padding: 16px;
  margin-bottom: 10px; border: 1px solid #EDF2F7;
  cursor: pointer; transition: all 0.2s;
}
.p2p-order-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(108,99,255,0.1); }
.p2p-order-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.p2p-order-number { font-weight: 700; font-size: 0.85rem; color: #4A5568; }
.p2p-order-party { font-size: 0.8rem; color: #718096; margin-top: 2px; }
.p2p-order-amount { font-weight: 800; font-size: 1.1rem; color: #2D3748; }
.p2p-order-fiat { font-size: 0.8rem; color: #718096; }
.p2p-order-bottom {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #F7FAFC;
}
.p2p-order-status {
  padding: 4px 12px; border-radius: 20px; font-size: 0.72rem;
  font-weight: 700; display: inline-flex; align-items: center; gap: 4px;
}
.p2p-order-time { font-size: 0.72rem; color: #A0AEC0; }

/* Order Detail */
.p2p-order-detail-header { }
.p2p-order-detail-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.p2p-order-detail-amount { font-size: 1.5rem; font-weight: 800; color: #2D3748; }
.p2p-order-detail-rate { font-size: 0.85rem; color: #A0AEC0; }
.p2p-order-detail-fiat { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-top: 2px; }
.p2p-order-detail-meta {
  display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid #EDF2F7;
  font-size: 0.85rem; color: #718096;
}
.p2p-order-terms {
  margin-top: 10px; padding: 8px 12px; background: #FFF5F5;
  border-radius: 8px; font-size: 0.8rem; color: #C53030;
}
.p2p-countdown {
  margin-top: 8px; font-size: 0.85rem; font-weight: 700;
  color: #C05621; display: flex; align-items: center; gap: 4px;
}

/* Action Buttons */
.p2p-action-btn {
  padding: 10px 20px; border: none; border-radius: 10px; cursor: pointer;
  font-weight: 700; font-size: 0.85rem; display: inline-flex;
  align-items: center; gap: 6px; transition: all 0.2s;
}
.p2p-action-primary { background: var(--primary); color: white; }
.p2p-action-primary:hover { background: var(--primary-dark); }
.p2p-action-cancel { background: #EDF2F7; color: #4A5568; }
.p2p-action-cancel:hover { background: #E2E8F0; }
.p2p-action-danger { background: #FED7D7; color: #C53030; }
.p2p-action-danger:hover { background: #FEB2B2; }
.p2p-action-info { font-size: 0.85rem; color: #C05621; font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* Chat */
.p2p-chat-system { text-align: center; margin: 8px 0; }
.p2p-chat-system span,
.p2p-chat-system { background: transparent; }
.p2p-chat-system { font-size: 0.75rem; color: #718096; padding: 4px 12px; background: #F0F0FF; border-radius: 20px; display: inline-block; }
.p2p-chat-admin { text-align: center; margin: 8px 0; font-size: 0.8rem; color: #C53030; padding: 6px 14px; background: #FED7D7; border-radius: 20px; display: inline-block; }
.p2p-chat-msg { display: flex; margin: 6px 0; }
.p2p-chat-me { justify-content: flex-end; }
.p2p-chat-them { justify-content: flex-start; }
.p2p-chat-bubble { max-width: 75%; padding: 10px 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.p2p-bubble-me { background: var(--primary); color: white; border-radius: 12px 12px 2px 12px; }
.p2p-bubble-them { background: white; color: #2D3748; border-radius: 12px 12px 12px 2px; border: 1px solid #EDF2F7; }
.p2p-chat-sender { font-size: 0.7rem; opacity: 0.7; margin-bottom: 2px; }
.p2p-chat-text { font-size: 0.9rem; word-break: break-word; }
.p2p-chat-img { max-width: 100%; border-radius: 8px; margin-top: 4px; cursor: pointer; }
.p2p-chat-time { font-size: 0.65rem; opacity: 0.5; margin-top: 2px; text-align: right; }

/* Premium Card */
.p2p-card-premium {
  background: white; border-radius: 16px; padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04); border: 1px solid #EDF2F7;
}
.p2p-card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* Stats Grid */
.p2p-stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.p2p-stat-item {
  text-align: center; padding: 12px;
  background: #F7FAFC; border-radius: 10px;
}
.p2p-stat-val { font-size: 1.2rem; font-weight: 800; color: #2D3748; }
.p2p-stat-lbl { font-size: 0.72rem; color: #A0AEC0; margin-top: 2px; }

/* Settings Method Card */
.p2p-settings-method-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; background: #F7FAFC; border-radius: 10px;
  margin-bottom: 8px; gap: 12px;
}
.p2p-method-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #6C63FF, #8B85FF); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.p2p-add-method-form {
  margin-top: 20px; padding-top: 20px; border-top: 1px solid #EDF2F7;
}

/* ── P2P "I Have Paid" Confirmation Panel ── */
.p2p-paid-panel {
  background: linear-gradient(135deg, #EBF8FF 0%, #F0FFF4 100%);
  border: 2px solid #90CDF4;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.p2p-paid-panel-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #2B6CB0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.p2p-payment-detail-card {
  background: white;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid #E2E8F0;
}
.p2p-payment-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed #EDF2F7;
}
.p2p-payment-detail-row:last-child { border-bottom: none; }
.p2p-payment-detail-label { color: #718096; font-weight: 500; }
.p2p-payment-detail-value { font-weight: 700; color: #2D3748; }
.p2p-paid-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #FFFAF0;
  border: 1px solid #FEFCBF;
  border-radius: 8px;
  margin: 12px 0;
  cursor: pointer;
}
.p2p-paid-checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; accent-color: var(--primary);
}
.p2p-paid-checkbox-label {
  font-size: 0.85rem; font-weight: 600; color: #975A16; line-height: 1.4;
}
.p2p-paid-btn-confirmed {
  background: linear-gradient(135deg, #48BB78, #38A169);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(72,187,120,0.3);
}
.p2p-paid-btn-confirmed:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(72,187,120,0.4); }
.p2p-paid-btn-confirmed:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── P2P Appeal Section (after paid) ── */
.p2p-appeal-section {
  background: linear-gradient(135deg, #FFF5F5 0%, #FFFAF0 100%);
  border: 1px solid #FED7D7;
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
}
.p2p-appeal-section-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #C53030;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.p2p-appeal-section-desc {
  font-size: 0.82rem;
  color: #975A16;
  line-height: 1.5;
  margin-bottom: 10px;
}
.p2p-appeal-btn-full {
  background: #E53E3E;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.p2p-appeal-btn-full:hover { background: #C53030; }

/* ── P2P Waiting Status Animation ── */
.p2p-waiting-pulse {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #EBF8FF;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  color: #2B6CB0;
}
.p2p-waiting-pulse .pulse-dot {
  width: 10px; height: 10px;
  background: #3182CE;
  border-radius: 50%;
  animation: p2p-pulse 1.5s infinite;
}
@keyframes p2p-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Payment method checkbox chips */
.p2p-pm-chip {
  display: flex; align-items: center; gap: 6px;
  background: #F7FAFC; padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 0.82rem; font-weight: 500;
  border: 2px solid transparent; transition: all 0.2s;
}
.p2p-pm-chip:has(input:checked) {
  background: #F0EFFF; border-color: var(--primary); color: var(--primary);
}
.p2p-pm-chip input { width: 14px; height: 14px; }

/* Balance hint */
.p2p-balance-hint {
  background: #EBF8FF; border: 1px solid #90CDF4;
  border-radius: 8px; padding: 10px 14px;
  font-size: 0.85rem; color: #2B6CB0; margin-bottom: 12px;
}

/* Trade Info Grid */
.p2p-trade-info-grid { display: grid; gap: 8px; }
.p2p-trade-info-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.p2p-trade-label { font-size: 0.85rem; color: #A0AEC0; }
.p2p-trade-value { font-size: 0.9rem; font-weight: 600; }

/* P2P Full Order Page */
.p2p-order-fullpage {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #F7FAFC;
  z-index: 200;
  overflow-y: auto;
  animation: slideInFromRight 0.3s ease;
}
@keyframes slideInFromRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.p2p-order-fullpage.active { display: block; }
.p2p-order-fullpage-header {
  position: sticky; top: 0; left: 0; right: 0;
  background: white; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid #E2E8F0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.p2p-order-fullpage-back {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: #4A5568; padding: 4px 8px;
  border-radius: 8px; transition: all 0.2s;
}
.p2p-order-fullpage-back:hover { background: #EDF2F7; }
.p2p-order-fullpage-title {
  font-weight: 700; font-size: 1rem; color: #2D3748; flex: 1;
}
.p2p-order-fullpage-body {
  padding: 16px; max-width: 700px; margin: 0 auto;
  padding-bottom: 100px;
}
/* Seller Payment Info Card */
.p2p-seller-payment-card {
  background: linear-gradient(135deg, #F0FFF4 0%, #EBF8FF 100%);
  border: 2px solid #9AE6B4;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.p2p-seller-payment-title {
  font-weight: 800; font-size: 0.95rem; color: #276749;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.p2p-seller-payment-item {
  background: white; border-radius: 8px; padding: 12px;
  margin-bottom: 8px; border: 1px solid #E2E8F0;
}
.p2p-seller-payment-item-title {
  font-weight: 700; font-size: 0.88rem; color: #2D3748;
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.p2p-seller-payment-detail {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 0.82rem;
}
.p2p-seller-payment-detail-label { color: #718096; }
.p2p-seller-payment-detail-value {
  font-weight: 600; color: #2D3748; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.p2p-seller-payment-detail-value:hover { color: var(--primary); }

/* Responsive P2P */
@media (max-width: 768px) {
  .p2p-filter-bar { flex-direction: column; }
  .p2p-filter-controls { width: 100%; }
  .p2p-ad-top { flex-direction: column; }
  .p2p-ad-price-block { text-align: left; }
  .p2p-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .p2p-order-detail-top { flex-direction: column; }
}
@media (max-width: 480px) {
  .p2p-stats-grid { grid-template-columns: 1fr 1fr; }
  .adv-tab-btn { padding: 10px 12px; font-size: 0.8rem; }
}

/* ═══════════════════════════════════════════════
   SUPPORT CHAT WIDGET - Client Side
   ═══════════════════════════════════════════════ */

/* Chat Bubble */
#support-chat-bubble {
  position: fixed; bottom: 24px; right: 24px; width: 64px; height: 64px;
  border-radius: 50%; background: linear-gradient(135deg, #6C63FF 0%, #5A52D5 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 8px 25px rgba(108,99,255,0.4); z-index: 9999;
  transition: all 0.3s; font-size: 1.4rem; border: none;
}
#support-chat-bubble:hover { transform: scale(1.1); box-shadow: 0 12px 35px rgba(108,99,255,0.5); }
#support-chat-bubble .sc-bubble-badge {
  position: absolute; top: -4px; right: -4px; width: 22px; height: 22px;
  background: #F56565; border-radius: 50%; font-size: 0.7rem; font-weight: 700;
  display: none; align-items: center; justify-content: center; border: 2px solid white;
}

/* Chat Widget Container */
#support-chat-widget {
  position: fixed; bottom: 24px; right: 24px; width: 400px; height: 600px;
  background: white; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  z-index: 10000; display: flex; flex-direction: column; overflow: hidden;
  transform: scale(0) translateY(20px); opacity: 0; transform-origin: bottom right;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#support-chat-widget.open { transform: scale(1) translateY(0); opacity: 1; }

/* Widget Header */
.sc-header {
  background: linear-gradient(135deg, #6C63FF 0%, #764ba2 100%);
  color: white; padding: 16px 20px; display: flex; align-items: center; gap: 12px;
  border-radius: 20px 20px 0 0; min-height: 64px;
}
.sc-header-icon {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  position: relative;
}
.sc-header-online {
  position: absolute; bottom: 1px; right: 1px; width: 10px; height: 10px;
  background: #48BB78; border-radius: 50%; border: 2px solid rgba(108,99,255,0.8);
}
.sc-header-text { flex: 1; }
.sc-header-text h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.sc-header-text p { font-size: 0.75rem; opacity: 0.85; margin: 2px 0 0; }
.sc-close-btn {
  background: rgba(255,255,255,0.15); border: none; color: white; width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: background 0.2s;
}
.sc-close-btn:hover { background: rgba(255,255,255,0.3); }

/* Widget Body */
#sc-body {
  flex: 1; overflow-y: auto; padding: 0; scroll-behavior: smooth;
}
#sc-body::-webkit-scrollbar { width: 5px; }
#sc-body::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 10px; }

/* Welcome Section */
.sc-welcome {
  display: flex; align-items: center; gap: 14px; padding: 20px 20px 12px;
}
.sc-welcome-avatar { position: relative; }
.sc-avatar-circle {
  width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, #6C63FF, #5A52D5);
  display: flex; align-items: center; justify-content: center; color: white; font-size: 1.3rem;
}
.sc-online-dot {
  position: absolute; bottom: 2px; right: 2px; width: 14px; height: 14px;
  background: #48BB78; border-radius: 50%; border: 3px solid white;
  animation: sc-pulse 2s infinite;
}
@keyframes sc-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}
.sc-welcome-text { display: flex; flex-direction: column; }
.sc-welcome-text strong { font-size: 1rem; color: #2D3748; }
.sc-reply-time {
  font-size: 0.78rem; color: #48BB78; display: flex; align-items: center; gap: 4px;
  background: #F0FFF4; padding: 3px 10px; border-radius: 12px; margin-top: 4px; width: fit-content;
  animation: sc-pulse 3s infinite;
}

/* Menu */
.sc-menu-label {
  font-size: 0.78rem; font-weight: 600; color: #718096; padding: 8px 20px 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sc-menu-grid { padding: 0 12px 8px; }
.sc-menu-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 4px 0;
  border-radius: 12px; cursor: pointer; transition: all 0.2s; border: 1px solid transparent;
}
.sc-menu-item:hover { background: #F7FAFC; border-color: #E2E8F0; }
.sc-menu-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 0.95rem; flex-shrink: 0;
}
.sc-menu-item span { flex: 1; font-weight: 600; font-size: 0.9rem; color: #2D3748; }
.sc-menu-arrow { color: #CBD5E0; font-size: 0.75rem; }
.sc-badge { background: #F56565; color: white; font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.sc-divider { height: 1px; background: #E2E8F0; margin: 8px 20px; }

/* Back Row */
.sc-back-row {
  display: flex; align-items: center; gap: 8px; padding: 12px 20px;
  font-size: 0.85rem; color: #6C63FF; cursor: pointer; font-weight: 600;
  border-bottom: 1px solid #EDF2F7;
}
.sc-back-row:hover { background: #F7FAFC; }

/* Section Title */
.sc-section-title {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px 8px;
  font-size: 1rem; font-weight: 700; color: #2D3748;
}

/* Submenu */
.sc-submenu-list { padding: 0 12px; }
.sc-submenu-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: 10px; cursor: pointer; transition: all 0.2s; margin: 2px 0;
}
.sc-submenu-item:hover { background: #F7FAFC; }
.sc-submenu-item i:first-child { width: 20px; text-align: center; }
.sc-submenu-item span { flex: 1; font-size: 0.9rem; font-weight: 500; color: #4A5568; }

/* Context Items */
.sc-context-list { padding: 0 16px; }
.sc-context-item {
  padding: 12px 16px; border: 1px solid #E2E8F0; border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.2s;
}
.sc-context-item:hover { border-color: #6C63FF; background: #F0EFFF; }
.sc-ctx-row { display: flex; justify-content: space-between; align-items: center; }
.sc-ctx-label { font-weight: 600; font-size: 0.9rem; color: #2D3748; }
.sc-ctx-detail { font-size: 0.78rem; color: #718096; margin-top: 4px; }

.sc-badge-warning { background: #FEFCBF; color: #975A16; }
.sc-badge-success { background: #C6F6D5; color: #276749; }
.sc-badge-danger { background: #FED7D7; color: #C53030; }
.sc-badge-info { background: #BEE3F8; color: #2B6CB0; }

/* Reason Box */
.sc-reason-box {
  margin: 12px 16px; padding: 14px 16px; border-radius: 12px; font-size: 0.85rem; line-height: 1.5;
}
.sc-reason-box i { margin-right: 6px; }
.sc-reason-box p { margin: 6px 0 0; }
.sc-reason-info { background: #EBF8FF; border: 1px solid #BEE3F8; color: #2B6CB0; }
.sc-reason-warning { background: #FFFAF0; border: 1px solid #FEFCBF; color: #975A16; }
.sc-reason-danger { background: #FFF5F5; border: 1px solid #FED7D7; color: #C53030; }

/* Selected Item */
.sc-selected-item {
  margin: 12px 16px; padding: 14px 16px; border-radius: 12px;
  background: #F7FAFC; border: 2px solid #6C63FF;
}

/* Action Buttons */
.sc-action-buttons { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.sc-btn {
  padding: 12px 20px; border-radius: 10px; border: none; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; transition: all 0.2s; display: flex;
  align-items: center; justify-content: center; gap: 8px;
}
.sc-btn-primary { background: #6C63FF; color: white; }
.sc-btn-primary:hover { background: #5A52D5; }
.sc-btn-success { background: #48BB78; color: white; }
.sc-btn-success:hover { background: #38A169; }
.sc-btn-outline { background: white; border: 2px solid #E2E8F0; color: #4A5568; }
.sc-btn-outline:hover { border-color: #6C63FF; color: #6C63FF; }
.sc-btn-full { width: 100%; }

/* Details Form */
.sc-details-note {
  margin: 12px 16px; padding: 12px 14px; border-radius: 10px;
  background: #EBF8FF; color: #2B6CB0; font-size: 0.82rem;
  display: flex; align-items: flex-start; gap: 8px; line-height: 1.5;
}
.sc-related-info {
  margin: 0 16px 12px; padding: 10px 14px; border-radius: 10px;
  background: #F0EFFF; color: #5A52D5; font-size: 0.82rem;
  display: flex; align-items: center; gap: 8px; font-weight: 500;
}
.sc-form-area { padding: 0 16px 16px; }
.sc-textarea {
  width: 100%; padding: 12px; border: 2px solid #E2E8F0; border-radius: 10px;
  font-family: 'Inter', sans-serif; font-size: 0.9rem; resize: vertical;
  min-height: 80px; outline: none; transition: border-color 0.2s;
}
.sc-textarea:focus { border-color: #6C63FF; }
.sc-attachment-area {
  display: flex; align-items: center; gap: 10px; margin: 10px 0;
}
.sc-attach-btn {
  display: flex; align-items: center; gap: 6px; font-size: 0.82rem;
  color: #6C63FF; cursor: pointer; font-weight: 600; padding: 6px 12px;
  border-radius: 8px; border: 1px dashed #6C63FF; transition: all 0.2s;
}
.sc-attach-btn:hover { background: #F0EFFF; }
.sc-file-name { font-size: 0.78rem; color: #48BB78; font-weight: 500; }

/* Loading & Empty States */
.sc-loading {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 40px; color: #718096;
}
.sc-spinner {
  width: 32px; height: 32px; border: 3px solid #E2E8F0; border-top-color: #6C63FF;
  border-radius: 50%; animation: sc-spin 0.8s linear infinite;
}
@keyframes sc-spin { to { transform: rotate(360deg); } }
.sc-empty-state { text-align: center; padding: 40px 20px; color: #718096; }
.sc-empty-state i { font-size: 2.5rem; margin-bottom: 12px; color: #CBD5E0; display: block; }
.sc-empty-state p { margin-bottom: 16px; }

/* Connecting Animation */
.sc-connecting {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 20px; text-align: center; min-height: 350px;
}
.sc-connecting-animation { position: relative; width: 120px; height: 120px; margin-bottom: 24px; }
.sc-pulse-ring {
  position: absolute; top: 0; left: 0; width: 120px; height: 120px;
  border-radius: 50%; border: 3px solid #6C63FF; opacity: 0;
  animation: sc-ripple 2s cubic-bezier(0.21, 0.61, 0.35, 1) infinite;
}
.sc-pulse-ring-2 { animation-delay: 0.5s; }
.sc-pulse-ring-3 { animation-delay: 1s; }
@keyframes sc-ripple {
  0% { transform: scale(0.5); opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 0; }
}
.sc-connecting-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #6C63FF, #5A52D5);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.5rem;
}
.sc-connecting h3 { margin: 0 0 8px; color: #2D3748; }
.sc-connecting p { color: #718096; margin: 0 0 16px; font-size: 0.9rem; }
.sc-reply-time-box {
  display: flex; align-items: center; gap: 10px; background: #F0FFF4;
  padding: 10px 18px; border-radius: 12px; font-size: 0.82rem; color: #276749;
}
.sc-reply-spinner {
  width: 18px; height: 18px; border: 2px solid #C6F6D5; border-top-color: #48BB78;
  border-radius: 50%; animation: sc-spin 0.8s linear infinite;
}

/* Chat Messages */
.sc-messages {
  flex: 1; overflow-y: auto; padding: 16px; min-height: 250px;
}
.sc-chat-header {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid #EDF2F7; background: #F7FAFC;
}
.sc-chat-header-info { flex: 1; }
.sc-chat-header-info strong { display: block; font-size: 0.85rem; color: #2D3748; }
.sc-ticket-num { font-family: monospace; font-size: 0.72rem; color: #A0AEC0; }

.sc-msg { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
.sc-msg-user { flex-direction: row-reverse; }
.sc-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6C63FF, #5A52D5);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.7rem; flex-shrink: 0;
}
.sc-msg-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 0.88rem; line-height: 1.4;
}
.sc-msg-bubble-user {
  background: #6C63FF; color: white;
  border-bottom-right-radius: 4px;
}
.sc-msg-bubble-admin {
  background: #F7FAFC; color: #2D3748; border: 1px solid #E2E8F0;
  border-bottom-left-radius: 4px;
}
.sc-msg-sender { font-size: 0.72rem; font-weight: 600; color: #6C63FF; margin-bottom: 2px; }
.sc-msg-text { word-wrap: break-word; }
.sc-msg-time { font-size: 0.65rem; opacity: 0.6; margin-top: 4px; text-align: right; }
.sc-msg-attachment { margin-top: 6px; }
.sc-msg-attachment a { color: #6C63FF; font-size: 0.8rem; text-decoration: none; }
.sc-msg-attachment a:hover { text-decoration: underline; }
.sc-system-msg {
  text-align: center; font-size: 0.78rem; color: #718096; padding: 8px 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* Input Area */
#sc-input-area {
  display: none; padding: 12px 16px; border-top: 1px solid #EDF2F7;
  gap: 8px; align-items: center; background: white;
  border-radius: 0 0 20px 20px;
}
#sc-message-input {
  flex: 1; padding: 10px 14px; border: 2px solid #E2E8F0; border-radius: 24px;
  font-size: 0.88rem; outline: none; transition: border-color 0.2s;
  font-family: 'Inter', sans-serif;
}
#sc-message-input:focus { border-color: #6C63FF; }
.sc-send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: #6C63FF; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; font-size: 0.9rem;
}
.sc-send-btn:hover { background: #5A52D5; transform: scale(1.05); }

/* Ticket List */
.sc-ticket-list { padding: 0 12px; }
.sc-ticket-item {
  padding: 14px 16px; border: 1px solid #E2E8F0; border-radius: 12px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.2s; position: relative;
}
.sc-ticket-item:hover { border-color: #6C63FF; background: #FAFAFE; }
.sc-unread-dot {
  position: absolute; top: 10px; right: 10px; width: 10px; height: 10px;
  background: #F56565; border-radius: 50%;
}

/* Mobile responsive */
@media (max-width: 480px) {
  #support-chat-widget { width: 100%; height: 100%; bottom: 0; right: 0; border-radius: 0; }
  .sc-header { border-radius: 0; }
  #sc-input-area { border-radius: 0; }
}

/* ═══════════════════════════════════════════════
   ADMIN SUPPORT PANEL STYLES
   ═══════════════════════════════════════════════ */

.sp-row-unread { background: #FFFAF0 !important; }
.sp-unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #F56565; color: white; font-size: 0.65rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%; margin-left: 4px;
}

/* Admin Chat Modal */
#sp-chat-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 2000; display: none;
  align-items: center; justify-content: center; padding: 20px;
}
.sp-chat-container {
  background: white; border-radius: 16px; width: 100%; max-width: 800px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2); overflow: hidden;
}
.sp-chat-top {
  padding: 16px 20px; border-bottom: 1px solid #E2E8F0;
  display: flex; align-items: flex-start; gap: 16px;
}
.sp-chat-top-left { flex: 1; }
.sp-chat-top-left h3 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.sp-chat-top-left h3 span { font-family: monospace; font-size: 0.78rem; color: #A0AEC0; font-weight: 400; }
.sp-chat-user-info { font-size: 0.78rem; color: #718096; margin-top: 6px; line-height: 1.6; }
.sp-meta-row {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px;
  font-size: 0.78rem; color: #4A5568;
}
.sp-meta-row span {
  display: flex; align-items: center; gap: 4px; background: #F7FAFC;
  padding: 3px 10px; border-radius: 6px; font-weight: 500;
}
.sp-chat-top-right { display: flex; gap: 8px; align-items: center; }
.sp-chat-close {
  background: none; border: none; font-size: 1.2rem; color: #A0AEC0;
  cursor: pointer; padding: 4px 8px;
}
.sp-chat-close:hover { color: #F56565; }

/* Admin Chat Messages */
#sp-chat-body {
  flex: 1; overflow-y: auto; padding: 16px 20px; min-height: 300px; max-height: 50vh;
}
.sp-msg { display: flex; gap: 12px; margin-bottom: 16px; }
.sp-msg-user { }
.sp-msg-admin { }
.sp-msg-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0;
}
.sp-msg-content { flex: 1; }
.sp-msg-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.sp-msg-header strong { font-size: 0.85rem; color: #2D3748; }
.sp-msg-time { font-size: 0.72rem; color: #A0AEC0; }
.sp-msg-text {
  font-size: 0.9rem; color: #4A5568; line-height: 1.5;
  background: #F7FAFC; padding: 10px 14px; border-radius: 12px;
  border: 1px solid #EDF2F7;
}
.sp-msg-admin .sp-msg-text { background: #F0EFFF; border-color: #D6BCFA; }
.sp-msg-attach { margin-top: 6px; }
.sp-msg-attach a { color: #6C63FF; font-size: 0.82rem; text-decoration: none; }
.sp-sys-msg {
  text-align: center; padding: 8px; font-size: 0.78rem; color: #718096;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* Admin Chat Input */
#sp-chat-input-area {
  display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid #E2E8F0;
  align-items: center;
}
#sp-admin-msg-input {
  flex: 1; padding: 10px 16px; border: 2px solid #E2E8F0; border-radius: 10px;
  font-size: 0.9rem; outline: none; font-family: 'Inter', sans-serif;
}
#sp-admin-msg-input:focus { border-color: #6C63FF; }
