/* ═══════════════════════════════════════════════════════════════
   RakuDeal - Main Stylesheet
   楽天市場の本当に安い商品キュレーション
   ═══════════════════════════════════════════════════════════════ */

:root {
  --rd-primary: #FF385C;
  --rd-primary-dark: #E61E4D;
  --rd-green: #00C48C;
  --rd-green-dark: #00A870;
  --rd-yellow: #FFAA00;
  --rd-bg: #F5F5F4;
  --rd-card: #FFFFFF;
  --rd-text: #222222;
  --rd-text-light: #666666;
  --rd-text-muted: #AAAAAA;
  --rd-border: rgba(0,0,0,0.06);
  --rd-shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --rd-shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --rd-shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --rd-radius: 12px;
  --rd-radius-sm: 8px;
  --rd-font: 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  --rd-font-accent: 'DM Sans', sans-serif;
  --rd-max-width: 1440px;
}

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

body {
  font-family: var(--rd-font);
  background: var(--rd-bg);
  color: var(--rd-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { display: none; }

/* ─── HEADER ─────────────────────────────────────────── */
.rd-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rd-border);
}
.rd-header__inner {
  max-width: var(--rd-max-width);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.rd-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rd-logo__icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 900;
  font-family: var(--rd-font-accent);
  box-shadow: 0 2px 8px rgba(255,56,92,0.3);
}
.rd-logo__text {
  font-size: 15px; font-weight: 700;
  font-family: var(--rd-font-accent);
  color: #1a1a1a;
}
.rd-logo__sub {
  font-size: 9px; color: #aaa;
  margin-left: 6px; font-weight: 400;
}

