/* ═══════════════════════════════════════════════
   css/plant_picker.css  — PvZClassic
   Plant Picker + Demon Preview bottom-sheet modal
   Target: 752×351px landscape, mobile-first
═══════════════════════════════════════════════ */

/* ── Backdrop ── */
.pp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.pp-overlay.pp-visible { opacity: 1; }

/* ── Sheet slides up ── */
.pp-sheet {
  width: 100%;
  max-width: 800px;
  /* On 752×351 landscape, cap at ~90% height so background shows */
  height: 100vh;
  background: linear-gradient(170deg, #0e0022 0%, #060012 100%);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid rgba(168,85,247,0.4);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32,1.1,0.64,1);
}
.pp-overlay.pp-visible .pp-sheet { transform: translateY(0); }

/* ── Handle bar ── */
.pp-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  margin: 8px auto 0;
  flex-shrink: 0;
}

/* ── Header ── */
.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px 4px;
  flex-shrink: 0;
}
.pp-title {
  font-family: var(--font-display, sans-serif);
  font-size: 13px;
  color: #fff;
  letter-spacing: 0.5px;
}
.pp-title strong { color: #c084fc; }
.pp-close-btn {
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.pp-close-btn:hover { background: rgba(255,255,255,0.14); }

/* ══ MAIN BODY — 2 columns ══ */
.pp-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Left col: identical to battle tray ── */
.pp-left-col {
  width: 64px;
  min-width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 3px 4px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  /* Exact same wood as .plant-tray */
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0px, transparent 4px,
      rgba(0,0,0,0.025) 4px, rgba(0,0,0,0.025) 5px
    ),
    linear-gradient(180deg, #b07838 0%, #8c5820 30%, #7a4a14 60%, #8c5820 100%);
  border-right: 3px solid #c8941a;
  box-shadow:
    3px 0 0 #4a2808,
    inset 0 1px 0 rgba(255,210,100,0.12);
}
.pp-left-col::-webkit-scrollbar { display: none; }

.pp-selected-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  align-items: center;
}

/* Slot = landscape tray card clone */
.pp-sel-slot {
  width: 54px;
  height: 36px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  box-sizing: border-box;
  border-radius: 6px 6px 4px 4px;
  overflow: visible;
  /* Same wood as tray-card */
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0px, transparent 3px,
      rgba(0,0,0,0.03) 3px, rgba(0,0,0,0.03) 4px
    ),
    linear-gradient(160deg, #c8914a 0%, #a06828 30%, #8a5218 60%, #7a4410 100%);
  border-top:    2px solid #daa050;
  border-left:   1px solid #b87838;
  border-right:  1px solid #6a3810;
  border-bottom: 3px solid #4a2808;
  box-shadow:
    0 3px 0 #3a1e08,
    0 4px 8px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,210,100,0.18);
}

/* Nail pin */
.pp-sel-slot::before {
  content: '';
  position: absolute;
  top: -4px; left: 50%;
  transform: translateX(-50%);
  width: 7px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e8d090, #b8922a 60%, #6a4800);
  border: 1px solid #4a3000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.6);
  z-index: 2;
}

