/* ==========================================
   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; }
.sidebar { width: 260px; background: var(--secondary); 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; }

.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(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.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; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
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); }
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; }

/* ── 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: 40px; max-width: 440px; width: 100%; box-shadow: var(--shadow-lg); color: #2D3748; }
.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; }
  .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; }
  th, td { padding: 8px 10px; }
}

@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); } }

/* ── 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: sticky; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid #E2E8F0;
  display: flex; justify-content: space-around; padding: 8px 0 12px;
  margin: 24px -24px -24px; z-index: 50;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
.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; }

/* Responsive P2P */
@media (max-width: 768px) {
  .p2p-bottom-nav { margin: 24px -16px -16px; }
  .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; }
}