/* Search Bar */
.rd-search {
  display: flex; align-items: center;
  background: #fff; border: 1px solid #e0e0e0;
  border-radius: 40px;
  padding: 5px 5px 5px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  flex: 0 1 320px; min-width: 140px;
}
.rd-search__input {
  border: none; outline: none; flex: 1;
  font-size: 12px; color: #333;
  background: transparent;
  font-family: inherit;
}
.rd-search__input::placeholder { color: #aaa; }
.rd-search__btn {
  width: 26px; height: 26px;
  border-radius: 50%; border: none;
  background: var(--rd-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── HERO ───────────────────────────────────────────── */
.rd-hero {
  background: linear-gradient(160deg, #0D0D0D 0%, #1a1a2e 40%, #162447 100%);
  padding: 32px 20px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.rd-hero::before {
  content: '';
  position: absolute; inset: 0;
  opacity: 0.4;
  background:
    radial-gradient(ellipse at 25% 50%, rgba(255,56,92,0.2), transparent 60%),
    radial-gradient(ellipse at 75% 30%, rgba(0,196,140,0.1), transparent 50%);
}
.rd-hero__inner {
  position: relative; z-index: 1;
  max-width: 600px; margin: 0 auto;
}
.rd-hero h1 {
  font-size: clamp(22px, 4.5vw, 34px);
  font-weight: 900; color: #fff;
  margin: 0 0 8px; line-height: 1.25;
  letter-spacing: -0.5px;
}
.rd-hero h1 span { color: var(--rd-primary); }
.rd-hero p {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin: 0 0 16px; line-height: 1.6;
}

/* Feature pills */
.rd-features {
  display: flex; gap: 8px;
  justify-content: center; flex-wrap: wrap;
}
.rd-feature {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 8px 14px;
  display: flex; align-items: center; gap: 8px;
}
.rd-feature__icon { font-size: 16px; }
.rd-feature__label { font-size: 11px; font-weight: 600; color: #fff; }
.rd-feature__sub { font-size: 9px; color: rgba(255,255,255,0.4); }

/* ─── CATEGORY TABS ──────────────────────────────────── */
.rd-tabs {
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 54px;
  z-index: 90;
}
.rd-tabs__inner {
  max-width: var(--rd-max-width);
  margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center;
  overflow-x: auto;
}
.rd-tab {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  padding: 8px 11px;
  border: none; background: none;
  border-bottom: 2px solid transparent;
  opacity: 0.45;
  transition: all 0.2s;
  white-space: nowrap; flex-shrink: 0;
}
.rd-tab.active {
  border-bottom-color: #222;
  opacity: 1;
}
.rd-tab__icon { font-size: 15px; }
.rd-tab__label { font-size: 10px; font-weight: 400; color: #333; }
.rd-tab.active .rd-tab__label { font-weight: 600; }

/* Filters */
.rd-filters {
  margin-left: auto;
  display: flex; align-items: center;
  gap: 8px; padding: 6px 0; flex-shrink: 0;
}
.rd-btn-timesale {
  border: 1px solid #ddd;
  border-radius: 6px; padding: 4px 8px;
  font-size: 10px; font-weight: 600;
  background: #fff; color: #888;
  transition: all 0.15s;
}
.rd-btn-timesale.active {
  border-color: var(--rd-primary);
  background: rgba(255,56,92,0.06);
  color: var(--rd-primary);
}
.rd-sort {
  border: 1px solid #ddd; border-radius: 6px;
  padding: 4px 8px; font-size: 10px;
  color: #555; background: #fff;
  font-family: inherit;
}

/* ─── PRODUCT GRID ───────────────────────────────────── */
.rd-grid-wrap {
  max-width: var(--rd-max-width);
  margin: 0 auto;
  padding: 18px 14px 60px;
}
.rd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

/* ─── PRODUCT CARD ───────────────────────────────────── */
.rd-card {
  border-radius: var(--rd-radius);
  overflow: hidden;
  background: var(--rd-card);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: var(--rd-shadow-sm);
  border: 1px solid rgba(0,0,0,0.04);
  animation: fadeSlideIn 0.35s both;
}
.rd-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--rd-shadow-lg);
}
.rd-card--timesale {
  border: 1.5px solid rgba(255,56,92,0.2);
}

/* Card Image */
.rd-card__img-wrap {
  position: relative;
  padding-bottom: 100%;
  overflow: hidden;
}
.rd-card__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.rd-card:hover .rd-card__img {
  transform: scale(1.06);
}

/* Badges */
.rd-badge-discount {
  position: absolute; top: 6px; left: 6px;
  background: var(--rd-primary);
  color: #fff; border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px; font-weight: 800;
  font-family: var(--rd-font-accent);
  line-height: 1;
  box-shadow: 0 1px 6px rgba(255,56,92,0.35);
}
.rd-badge-verdict {
  position: absolute; top: 6px; left: 52px;
  border-radius: 5px; padding: 3px 6px;
  font-size: 9px; font-weight: 700;
  line-height: 1; color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.rd-badge-verdict--buy { background: rgba(0,196,140,0.9); }
.rd-badge-verdict--wait { background: rgba(255,170,0,0.9); }

/* Heart */
.rd-card__heart {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,0.8);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.15s; color: #555;
}
.rd-card__heart.liked {
  background: var(--rd-primary);
  color: #fff;
}

/* Free Shipping */
.rd-badge-shipping {
  position: absolute; bottom: 5px; right: 5px;
  background: rgba(0,166,153,0.85);
  color: #fff; border-radius: 4px;
  padding: 2px 5px; font-size: 8px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

/* Timesale overlay */
.rd-card__timesale {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  padding: 14px 8px 5px;
  display: flex; align-items: center;
  justify-content: space-between;
}
.rd-card__timesale-label {
  font-size: 8px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}
.rd-countdown {
  font-family: var(--rd-font-accent);
  font-size: 10px; font-weight: 700;
  color: var(--rd-primary);
  letter-spacing: 0.5px;
}

/* Card Info */
.rd-card__info { padding: 7px 9px 9px; }
.rd-card__shop {
  font-size: 9px; color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-card__title {
  font-size: 11px; font-weight: 500;
  color: var(--rd-text);
  margin: 3px 0 6px; line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 30px;
}

/* Prices */
.rd-card__price-row {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 4px;
}
.rd-price-sale {
  font-size: 15px; font-weight: 800;
  color: var(--rd-primary);
  font-family: var(--rd-font-accent);
  line-height: 1;
}
.rd-price-original {
  font-size: 9px; color: #ccc;
  text-decoration: line-through;
  font-family: var(--rd-font-accent);
  margin-top: 1px;
}

/* Sparkline */
.rd-sparkline { display: block; }

/* Tags */
.rd-card__tags {
  margin-top: 6px;
  display: flex; gap: 3px; flex-wrap: wrap;
}
.rd-tag {
  font-size: 8px; border-radius: 3px;
  padding: 2px 5px; font-weight: 600;
}
.rd-tag--shipping {
  background: rgba(0,166,153,0.08);
  color: #00A699;
}
.rd-tag--off {
  background: rgba(255,56,92,0.06);
  color: var(--rd-primary);
}

/* ─── MODAL ──────────────────────────────────────────── */
.rd-modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.rd-modal-overlay.active { display: flex; }

.rd-modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 380px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.rd-modal__header {
  position: relative; height: 140px; overflow: hidden;
}
.rd-modal__header img {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.7);
}
.rd-modal__header::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(transparent 40%, rgba(0,0,0,0.7));
}
.rd-modal__close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 28px; height: 28px;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,0.2);
  color: #fff; font-size: 14px;
  backdrop-filter: blur(4px);
}
.rd-modal__title {
  position: absolute; bottom: 12px; left: 14px; right: 14px;
  z-index: 2;
  font-size: 13px; font-weight: 600;
  color: #fff; line-height: 1.3;
}
.rd-modal__body { padding: 16px 18px 20px; }

/* Verdict box */
.rd-verdict {
  display: flex; align-items: center;
  gap: 8px; padding: 10px 12px;
  border-radius: 10px; margin-bottom: 14px;
}
.rd-verdict--buy {
  background: rgba(0,196,140,0.08);
  border: 1px solid rgba(0,196,140,0.2);
}
.rd-verdict--wait {
  background: rgba(255,170,0,0.08);
  border: 1px solid rgba(255,170,0,0.2);
}
.rd-verdict__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff;
}
.rd-verdict--buy .rd-verdict__icon {
  background: linear-gradient(135deg, #00C48C, #00A870);
}
.rd-verdict--wait .rd-verdict__icon {
  background: linear-gradient(135deg, #FFAA00, #FF8800);
}
.rd-verdict__label {
  font-size: 13px; font-weight: 700;
}
.rd-verdict--buy .rd-verdict__label { color: #00855E; }
.rd-verdict--wait .rd-verdict__label { color: #AA6600; }
.rd-verdict__reason {
  font-size: 11px; color: #666; margin-top: 2px;
}

/* Chart */
.rd-chart-box {
  background: #FAFAFA; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
}
.rd-chart-label {
  font-size: 10px; font-weight: 600;
  color: #999; margin-bottom: 8px;
  letter-spacing: 0.5px;
}

/* CTA */
.rd-cta {
  display: block; width: 100%;
  padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--rd-primary), var(--rd-primary-dark));
  color: #fff; font-size: 14px; font-weight: 700;
  text-align: center;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(255,56,92,0.3);
  transition: transform 0.15s;
}
.rd-cta:active { transform: scale(0.97); }
.rd-cta-note {
  text-align: center;
  font-size: 9px; color: #bbb; margin-top: 6px;
}

/* ─── FOOTER ─────────────────────────────────────────── */
.rd-footer {
  background: #1a1a1a;
  color: rgba(255,255,255,0.4);
  padding: 28px 20px;
  text-align: center;
  font-size: 10px;
  line-height: 1.8;
}
.rd-footer strong {
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}

/* ─── EMPTY STATE ────────────────────────────────────── */
.rd-empty {
  text-align: center;
  padding: 50px 20px;
  color: #aaa;
}
.rd-empty__icon { font-size: 32px; margin-bottom: 12px; }
.rd-empty__text { font-size: 13px; }

/* ─── ANIMATIONS ─────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 640px) {
  .rd-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .rd-search { flex: 0 1 180px; min-width: 120px; }
  .rd-hero h1 { font-size: 22px; }
}

@media (min-width: 1200px) {
  .rd-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ─── SINGLE PRODUCT PAGE ─────────────────────────────── */
.rd-single {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
}
.rd-single__header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}
.rd-single__img {
  border-radius: var(--rd-radius);
  overflow: hidden;
  aspect-ratio: 1;
}
.rd-single__img img {
  width: 100%; height: 100%; object-fit: cover;
}
.rd-single__title {
  font-size: 20px; font-weight: 700;
  margin-bottom: 12px; line-height: 1.4;
}
.rd-single__content {
  font-size: 14px; line-height: 1.8;
  color: var(--rd-text-light);
}

@media (max-width: 640px) {
  .rd-single__header {
    grid-template-columns: 1fr;
  }
}
