@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Nunito:wght@700;800;900&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Nunito', sans-serif;
  --primary: #FF5A79;
  --primary-hover: #E03E5F;
  --secondary: #7928CA;
  --accent: #FF9F1C;
  --bg-gradient: linear-gradient(135deg, #FFF5F7 0%, #FFF9EB 50%, #F0F7FF 100%);
}

* {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  min-height: 100vh;
  color: #1E293B;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* Ngăn iOS/iPad tự động phóng to khi chạm vào ô input */
input,
select,
textarea {
  font-size: 16px !important;
}

/* Hiệu ứng phản hồi xúc giác khi chạm trên màn hình cảm ứng */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.touch-target:active {
  transform: scale(0.96);
}

/* Glassmorphism containers */
.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 30px -5px rgba(255, 90, 121, 0.07), 0 12px 20px -5px rgba(15, 23, 42, 0.04);
}

/* Big Hero Action Buttons */
.btn-power-card {
  background: linear-gradient(135deg, #FF6B35 0%, #F7931E 55%, #FFB703 100%);
  box-shadow: 0 12px 26px -6px rgba(247, 147, 30, 0.45);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn-power-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -6px rgba(247, 147, 30, 0.55);
}

.btn-power-card:active {
  transform: scale(0.98);
}

.btn-super-card {
  background: linear-gradient(135deg, #6B21A8 0%, #9333EA 50%, #EC4899 100%);
  box-shadow: 0 12px 26px -6px rgba(147, 51, 234, 0.45);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn-super-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -6px rgba(147, 51, 234, 0.55);
}

.btn-super-card:active {
  transform: scale(0.98);
}

/* Shimmer shine animation on buttons */
.shimmer-effect::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.22) 30%,
    rgba(255, 255, 255, 0) 40%
  );
  transform: rotate(25deg);
  animation: shimmer 4.5s infinite linear;
  pointer-events: none;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(25deg); }
  100% { transform: translateX(100%) rotate(25deg); }
}

/* ==============================================================
   PHYSICAL CARD RECTANGLE STYLING (VIP PLAY CARD - TOUCH OPTIMIZED)
   ============================================================== */
.physical-card {
  min-height: 440px;
  height: auto;
  border-radius: 26px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 22px 45px -12px rgba(15, 23, 42, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transition: all 0.25s ease;
  user-select: none;
}

/* Hologram overlay sheen */
.physical-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 85% 15%,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 2;
}

/* Thẻ Quyền Năng theme: Gold / Energetic Sunburst */
.card-theme-power {
  background: linear-gradient(135deg, #E65C00 0%, #F9D423 100%);
  color: #FFFFFF;
}

.card-theme-power .card-inner-bg {
  background: linear-gradient(135deg, rgba(217, 70, 0, 0.96) 0%, rgba(245, 130, 11, 0.92) 55%, rgba(234, 179, 8, 0.88) 100%);
}

/* Thẻ Siêu Quyền Năng theme: Cosmic Royal Purple / Jewel */
.card-theme-super {
  background: linear-gradient(135deg, #240046 0%, #3C096C 35%, #7B2CBF 70%, #9D4EDD 100%);
  color: #FFFFFF;
}

.card-theme-super .card-inner-bg {
  background: radial-gradient(circle at 10% 20%, rgba(255, 0, 128, 0.3) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(0, 245, 212, 0.25) 0%, transparent 40%),
              linear-gradient(135deg, #2B0938 0%, #4A1259 50%, #7B1FA2 100%);
}

/* ==============================================================
   6 Ô TRÒN SỬ DỤNG LƯỢT (CẢM ỨNG TO RÕ 54px - 58px)
   ============================================================== */
.slot-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.slot-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

@media (max-width: 420px) {
  .slot-circle {
    width: 46px;
    height: 46px;
  }
}

/* Empty circle state */
.slot-circle.empty {
  background: rgba(255, 255, 255, 0.97);
  border: 3px dashed rgba(230, 92, 0, 0.85);
  color: #EA580C;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}

.slot-circle.empty:hover {
  transform: scale(1.08);
  background: #FFFFFF;
  border-style: solid;
  border-color: #EA580C;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.4);
}

.slot-circle.empty:active {
  transform: scale(0.92);
}

/* Ô bóng gợi ý tích lượt tiếp theo trên màn hình cảm ứng */
.slot-circle.next-up {
  border-style: solid;
  border-color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.2);
  animation: pulseNextSlot 2s infinite ease-in-out;
}

@keyframes pulseNextSlot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3), 0 6px 14px rgba(0, 0, 0, 0.18); }
  50% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.55), 0 8px 20px rgba(0, 0, 0, 0.25); }
}