/* Filled slot — image inside carved recess */
.pp-sel-filled {
  cursor: pointer;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.pp-sel-filled:hover {
  border-top-color: #f87171;
  box-shadow:
    0 3px 0 #3a1e08,
    0 0 8px rgba(239,68,68,0.4),
    inset 0 1px 0 rgba(255,210,100,0.18);
}

/* Image recess inside slot */
.pp-sel-filled .pp-sel-recess,
.pp-sel-slot .pp-sel-img-wrap {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  margin-left: 2px;
  background: linear-gradient(135deg,
    rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.15) 50%, rgba(0,0,0,0.28) 100%);
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.4);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.pp-sel-filled img {
  width: 24px; height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* Empty slot */
.pp-sel-empty {
  height: 36px;
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0px, transparent 3px,
      rgba(0,0,0,0.04) 3px, rgba(0,0,0,0.04) 4px
    ),
    linear-gradient(160deg, #7a6040 0%, #5c4428 50%, #4a3418 100%);
  border-top-color:    #8a7050;
  border-left-color:   #6a5030;
  border-right-color:  #3a2810;
  border-bottom-color: #2a1808;
  box-shadow: 0 2px 0 #1a1008;
}

.pp-sel-plus {
  font-size: 12px;
  color: rgba(200,148,26,0.25);
  font-weight: 300;
  margin: auto;
}
.pp-sel-empty-label {
  font-family: var(--font-display);
  font-size: 6px;
  color: rgba(200,148,26,0.2);
  letter-spacing: 0.5px;
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Cost label — right side of landscape slot, same as tray-card cost */
.pp-sel-cost {
  flex: 1;
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  color: #fde68a;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  text-align: center;
  border-left: 1px solid rgba(255,170,50,0.15);
  margin-left: 2px;
  padding: 0 2px;
  line-height: 1.2;
  white-space: nowrap;
}

/* Forced (locked) slot */
.pp-sel-forced {
  border-top-color:  #a78bfa !important;
  border-left-color: #9060d0 !important;
  box-shadow:
    0 3px 0 #3a1e08,
    0 0 8px rgba(167,139,250,0.3) !important;
  cursor: default !important;
}

.pp-sel-lock {
  position: absolute;
  bottom: 2px; right: 3px;
  font-size: 8px;
}

/* Unlock slot buttons — same tray-card locked style */
.pp-slot-unlocks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  margin-top: 0;
}
.pp-unlock-slot {
  width: 54px;
  height: 36px;
  border-radius: 6px 6px 4px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.pp-unlock-available {
  background: linear-gradient(160deg, #5a4428 0%, #3e2a10 60%, #2e1e08 100%);
  border-top:    2px solid #c8941a;
  border-left:   1px solid #8b6530;
  border-right:  1px solid #3a2410;
  border-bottom: 3px solid #2a1808;
  box-shadow: 0 2px 0 #1a1008;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pp-unlock-available:hover {
  border-top-color: #fbbf24;
  box-shadow: 0 2px 0 #1a1008, 0 0 8px rgba(200,148,26,0.4);
}
.pp-unlock-blocked {
  background: linear-gradient(160deg, #3a2a18 0%, #281c08 100%);
  border-top:    2px solid #4a3828;
  border-left:   1px solid #3a2810;
  border-right:  1px solid #221808;
  border-bottom: 3px solid #181008;
  box-shadow: 0 1px 0 #100800;
  opacity: 0.5;
  background: rgba(0,0,0,0.2);
  cursor: default;
  opacity: 0.5;
}
.pp-unlock-icon { font-size: 9px; line-height: 1; }
.pp-unlock-label img{
  width: 8px;
  height: 8px;
}
.pp-unlock-label {
  font-size: 8px;
  font-weight: 700;
  color: #fbbf24;
  text-align: center;
  line-height: 1.3;
}

/* ── RIGHT COL: enemies + plant grid ── */
.pp-right-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* Demon preview */
.pp-demon-section { flex-shrink: 0; }
.pp-section-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  padding: 5px 12px 2px;
  text-transform: uppercase;
}
.pp-demon-row {
  display: flex;
  gap: 6px;
  padding: 3px 12px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  align-items: flex-end;
}
.pp-demon-row::-webkit-scrollbar { display: none; }
.pp-demon-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.pp-demon-chip img {
  width: 38px; height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(255,60,0,0.45));
}
.pp-demon-chip span {
  font-size: 7px;
  color: rgba(255,255,255,0.5);
  text-align: center;
  white-space: nowrap;
  max-width: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-no-demons {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  padding: 6px 0;
}

/* Divider */
.pp-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 10px;
  flex-shrink: 0;
}

/* ── Plant grid ── */
.pp-plant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 3px;
  padding: 4px 8px 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(168,85,247,0.3) transparent;
  align-content: start;
}

.pp-plant-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px 3px;
  border-radius: 7px;
  border: 1.5px solid rgba(168,85,247,0.25);
  background: rgba(15,5,35,0.8);
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
  transition: transform 0.1s, border-color 0.12s, background 0.12s;
  user-select: none;
  -webkit-user-select: none;
}
.pp-plant-card:active { transform: scale(0.92); }
.pp-plant-card img {
  width: 30px; height: 30px;
  object-fit: contain;
  display: block;
}
.pp-plant-name {
  font-size: 7px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  text-align: center;
  margin-top: 2px;
  line-height: 1.2;
  word-break: break-word;
}
.pp-plant-cost {
  font-size: 7px;
  color: #fbbf24;
  margin-top: 1px;
  line-height: 1;
}

/* Locked (unowned) */
.pp-card-locked {
  opacity: 0.32;
  cursor: default;
  filter: grayscale(0.5);
}

/* Selected */
.pp-card-selected {
  border-color: rgba(34,197,94,0.85) !important;
  background: rgba(34,197,94,0.1) !important;
  box-shadow: 0 0 8px rgba(34,197,94,0.3);
}
.pp-check {
  position: absolute;
  top: 2px; right: 4px;
  font-size: 9px;
  font-weight: 900;
  color: #22c55e;
  line-height: 1;
}

/* Level-forced plant */
.pp-card-forced {
  border-color: rgba(168,85,247,0.7) !important;
  background: rgba(168,85,247,0.1) !important;
  cursor: default;
}
.pp-forced-badge {
  position: absolute;
  top: 2px; right: 3px;
  font-size: 8px;
  line-height: 1;
}

/* ── Start battle button ── */
.pp-start-btn {
  margin: 4px 10px 8px;
  padding: 9px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border: none;
  border-radius: 11px;
  color: #fff;
  font-family: var(--font-display, sans-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(22,163,74,0.45);
  transition: transform 0.1s, box-shadow 0.1s;
  user-select: none;
  -webkit-user-select: none;
}
.pp-start-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(22,163,74,0.35);
}
