/**
 * Frontend Styles for WP Loyalty Engine (v2.0 Modern UI)
 */

/* =============================================================
   1. Main Container & Global
   ============================================================= */
.wple-dashboard-wrapper {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
  max-width: 800px;
  margin: 20px auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 針對純徽章模式 (view="badge") 的樣式調整 */
.wple-mode-badge .wple-tier-badge {
  display: inline-block;
  vertical-align: middle;
}

/* 區塊標題 (配合新 UI) */
.wple-section-title {
  font-size: 1.1em;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  border-bottom: none; /* 移除舊版底線 */
  padding-bottom: 0;
}

.wple-icon-star {
  margin-right: 6px;
  font-size: 1.2em;
}

/* =============================================================
   2. Header Section (Minimal & Full Support)
   ============================================================= */
.wple-dashboard-header {
  display: flex;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f1;
}

/* 極簡模式 (Minimal) 樣式覆蓋 */
.wple-dashboard-header.wple-header-minimal {
  display: block;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 10px;
  text-align: left; /* 預設靠左，側邊欄可透過外層強制置中 */
}

/* 頭像 (僅在完整模式顯示) */
.wple-user-avatar img {
  border-radius: 50%;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.wple-user-info {
  margin-left: 20px;
}

/* 極簡模式下移除左邊距 */
.wple-header-minimal .wple-user-info {
  margin-left: 0;
}

.wple-greeting {
  font-size: 1.1em;
  color: #666;
  margin-bottom: 5px;
}

/* 徽章容器 */
.wple-tier-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap; /* 避免手機版爆開 */
}

/* 核心徽章樣式 */
.wple-tier-badge {
  background: #333;
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: bold;
  text-transform: uppercase;
  white-space: nowrap;
}

/* 加盟主標籤 (紫色) */
.wple-label-franchise {
  background: #6f42c1;
  color: #fff;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.85em;
  font-weight: 500;
  white-space: nowrap;
}

/* 動態等級顏色 (可依需求擴充) */
.tier-gold {
  background: #d4af37;
}
.tier-silver {
  background: #c0c0c0;
  color: #333;
}
.tier-diamond {
  background: #b9f2ff;
  color: #004a6f;
}

.wple-cycle-info {
  font-size: 0.85em;
  color: #888;
  margin-top: 4px;
}

/* =============================================================
   3. Benefits Section (Modern Coupon UI)
   ============================================================= */
.wple-benefits-section {
  margin-bottom: 25px;
}

.wple-benefit-card-modern {
  display: flex;
  background: #fff;
  border: 1px solid #ffdde3;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 12px rgba(255, 0, 60, 0.05);
  margin-bottom: 20px;
  transition: transform 0.2s ease;
}

.wple-benefit-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 0, 60, 0.1);
}

/* 左側：折扣數 */
.benefit-left {
  flex: 0 0 100px;
  background: #fff5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 80px;
}

.benefit-value {
  font-size: 20px;
  font-weight: 700;
  color: #d63638;
  line-height: 1;
}

.benefit-value.status-pending {
  color: #999;
  text-decoration: line-through;
  font-size: 1.5em;
}

/* 分隔線 (模擬票券撕線) */
.benefit-divider {
  width: 2px;
  background: transparent;
  border-left: 2px dashed #ffcdd2;
  position: relative;
  margin-left: -1px;
}

.benefit-divider::before,
.benefit-divider::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff; /* 需與背景色一致 */
  border-radius: 50%;
  left: -7px;
  border: 1px solid #ffdde3;
}
.benefit-divider::before {
  top: -7px;
  border-bottom-color: transparent;
}
.benefit-divider::after {
  bottom: -7px;
  border-top-color: transparent;
}

/* 右側：詳情 */
.benefit-right {
  flex: 1;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}

.benefit-info {
  display: flex;
  flex-direction: column;
}

.benefit-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.benefit-desc {
  font-size: 12px;
  color: #888;
}

/* 右上角倒數標籤 */
.benefit-tag {
  background: #fff0f2;
  color: #d63638;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid #ffcdd2;
  margin-bottom: auto;
}

/* =============================================================
   4. Progress Section
   ============================================================= */
.wple-progress-section-linear {
  margin-top: 15px;
  padding: 0 2px;
}

/* 1. 上方資訊 */
.linear-stat-top {
  display: flex;
  align-items: baseline; /* 讓文字底部對齊 */
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

.linear-stat-top .stat-label {
  color: #666;
  font-size: 0.9em;
}

.linear-stat-top .stat-value {
  color: #333;
  font-weight: 700;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 2. 進度條 (維持現代風格) */
.wple-progress-bar-container.modern {
  background: #f0f0f1;
  height: 10px; /* 細緻一點 */
  border-radius: 5px;
  box-shadow: none;
  overflow: hidden;
  margin-bottom: 10px;
}

.wple-progress-bar-fill {
  background: linear-gradient(90deg, #ff9a9e 0%, #ffdde3 100%);
  border-radius: 5px;
  height: 100%;
  transition: width 1s ease-in-out;
}

/* 3. 下方訊息 */
.linear-msg-bottom {
  font-size: 12px;
  color: #555;
  line-height: 1.5;
}

.linear-msg-bottom strong {
  color: #d63638; /* 金額強調色 */
  font-weight: 700;
}

.linear-msg-bottom .highlight-tier {
  font-weight: 700;
  color: #333;
}

/* 恭喜訊息 */
.msg-congrats {
  color: #00a32a; /* 綠色代表成功 */
  font-weight: 600;
  margin: 0;
}

/* =============================================================
   5. Alerts
   ============================================================= */
.wple-alert {
  display: flex;
  padding: 15px;
  margin-bottom: 20px;
  border-left: 4px solid #dba617;
  background: #fcf9e8;
  color: #333;
  border-radius: 4px;
}

.wple-alert-icon {
  font-size: 1.5em;
  margin-right: 15px;
}

/* =============================================================
   6. Mobile Responsive
   ============================================================= */
@media (max-width: 600px) {
  /* Header 調整 */
  .wple-dashboard-header {
    flex-direction: column;
    text-align: center;
  }

  /* 如果是極簡模式，保持靠左 */
  .wple-header-minimal {
    align-items: flex-start;
    text-align: left;
  }

  .wple-user-info {
    margin-left: 0;
    margin-top: 15px;
  }

  .wple-header-minimal .wple-user-info {
    margin-top: 0;
  }

  .wple-tier-wrapper {
    justify-content: center;
  }
  .wple-header-minimal .wple-tier-wrapper {
    justify-content: flex-start;
  }

  /* Coupon Card 調整 */
  .benefit-left {
    flex: 0 0 80px;
  }
  .benefit-value {
    font-size: 1.6em;
  }

  .benefit-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.7em;
    padding: 2px 6px;
  }
  .benefit-title {
    font-size: 1em;
    margin-top: 10px; /* 避開右上角標籤 */
  }
}
