/**
 * PLO Shared UX — imported by all PLO module HTML files
 * <link rel="stylesheet" href="../../poker-core/plo-ux.css">
 *
 * Provides: unified card component, error/success toasts, loading skeleton,
 * focus-visible accessibility, mobile breakpoints, common transitions.
 */

/* ═══════════════════════════════════════════════════════════════
   STANDARD CARD COMPONENT
   Use .plo-card  (60 × 84)  — default size for trainers
   Use .plo-card.compact      (48 × 68)  — tables, small slots
   Use .plo-card.mini         (38 × 54)  — HUDs, tight spaces
   ═══════════════════════════════════════════════════════════════ */

.plo-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 84px;
  background: #fff;
  border-radius: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  color: #1a1a1a;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.plo-card.compact { width: 48px; height: 68px; font-size: 0.88rem; border-radius: 6px; }
.plo-card.mini    { width: 38px; height: 54px; font-size: 0.72rem; border-radius: 5px; }

/* Suit colors — consistent across all modules */
.plo-card.hearts,
.plo-card.diamonds,
.plo-card[data-suit="h"],
.plo-card[data-suit="d"] { color: #d32f2f; }

.plo-card.spades,
.plo-card.clubs,
.plo-card[data-suit="s"],
.plo-card[data-suit="c"] { color: #1a1a1a; }

/* Suit icon below rank */
.plo-card .suit {
  font-size: 0.85em;
  line-height: 1;
  margin-top: 1px;
}
.plo-card.compact .suit { font-size: 0.75em; }
.plo-card.mini .suit    { font-size: 0.65em; }

/* Face-down state */
.plo-card.facedown {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: transparent;
  border-color: rgba(21, 101, 192, 0.5);
}
.plo-card.facedown::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.04) 3px,
    rgba(255, 255, 255, 0.04) 6px
  );
}

/* Empty card slot (dashed border placeholder) */
.plo-card-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 84px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.plo-card-slot:hover { border-color: var(--accent, #fb8c00); background: rgba(251, 140, 0, 0.06); }
.plo-card-slot.compact { width: 48px; height: 68px; border-radius: 6px; }
.plo-card-slot.mini    { width: 38px; height: 54px; border-radius: 5px; }

/* Card dealing animation */
@keyframes plo-deal {
  from { opacity: 0; transform: scale(0.85) translateY(-12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.plo-card.dealing { animation: plo-deal 0.3s ease forwards; }


/* ═══════════════════════════════════════════════════════════════
   ERROR / SUCCESS TOASTS
   ═══════════════════════════════════════════════════════════════ */

.plo-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(90vw, 400px);
  text-align: center;
  backdrop-filter: blur(8px);
}
.plo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.plo-toast.error {
  background: rgba(211, 47, 47, 0.92);
  color: #fff;
  box-shadow: 0 4px 20px rgba(211, 47, 47, 0.4);
}
.plo-toast.success {
  background: rgba(67, 160, 71, 0.92);
  color: #fff;
  box-shadow: 0 4px 20px rgba(67, 160, 71, 0.4);
}
.plo-toast.info {
  background: rgba(251, 140, 0, 0.92);
  color: #000;
  box-shadow: 0 4px 20px rgba(251, 140, 0, 0.4);
}


/* ═══════════════════════════════════════════════════════════════
   XP TOAST
   ═══════════════════════════════════════════════════════════════ */

@keyframes plo-xpPop {
  0%   { opacity: 0; transform: translateY(12px) scale(0.9); }
  20%  { opacity: 1; transform: translateY(-4px) scale(1.05); }
  40%  { opacity: 1; transform: translateY(0) scale(1); }
  85%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(0.95); }
}

.plo-xp-toast {
  position: fixed;
  bottom: 28px;
  right: 20px;
  background: var(--accent, #fb8c00);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  z-index: 9998;
  box-shadow: 0 4px 18px rgba(251, 140, 0, 0.35);
}
.plo-xp-toast.show {
  animation: plo-xpPop 1.4s ease forwards;
}


/* ═══════════════════════════════════════════════════════════════
   LOADING SKELETON
   ═══════════════════════════════════════════════════════════════ */

@keyframes plo-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.plo-skeleton {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 800px 100%;
  animation: plo-shimmer 1.5s ease infinite;
  border-radius: 8px;
}

.plo-skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}
.plo-skeleton-text.short { width: 40%; }
.plo-skeleton-text.medium { width: 65%; }
.plo-skeleton-text.full { width: 100%; }

.plo-skeleton-card {
  width: 60px;
  height: 84px;
  border-radius: 8px;
}

/* Hide skeletons once loaded */
body.plo-loaded .plo-skeleton,
body.plo-loaded .plo-skeleton-text,
body.plo-loaded .plo-skeleton-card { display: none; }


/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY — FOCUS-VISIBLE
   ═══════════════════════════════════════════════════════════════ */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
.plo-card-slot:focus-visible {
  outline: 2px solid #ffd54f;
  outline-offset: 2px;
}

/* Remove default outline on mouse click */
:focus:not(:focus-visible) {
  outline: none;
}

/* Dark dropdown options */
select option, select optgroup { background:#111; color:#fff; }


/* ═══════════════════════════════════════════════════════════════
   MOBILE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  .plo-card         { width: 52px; height: 72px; font-size: 0.92rem; border-radius: 7px; }
  .plo-card.compact { width: 42px; height: 60px; font-size: 0.78rem; }
  .plo-card.mini    { width: 34px; height: 48px; font-size: 0.65rem; }
  .plo-card-slot         { width: 52px; height: 72px; }
  .plo-card-slot.compact { width: 42px; height: 60px; }
  .plo-card-slot.mini    { width: 34px; height: 48px; }
}

@media (max-width: 420px) {
  .plo-card         { width: 44px; height: 62px; font-size: 0.8rem; border-radius: 6px; }
  .plo-card.compact { width: 36px; height: 52px; font-size: 0.7rem; }
  .plo-card.mini    { width: 30px; height: 42px; font-size: 0.6rem; }
  .plo-card-slot         { width: 44px; height: 62px; }
  .plo-card-slot.compact { width: 36px; height: 52px; }
  .plo-card-slot.mini    { width: 30px; height: 42px; }
}


/* ═══════════════════════════════════════════════════════════════
   COMMON TRANSITIONS & UTILITIES
   ═══════════════════════════════════════════════════════════════ */

@keyframes plo-fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes plo-feedbackPop {
  0%   { transform: scale(0.9); opacity: 0; }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes plo-correctFlash {
  0%   { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.5); }
  100% { box-shadow: 0 0 0 12px rgba(76, 175, 80, 0); }
}
@keyframes plo-wrongFlash {
  0%   { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.5); }
  100% { box-shadow: 0 0 0 12px rgba(255, 23, 68, 0); }
}

/* Smooth entrance for any panel/section */
.plo-enter {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.plo-enter.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hidden utility */
.plo-hidden { display: none !important; }

/* Muted hint text */
.plo-hint {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.78rem;
  text-align: center;
  padding: 16px;
}

/* Empty state */
.plo-empty {
  text-align: center;
  padding: 32px 16px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.85rem;
}
.plo-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Scroll smooth */
html { scroll-behavior: smooth; }
