/* market.css - 明亮風格完整版 */

/* --- 頂部 Hero 區塊 --- */
.market-hero {
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: #fff;
  border: 2px solid #ffeb3b; /* 活潑的黃色邊框 */
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(255, 235, 59, 0.2);
  margin-bottom: 20px;
}

.market-hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.market-hero h1 {
  margin: 0;
  font-size: 1.8rem;
  color: #333;
}

.market-hero p {
  margin: 5px 0 0;
  color: #666;
  font-size: 0.9rem;
}

/* 刊登按鈕 */
.btn-market-post {
  background: #00c853; /* 鮮豔綠 */
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 #009624;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.1s;
}
.btn-market-post:active { transform: translateY(4px); box-shadow: none; }
.btn-market-post:hover { background: #00e676; }

/* 沒登入時按鈕變灰 */
.btn-login-hint {
  background: #9e9e9e;
  box-shadow: 0 4px 0 #616161;
  cursor: not-allowed;
}

/* 提示框 */
.highlight-box { padding: 10px; border-radius: 8px; font-weight: bold; margin-top: 10px; }
.highlight-box.success { background: #e8f5e9; border: 1px solid #c8e6c9; color: #2e7d32; }
.highlight-box.error { background: #ffebee; border: 1px solid #ffcdd2; color: #c62828; }

/* --- 列表標題 --- */
.market-list-header {
  margin-bottom: 15px;
  border-left: 5px solid #ff9800;
  padding-left: 10px;
}
.market-list-header h2 { margin: 0; color: #444; }

/* --- 卡片列表 --- */
.market-card-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 單張卡片 */
.market-card {
  background: #fff;
  border: 2px solid #f0f0f0;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  scroll-margin-top: 100px; /* 讓錨點定位準確 */
}
.market-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.08);
  border-color: #4fc3f7;
}

/* 卡片頭部 */
.market-card-header {
  background: #fafafa;
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mc-user { display: flex; align-items: center; gap: 10px; }
.mc-avatar { 
  width: 40px; height: 40px; background: #eee; border-radius: 50%; 
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; border: 1px solid #ddd;
}
.mc-name { font-weight: bold; color: #333; font-size: 1rem; }
.mc-time { font-size: 0.85rem; color: #888; cursor: help; margin-top: 2px; }

/* 動作按鈕區塊 */
.mc-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 各種小按鈕樣式 */
.btn-action {
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

/* 查信譽 */
.btn-check-rep {
  background: #fff;
  border-color: #ddd;
  color: #555;
}
.btn-check-rep:hover {
  background: #f8f9fa;
  border-color: #ccc;
  color: #333;
}

/* 聯絡我 */
.btn-contact {
  background: #2196f3; /* 藍色 */
  color: #fff;
  box-shadow: 0 2px 4px rgba(33, 150, 243, 0.2);
}
.btn-contact:hover {
  background: #1976d2;
  transform: translateY(-1px);
}

/* 分享 */
.btn-share {
  background: #f8f9fa;
  border: 1px solid #ddd;
  color: #555;
  box-shadow: 0 2px 0 rgba(0,0,0,0.05);
}
.btn-share:hover {
  background: #e3f2fd;
  color: #007bff;
  border-color: #007bff;
}

/* 刪除 */
.btn-delete {
  background: #ff5252;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn-delete:hover { background: #d32f2f; }

/* --- 交易內容 (左右對決) --- */
.market-card-body {
  display: flex;
  padding: 20px;
  gap: 15px;
  align-items: stretch;
}

.trade-box {
  flex: 1;
  border-radius: 12px;
  padding: 15px;
  background: #fcfcfc;
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* 左邊 (藍) */
.trade-give { border-top: 4px solid #2196f3; background: #e3f2fd; border-color: #bbdefb; }
.trade-give .trade-label { color: #1565c0; font-weight: bold; }

/* 右邊 (紅) */
.trade-get { border-top: 4px solid #e91e63; background: #ffebee; border-color: #ffcdd2; }
.trade-get .trade-label { color: #c62828; font-weight: bold; }

.trade-header {
  display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(0,0,0,0.1); padding-bottom: 8px;
}
.trade-total { 
  font-weight: bold; color: #333; background: #fff; padding: 2px 8px; 
  border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); font-size: 0.9rem; 
}

/* 果實網格 */
.trade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}

.fruit-item {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 5px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
/* 稀有度邊框色 */
.rarity-mythical { border-color: #e91e63; background: #fce4ec; }
.rarity-legendary { border-color: #9c27b0; background: #f3e5f5; }
.rarity-rare { border-color: #2196f3; background: #e3f2fd; }
.rarity-uncommon { border-color: #888; background: #f5f5f5; }
.rarity-common { border-color: #aaa; background: #fff; }

.fi-icon {
  width: 40px; height: 40px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-bottom: 4px;
}
.fi-name { font-size: 0.75rem; font-weight: bold; color: #333; line-height: 1.2; }
.fi-val { font-size: 0.65rem; color: #666; font-weight: bold; margin-top: 2px; }

/* 永久果標籤 (紫色) */
.fi-perm-tag {
  position: absolute; top: -5px; right: -5px;
  background: #9c27b0; color: #fff;
  font-size: 0.6rem; padding: 2px 4px; border-radius: 4px;
  box-shadow: 0 2px 2px rgba(0,0,0,0.2);
  z-index: 2;
}

/* 實體果標籤 (藍色) */
.fi-real-tag {
  position: absolute; top: -5px; right: -5px;
  background: #2196f3; color: #fff;
  font-size: 0.6rem; padding: 2px 4px; border-radius: 4px;
  box-shadow: 0 2px 2px rgba(0,0,0,0.2);
  z-index: 2;
}

/* 中間箭頭 */
.trade-arrow {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #ccc; width: 30px;
}

@media (max-width: 600px) {
  .market-card-body { flex-direction: column; }
  .trade-arrow { transform: rotate(90deg); width: 100%; height: 30px; }
}

/* --- 刊登視窗 (Modal) --- */
.modal-backdrop {
  position: fixed; top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.6); z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.modal-container {
  background: #fff; 
  width: 95%; max-width: 650px;
  border-radius: 16px; 
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 90vh;
}
.modal-header {
  background: #f8f9fa; padding: 15px 20px; border-bottom: 1px solid #eee;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; color: #333; font-size: 1.2rem; }
.modal-close { border: none; background: none; font-size: 1.5rem; cursor: pointer; color: #666; }

.modal-body { padding: 20px; overflow-y: auto; }
.modal-hint { 
  text-align: center; color: #856404; background-color: #fff3cd; 
  border: 1px solid #ffeeba; margin-bottom: 20px; font-size: 0.95rem; 
  font-weight: bold; padding: 12px; border-radius: 8px; line-height: 1.5;
}

/* 迷你計算機 */
.mini-calc-board { display: flex; gap: 15px; margin-bottom: 20px; }
.mc-col {
  flex: 1; background: #f9f9f9; border: 1px solid #eee; border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column;
}
.mc-title { 
  font-weight: bold; text-align: center; margin-bottom: 10px; color: #555; 
  border-bottom: 1px dashed #ddd; padding-bottom: 8px; font-size: 1rem;
}
.total-val { color: #e65100; font-weight: 800; margin-left: 5px; }

/* 格子樣式 (防跑版修正) */
.mc-slots { 
  display: grid; 
  grid-template-columns: repeat(2, 1fr);
  gap: 10px; 
}
.mc-slot {
  aspect-ratio: 1; width: 100%;
  background: #fff; border: 2px dashed #ccc; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  cursor: pointer; position: relative; color: #999; font-size: 1.5rem;
  transition: 0.2s; overflow: hidden;
}
.mc-slot:hover { border-color: #999; background: #fafafa; }
.mc-slot.filled { border-style: solid; border-color: #2196f3; background: #fff; }

.mc-slot img { 
  width: auto; height: 50%; max-width: 90%;
  object-fit: contain; margin-bottom: 4px; 
}

.slot-name { 
  width: 90%; font-size: 0.75rem; font-weight: bold; color: #333; 
  line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slot-val { font-size: 0.7rem; color: #666; margin-bottom: 2px; font-weight: bold; }

/* 類型切換按鈕 */
.tag-real, .tag-perm { 
    font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; 
    color: #fff; font-weight: bold; display: inline-block; cursor: pointer;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}
.tag-real { background: #2196f3; }
.tag-perm { background: #9c27b0; }
.tag-real:hover { background: #1976d2; }
.tag-perm:hover { background: #7b1fa2; }

.remove-x {
  position: absolute; top: 0; right: 0; background: #ff5252; color: #fff;
  width: 24px; height: 24px; font-size: 14px; display: flex; align-items: center; justify-content: center;
  border-radius: 0 0 0 8px; cursor: pointer; z-index: 5;
}
.remove-x:hover { background: #d32f2f; }

.btn-submit-post {
  width: 100%; padding: 14px; background: #28a745; color: #fff;
  border: none; border-radius: 10px; font-weight: bold; font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 4px 0 #1e7e34; transition: transform 0.1s;
}
.btn-submit-post:active { transform: translateY(4px); box-shadow: none; }

@media (max-width: 600px) {
  .mini-calc-board { flex-direction: column; }
}

/* --- 果實選擇器 (Popup) --- */
.fruit-picker-backdrop {
  position: fixed; top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.6); z-index: 3000;
  display: flex; align-items: center; justify-content: center;
}
.fruit-picker-modal {
  background: #fff; width: 90%; max-width: 450px; height: 80vh;
  border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.fp-header {
  padding: 15px; border-bottom: 1px solid #eee; font-weight: bold; font-size: 1.1rem;
  display: flex; justify-content: space-between; background: #f8f9fa; border-radius: 12px 12px 0 0;
}
.fp-toolbar {
  padding: 10px; background: #fff; border-bottom: 1px solid #eee;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.fp-input {
  flex: 1; padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.9rem;
}
.fp-body {
  flex: 1; overflow-y: auto; padding: 10px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; align-content: start;
}
.fp-item {
  border: 1px solid #eee; border-radius: 8px; padding: 8px;
  text-align: center; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: 0.2s;
}
.fp-item:hover { border-color: #007bff; background: #f0f8ff; transform: translateY(-2px); }
.fp-item img { width: 45px; height: 45px; margin-bottom: 5px; object-fit: contain; }
.fp-item span { font-size: 0.8rem; color: #333; font-weight: bold; line-height: 1.2; }
.fp-item small { font-size: 0.65rem; color: #666; margin-top: 2px; display: block; }

/* 信譽查詢內容 */
#rating-content {
  font-size: 0.95rem;
  line-height: 1.6;
}
/* 首頁提示用的查信譽按鈕（文字內嵌版） */
.hero-rep-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
  vertical-align: baseline;
}