/* Used slot state with X mark */
.slot-circle.used {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  border: 3px solid #FFFFFF;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.45);
  cursor: default;
  flex-shrink: 0;
}

.slot-circle.used .mark-x {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ==============================================================
   Ô VUÔNG QUÀ TẶNG COMBO (CHUẨN CẢM ỨNG 44px x 44px)
   ============================================================== */
.slot-square {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  position: relative;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

@media (max-width: 420px) {
  .slot-square {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
}

/* Ô vuông nguyên vẹn (chưa lấy quà) */
.slot-square.intact {
  background: rgba(255, 255, 255, 0.97);
  border: 2.5px solid #F59E0B;
  color: #B45309;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.slot-square.intact:hover {
  transform: scale(1.08);
  background: #FFFFFF;
  border-color: #D97706;
}

.slot-square.intact:active {
  transform: scale(0.92);
}

/* Ô vuông đã lấy quà (gạch chéo đỏ rõ nét) */
.slot-square.taken {
  background: #FEE2E2;
  border: 2.5px solid #DC2626;
  color: #DC2626;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
}

.slot-square.taken::before,
.slot-square.taken::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 3.5px;
  background: #DC2626;
  border-radius: 2px;
  z-index: 5;
}

.slot-square.taken::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.slot-square.taken::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.slot-square.taken:active {
  transform: scale(0.92);
}

/* ==============================================================
   WATERMARK & STRIKE-THROUGH (DẤU X MỜ GẠCH CẢ THẺ)
   ============================================================== */
.watermark-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(1.5px);
  border-radius: 24px;
}

.watermark-big-x {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.watermark-big-x::before,
.watermark-big-x::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 9px;
  background: rgba(239, 68, 68, 0.68);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
  border-radius: 4px;
}

.watermark-big-x::before {
  transform: translate(-50%, -50%) rotate(32deg);
}

.watermark-big-x::after {
  transform: translate(-50%, -50%) rotate(-32deg);
}

.watermark-stamp {
  position: relative;
  z-index: 35;
  border: 4px solid #EF4444;
  color: #EF4444;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  transform: rotate(-8deg);
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4), 0 0 0 2px #EF4444 inset;
  animation: stampPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes stampPop {
  0% { transform: scale(1.8) rotate(-20deg); opacity: 0; }
  100% { transform: scale(1) rotate(-8deg); opacity: 1; }
}

/* ==============================================================
   TOUCH PILL FILTERS & TABLE ROW SELECTION
   ============================================================== */
.branch-pill {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.branch-pill.active {
  background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(247, 147, 30, 0.35);
}

.branch-pill:not(.active) {
  background: #F8FAFC;
  color: #475569;
  border: 1px solid #E2E8F0;
}

.branch-pill:not(.active):hover {
  background: #F1F5F9;
}

.filter-pill {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
  border: 1.5px solid transparent;
}

.filter-pill.active {
  background: #FFF1F2;
  color: #E11D48;
  border-color: #FDA4AF;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.12);
}

.filter-pill:not(.active) {
  background: #F8FAFC;
  color: #475569;
  border-color: #E2E8F0;
}

.filter-pill:active,
.branch-pill:active {
  transform: scale(0.95);
}

/* Hàng thẻ đang được chọn trong bảng */
.card-row-item {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.card-row-item.selected-row {
  background-color: #FFF1F2 !important;
  box-shadow: inset 4px 0 0 #F43F5E;
}

/* Modal styling */
.modal-overlay {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
}

/* Print styles for issuing card to physical printer */
@media print {
  body {
    background: #FFFFFF !important;
  }
  .no-print {
    display: none !important;
  }
  .print-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  .physical-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
}
