/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Malgun Gothic', '맑은 고딕', sans-serif; background: #f5f6fa; color: #222; font-size: 13px; }
a { color: #4a90d9; text-decoration: none; }
ul { list-style: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ===== HEADER ===== */
.header { background: #fff; border-bottom: 1px solid #e0e0e0; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-img {
  width: 38px; height: 38px; object-fit: contain;
}
.logo-icon {
  width: 36px; height: 36px; background: #26a17b; color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 18px;
}
.usdt-icon-sm {
  width: 16px; height: 16px; vertical-align: middle; margin-right: 2px;
}
.logo-title { font-weight: bold; font-size: 15px; }
.logo-sub { font-size: 10px; color: #888; }
.header-right { display: flex; align-items: center; gap: 8px; }
.lang-select { border: 1px solid #ccc; border-radius: 4px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.btn-icon { background: none; border: 1px solid #ccc; border-radius: 4px; padding: 4px 8px; cursor: pointer; color: #555; }

/* ===== HERO ===== */
.hero { background: linear-gradient(135deg, #1a2e4a 0%, #0d1f35 100%); color: #fff; padding: 40px 0 30px; }
.hero .container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.hero-title { font-size: 24px; font-weight: bold; margin-bottom: 14px; line-height: 1.4; }
.hero-title span { color: #26a17b; }
.hero-desc { font-size: 13px; color: #b0c4de; line-height: 1.7; margin-bottom: 20px; }

.info-box { background: rgba(38,161,123,0.15); border-left: 4px solid #26a17b; border-radius: 6px; padding: 14px 18px; margin-bottom: 20px; }
.info-box-title { font-weight: bold; color: #26a17b; margin-bottom: 6px; font-size: 13px; }
.info-box p { font-size: 12px; color: #c5d8e8; line-height: 1.7; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card-dark { background: rgba(255,255,255,0.07); border-radius: 8px; padding: 18px; }
.card-dark h3 { font-size: 14px; color: #7ecfb3; margin-bottom: 10px; }
.card-dark p, .card-dark li { font-size: 12px; color: #b0c4de; line-height: 1.7; }
.card-dark li::before { content: "• "; color: #26a17b; }
.card-dark ul { padding-left: 4px; }

/* ===== ACTION BUTTONS ===== */
.action-btns { display: flex; gap: 12px; justify-content: flex-end; padding: 16px; }
.btn { padding: 9px 20px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; font-weight: bold; transition: opacity .2s; }
.btn:hover { opacity: .85; }
.btn-orange { background: #f5a623; color: #fff; }
.btn-green { background: #26a17b; color: #fff; }
.btn-blue { background: #4a90d9; color: #fff; }
.btn-red { background: #e74c3c; color: #fff; }
.btn-outline { background: #fff; border: 1px solid #ccc; color: #333; }
.btn-sm { font-size: 11px; padding: 5px 12px; }

/* ===== ORDERS SECTION ===== */
.orders-section { padding: 20px 0 40px; }
.section-title { font-size: 16px; font-weight: bold; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.orders-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.date-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range input[type="date"] { border: 1px solid #ccc; border-radius: 4px; padding: 4px 8px; font-size: 12px; }
.date-range label { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.orders-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: #555; }
.orders-stats strong { color: #222; }

/* ORDER CARDS GRID */
.orders-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.order-card {
  background: #fff; border-radius: 10px; padding: 14px; border: 1px solid #e8e8e8;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  animation: fadeSlideIn .4s ease;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.order-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.order-avatar { width: 32px; height: 32px; border-radius: 50%; background: #26a17b; display: flex; align-items: center; justify-content: center; }
.order-avatar svg { width: 18px; height: 18px; fill: #fff; }
.order-id { font-size: 11px; color: #888; }
.order-time { font-size: 10px; color: #aaa; margin-left: auto; }

.status-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11px; }
.status-badge { display: flex; align-items: center; gap: 4px; color: #26a17b; font-size: 11px; }
.status-badge i { font-size: 10px; }

.buy-badge { display: inline-flex; align-items: center; gap: 4px; background: #ffd700; color: #333; font-size: 11px; font-weight: bold; border-radius: 4px; padding: 2px 7px; margin-bottom: 8px; }

.order-amount { font-size: 22px; font-weight: bold; color: #26a17b; margin-bottom: 2px; }
.order-amount span { font-size: 12px; color: #888; font-weight: normal; }

.order-krw { font-size: 15px; color: #222; font-weight: bold; margin-bottom: 8px; }

.pay-method { font-size: 11px; color: #555; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.pay-method i { color: #26a17b; }

.addr-row { font-size: 11px; color: #888; margin-bottom: 8px; }
.addr-val { color: #4a90d9; }
.status-done   { color: #26a17b; font-size: 11px; display:flex; align-items:center; gap:4px; }
.status-active { color: #f5a623; font-size: 11px; display:flex; align-items:center; gap:4px; }
.status-cancel { color: #e74c3c; font-size: 11px; display:flex; align-items:center; gap:4px; }
.link-color  { color: #4a90d9; }
.krw-color   { color: #f5a623; font-weight: bold; }
.usdt-color  { color: #26a17b; }
.st-done     { color: #26a17b; font-weight: bold; }
.st-active   { color: #f5a623; font-weight: bold; }
.wd-wallet-row { padding: 6px 8px; font-size: 12px; display:flex; align-items:center; gap:6px; }
.wm-img { width:28px; height:28px; object-fit:contain; border-radius:6px; }
.wm-info { display:flex; flex-direction:column; gap:2px; flex:1; }
.wm-name { font-size:14px; font-weight:600; }
.wm-hint { font-size:11px; color:#aaa; }
.wm-arrow { color:#ccc; margin-left:6px; }

.seller-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.seller-name { font-size: 12px; font-weight: bold; }
.seller-stars { font-size: 10px; color: #888; }
.seller-count { font-size: 11px; color: #f5a623; font-weight: bold; }
.best-buyer-badge { background: #f5a623; color: #fff; font-size: 10px; border-radius: 10px; padding: 1px 7px; font-weight: bold; }
.seller-flags { font-size: 14px; display: flex; gap: 4px; }

/* ===== FOOTER ===== */
.footer { background: #222; color: #aaa; text-align: center; padding: 20px; font-size: 12px; }
.footer a { color: #7ecfb3; }

/* ===== DASHBOARD ===== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 110px;
  background: #fff; border-right: 1px solid #e0e0e0;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 8px; gap: 10px; z-index: 200;
}
.sidebar-logo { background: #e74c3c; color: #fff; border-radius: 10px; padding: 6px 14px; font-weight: bold; font-size: 14px; }
.btn-hide-wallet { background: #555; color: #fff; border: none; border-radius: 4px; padding: 4px 10px; cursor: pointer; font-size: 11px; }
.wallet-addr { font-size: 11px; color: #888; }
.wallet-row { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: bold; }
.token-badge { border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: bold; }
.token-badge.usdt { background: #26a17b; color: #fff; }
.token-badge.bnb { background: #f3ba2f; color: #333; }
.gas-warn { font-size: 10px; color: #e74c3c; text-align: center; line-height: 1.5; }
.sidebar-btn { width: 100%; font-size: 12px; }

.dashboard-main { margin-left: 115px; }
.dash-topbar { background: #333; color: #fff; padding: 6px 16px; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.live-badge { background: #e74c3c; color: #fff; border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: bold; }

.dash-profile-bar { background: #e74c3c; padding: 8px 16px; display: flex; gap: 10px; align-items: center; }
.dash-profile-bar .btn-outline { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; }

.lang-row { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 0; }

.balance-row {
  background: #fff; border-radius: 8px; padding: 14px 20px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 14px;
}
.balance-row > div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.balance-val { font-weight: bold; font-size: 16px; }
.teal { color: #26a17b; }
.red { color: #e74c3c; }

.breadcrumb { font-size: 12px; color: #4a90d9; margin-bottom: 16px; cursor: pointer; }
.breadcrumb:hover { text-decoration: underline; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }

.dash-card { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid #e8e8e8; }
.dash-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 13px; font-weight: bold; }
.dash-card-stats { font-size: 11px; color: #888; margin-bottom: 10px; line-height: 1.8; }
.dash-card-stats strong { color: #222; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th { background: #f5f6fa; padding: 6px 8px; text-align: left; color: #666; font-weight: 600; border-bottom: 1px solid #e8e8e8; }
.dash-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0f0; color: #444; }
.dash-table tr:last-child td { border-bottom: none; }

.my-page-section { background: #1a2e4a; border-radius: 10px; margin-bottom: 20px; overflow: hidden; }
.my-page-header { background: #1a2e4a; color: #fff; padding: 14px 20px; font-size: 13px; font-weight: bold; }
.my-page-body { background: #fff; padding: 30px; text-align: center; }
.my-page-warn { font-size: 13px; color: #e74c3c; margin-bottom: 14px; line-height: 1.7; }

/* ===== 지갑 연결 버튼 ===== */
.rate-display {
  display: flex; align-items: center; gap: 5px;
  background: #f8f9fa; border: 1px solid #e8e8e8;
  border-radius: 8px; padding: 5px 14px;
  white-space: nowrap; font-size: 12px;
}
.rate-real  { color: #888; }
.rate-plus, .rate-eq { color: #bbb; font-weight: bold; }
.rate-fee   { color: #f5a623; font-weight: 600; }
.rate-final { color: #26a17b; font-size: 15px; }
.rate-change{ font-size: 11px; }
.btn-wallet {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff; border: none; border-radius: 20px;
  padding: 7px 16px; font-size: 12px; font-weight: bold;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: opacity .2s;
}
.btn-wallet:hover { opacity: .85; }
.btn-wallet.connected {
  background: linear-gradient(135deg, #26a17b 0%, #1a7a5e 100%);
}
.wallet-dot {
  width: 8px; height: 8px; background: #00ff88;
  border-radius: 50%; display: inline-block;
  box-shadow: 0 0 6px #00ff88; animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ===== 지갑 모달 ===== */
.wm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.wm-box {
  background: #fff; border-radius: 16px; width: 360px; max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.wm-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: bold; font-size: 15px;
}
.wm-close {
  background: none; border: none; color: #fff; font-size: 18px; cursor: pointer;
}
.wm-desc { padding: 16px 20px 8px; font-size: 13px; color: #888; }
.wm-list { padding: 0 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.wm-wallet-btn {
  width: 100%; background: #f8f9fa; border: 1px solid #e8e8e8;
  border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; font-size: 14px; transition: background .15s;
}
.wm-wallet-btn:hover { background: #eef2ff; border-color: #667eea; }
.wm-wallet-icon { font-size: 24px; }
.wm-connecting {
  padding: 30px; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.wm-error {
  padding: 24px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; text-align: center;
  font-size: 13px; color: #e74c3c;
}
.wm-soon { opacity: .55; cursor: not-allowed !important; }
.wm-badge-soon {
  margin-left: auto; background: #f0f0f0; color: #999;
  font-size: 10px; border-radius: 10px; padding: 2px 8px;
}
.wm-spinner {
  width: 40px; height: 40px; border: 4px solid #e8e8e8;
  border-top-color: #667eea; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 지갑 드롭다운 ===== */
.wallet-dropdown {
  position: fixed; background: #fff; border: 1px solid #e8e8e8;
  border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.15);
  padding: 8px; min-width: 260px; z-index: 500;
}
.wallet-dropdown .wd-addr {
  font-size: 10px; color: #888; padding: 6px 8px 10px;
  word-break: break-all; border-bottom: 1px solid #f0f0f0; margin-bottom: 4px;
}
.wallet-dropdown button {
  width: 100%; background: none; border: none; text-align: left;
  padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.wallet-dropdown button:hover { background: #f5f6fa; }
.wallet-dropdown .wd-logout { color: #e74c3c; }
.wallet-dropdown hr { border: none; border-top: 1px solid #f0f0f0; margin: 4px 0; }

/* ===== 주문 페이지 ===== */
.order-page-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.panel-header {
  background: #1a2e4a; color: #fff; padding: 12px 16px;
  font-weight: bold; font-size: 13px; border-radius: 8px 8px 0 0;
}
.sellers-panel { border-radius: 8px; overflow: hidden; border: 1px solid #e8e8e8; background:#fff; }
.seller-card {
  padding: 14px 16px; border-bottom: 1px solid #f0f0f0;
  cursor: pointer; transition: background .15s;
}
.seller-card:hover { background: #f0f7ff; }
.seller-card.selected { background: #eef7ff; border-left: 3px solid #4a90d9; }

.order-form-panel { border-radius: 8px; overflow: hidden; border: 1px solid #e8e8e8; background: #fff; }
.selected-seller { padding: 14px 16px; background: #f0faf5; border-bottom: 1px solid #e8e8e8; }
.ss-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }

.form-group { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; }
.form-group label { display: block; font-size: 12px; color: #666; margin-bottom: 8px; font-weight: 600; }
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row input {
  flex: 1; border: 1px solid #ddd; border-radius: 6px;
  padding: 9px 12px; font-size: 14px; outline: none;
}
.input-row input:focus { border-color: #4a90d9; }
.form-group input[type=text] {
  width: 100%; border: 1px solid #ddd; border-radius: 6px;
  padding: 9px 12px; font-size: 13px; outline: none; margin-top: 4px;
}
.form-group input[type=text]:focus { border-color: #4a90d9; }
.input-unit { font-size: 12px; font-weight: bold; color: #888; white-space: nowrap; }
.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quick-amounts button {
  background: #f0f7ff; border: 1px solid #c5d8f0; border-radius: 4px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.quick-amounts button:hover { background: #daeeff; }
.form-hint { font-size: 11px; color: #aaa; margin-top: 6px; }

.order-summary {
  margin: 0 16px 0; padding: 12px; background: #f5f6fa;
  border-radius: 8px; margin: 0 16px 0;
}
.os-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; }
.os-row.total { border-top: 1px solid #e0e0e0; margin-top: 6px; padding-top: 8px; font-size: 14px; }

.btn-full { width: 100%; margin: 14px 0; padding: 12px; font-size: 14px; border-radius: 0 0 8px 8px; }

.pay-info-box {
  margin: 12px 16px; background: #fff8e1; border: 1px solid #ffd54f;
  border-radius: 8px; padding: 14px;
}
.pib-title { font-weight: bold; color: #f57c00; margin-bottom: 10px; font-size: 13px; }
.pib-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; }
.pib-timer { text-align: center; margin-top: 10px; font-size: 12px; color: #555; }

.no-wallet-box {
  background: #fff8e1; border: 1px solid #ffd54f; border-radius: 10px;
  padding: 30px; text-align: center; margin-bottom: 20px;
  flex-direction: column; gap: 12px; align-items: center;
}

/* ===== 마이페이지 ===== */
.my-page-info { text-align: left; }
.mp-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px;
}
.mp-row:last-child { border-bottom: none; }
.mono { font-family: monospace; font-size: 11px; word-break: break-all; }

.rotate-icon { font-size: 11px; color: #aaa; cursor: pointer; }

/* ===== 주문완료 카카오 모달 ===== */
.done-order-id { font-size:12px; color:#888; margin-bottom:10px; font-weight:bold; }
.done-row { display:flex; justify-content:space-between; font-size:12px; padding:4px 0; border-bottom:1px solid #f0f0f0; }
.done-row:last-of-type { border-bottom:none; }
.done-kakao { margin-top:14px; background:#fff9e6; border:1px solid #fee500; border-radius:8px; padding:12px; }
.kakao-label { font-size:12px; font-weight:bold; color:#222; margin-bottom:8px; display:flex; align-items:center; }
.kakao-id-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.kakao-id { font-size:14px; font-weight:bold; color:#3c1e1e; font-family:monospace; flex:1; }
.kakao-copy-btn { background:#f5f6fa; border:1px solid #ddd; border-radius:4px; padding:4px 10px; font-size:11px; cursor:pointer; white-space:nowrap; }
.kakao-copy-btn:hover { background:#eef; }
.kakao-open-btn { display:block; background:#fee500; color:#3c1e1e; text-align:center; border-radius:6px; padding:10px; font-size:13px; font-weight:bold; text-decoration:none; }
.kakao-open-btn:hover { opacity:.9; }

/* ===== 고객센터 모달 ===== */
.cs-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.55);
  display:flex; align-items:center; justify-content:center; z-index:2000;
}
.cs-box {
  background:#fff; border-radius:16px; width:380px; max-width:95vw;
  box-shadow:0 20px 60px rgba(0,0,0,.3); overflow:hidden;
}
.cs-header {
  background:linear-gradient(135deg,#1a2e4a 0%,#2c4a6e 100%);
  color:#fff; padding:16px 20px;
  display:flex; align-items:center; justify-content:space-between;
  font-weight:bold; font-size:15px;
}
.cs-body { padding:24px; }
.cs-body p { font-size:13px; color:#666; margin-bottom:16px; line-height:1.6; }
.cs-body input, .cs-body textarea {
  width:100%; border:1px solid #ddd; border-radius:6px;
  padding:10px 12px; font-size:13px; outline:none; margin-bottom:10px;
  font-family:inherit;
}
.cs-body input:focus, .cs-body textarea:focus { border-color:#4a90d9; }
.cs-body textarea { height:80px; resize:none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .orders-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .orders-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .dashboard-main { margin-left: 0; }
}
