/**
 * Tomorrow's Hero Studio (خزانة الهدايا والمقتنيات الأسطورية)
 * Clean Luxury Beige Showcase Shelf Architecture with 3D display boxes.
 */

:root {
  --closet-beige-light: #faf7f2;
  --closet-beige-mid: #f3ece1;
  --closet-beige-dark: #e5dac9;
  --closet-wood-trim: #8c6d53;
  --closet-wood-dark: #5c4033;
  --closet-gold: #f59e0b;
  --closet-text: #2d3748;
}

/* Page Layout */
.hero-studio-closet-page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px;
  font-family: var(--font-kids, 'Cairo', sans-serif);
  color: var(--closet-text);
  direction: rtl;
}

/* 1. Top Header */
.closet-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 2px solid var(--closet-beige-dark);
  border-radius: 20px;
  padding: 16px 24px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(140, 109, 83, 0.08);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-closet-home {
  background: var(--closet-beige-mid);
  border: 1px solid var(--closet-beige-dark);
  color: #4a5568;
  border-radius: 12px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn-closet-home:hover {
  background: #e2d8c9;
  transform: translateY(-2px);
}

.closet-collection-badge {
  background: #fdf6e7;
  border: 1px solid #fcd34d;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 14px;
  color: #78350f;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.badge-pill {
  background: #d97706;
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 12px;
}

.header-center {
  text-align: center;
}
.closet-main-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #78350f;
}
.closet-subtitle {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: #718096;
}

.closet-stars-pill {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  padding: 10px 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.stars-val {
  font-size: 22px;
}

/* 2. Top Gifts Store Deck */
.closet-store-section {
  background: #ffffff;
  border: 2px solid var(--closet-beige-dark);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(140, 109, 83, 0.08);
}

.store-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.store-categories-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.btn-store-tab {
  background: var(--closet-beige-light);
  border: 1px solid var(--closet-beige-dark);
  color: #4a5568;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn-store-tab:hover {
  background: var(--closet-beige-mid);
}
.btn-store-tab.active {
  background: #78350f;
  border-color: #5c2c06;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(120, 53, 15, 0.3);
}

.store-search-field {
  background: var(--closet-beige-light);
  border: 1px solid var(--closet-beige-dark);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #2d3748;
  width: 240px;
}
.store-search-field:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.2);
}

/* Gifts Deck (Horizontal / Multi-row Scroll) */
.store-gifts-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
}

.gift-store-card {
  background: var(--closet-beige-light);
  border: 2px solid var(--rarity-border);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}
.gift-store-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}
.gift-store-card.is-in-closet {
  background: #f0fdf4;
  border-color: #86efac;
}

.gift-rarity-pill {
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 4px;
}

.gift-thumb-box {
  width: 100%;
  height: 70px;
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--closet-beige-dark);
  overflow: hidden;
}
.gift-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  transition: transform 0.2s ease;
}
.gift-thumb-box:hover .gift-img {
  transform: scale(1.1);
}
.gift-emoji-fallback {
  font-size: 32px;
}

.gift-name {
  margin: 6px 0 2px 0;
  font-size: 12px;
  font-weight: 800;
  color: #1a202c;
}
.gift-desc {
  margin: 0;
  font-size: 10px;
  color: #718096;
  line-height: 1.3;
}

.gift-card-btn-wrap {
  margin-top: 8px;
}
.btn-buy-gift {
  width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  border: none;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}
.btn-buy-gift.can-afford {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-buy-gift.can-afford:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.btn-buy-gift.cannot-afford {
  background: #e2e8f0;
  color: #a0aec0;
  cursor: not-allowed;
}
.gift-owned-badge {
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 8px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid #bbf7d0;
}

/* 3. Middle: Grand Beige Closet Showcase Shelf */
.closet-middle-showcase {
  margin-top: 10px;
}

.closet-shelf-cabinet {
  background: linear-gradient(180deg, #fbf8f2 0%, #f4eee2 100%);
  border: 8px solid var(--closet-wood-trim);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(92, 64, 51, 0.2), inset 0 2px 8px rgba(255,255,255,0.8);
  padding: 24px;
  position: relative;
}

.shelf-cabinet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 2px solid var(--closet-beige-dark);
  border-radius: 16px;
  padding: 12px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.cabinet-title-banner {
  text-align: center;
}
.cabinet-title-banner h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: #78350f;
}
.cabinet-status-note {
  font-size: 12px;
  color: #8c6d53;
  font-weight: 700;
}
.cabinet-ornament-left, .cabinet-ornament-right {
  font-size: 28px;
}

/* 100 Showcase Cubby Boxes Grid (5 columns per row - large & scrollable) */
.shelf-boxes-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
  max-height: 760px;
  overflow-y: auto;
  padding: 12px 8px;
  scrollbar-width: thin;
}

/* Individual Large Shelf Box */
.shelf-grid-box {
  height: 160px;
  background: linear-gradient(180deg, #efe6d8 0%, #e2d5c2 100%);
  border: 3px solid #d5c5b0;
  border-radius: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 6px 14px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.06);
  transition: all 0.25s ease;
  cursor: pointer;
  overflow: hidden;
}
.shelf-grid-box:hover {
  transform: translateY(-3px);
  border-color: #a88d70;
  box-shadow: inset 0 6px 14px rgba(0,0,0,0.12), 0 8px 18px rgba(140, 109, 83, 0.2);
}
.shelf-grid-box.has-gift {
  background: linear-gradient(180deg, #ffffff 0%, #faf5eb 100%);
  border: 3px solid var(--rarity-border);
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.04), 0 8px 20px rgba(140, 109, 83, 0.18);
}

.box-slot-number {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 13px;
  font-weight: 900;
  color: #718096;
  background: rgba(255,255,255,0.85);
  padding: 2px 8px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.box-empty-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #8c6d53;
  opacity: 0.65;
}
.empty-plus {
  font-size: 36px;
  font-weight: bold;
  line-height: 1;
}
.box-empty-prompt small {
  font-size: 13px;
  font-weight: 800;
  margin-top: 4px;
}

/* Placed Gift Inside Box (Maximized Full Space) */
.box-placed-gift {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 8px;
  z-index: 2;
}
.box-gift-img {
  width: 125px;
  height: 125px;
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.22));
  transition: transform 0.25s ease;
}
.shelf-grid-box:hover .box-gift-img {
  transform: scale(1.15) rotate(3deg);
}
.box-gift-emoji {
  font-size: 80px;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.22));
  transition: transform 0.25s ease;
}
.shelf-grid-box:hover .box-gift-emoji {
  transform: scale(1.15);
}

.box-wooden-ledge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--closet-wood-trim);
  border-radius: 0 0 14px 14px;
}

/* Spotlight effect */
.box-spotlight {
  position: absolute;
  top: 0;
  width: 100%;
  height: 50px;
  background: radial-gradient(ellipse at top, rgba(255, 255, 255, 0.9) 0%, transparent 80%);
  pointer-events: none;
}

/* Entrance Animation */
.just-unlocked-pop {
  animation: popIntoBox 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes popIntoBox {
  0% { transform: scale(0.5) translateY(-20px); opacity: 0; }
  70% { transform: scale(1.1) translateY(0); }
  100% { transform: scale(1); opacity: 1; }
}

/* Shelf Base Plank */
.shelf-base-plank {
  background: linear-gradient(180deg, var(--closet-wood-trim) 0%, var(--closet-wood-dark) 100%);
  border-radius: 16px;
  padding: 12px 20px;
  color: #fdf6e7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}
.plank-info-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 1024px) {
  .shelf-boxes-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 768px) {
  .shelf-boxes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 480px) {
  .shelf-boxes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Personality & Achievement Card Button */
.btn-hero-personality-card {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #ffffff;
  border: 2px solid #a78bfa;
  border-radius: 16px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  transition: all 0.25s ease;
  animation: pulseCardBtn 3s infinite;
}
.btn-hero-personality-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.45);
  background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
}
@keyframes pulseCardBtn {
  0%, 100% { box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35); }
  50% { box-shadow: 0 4px 22px rgba(124, 58, 237, 0.6); }
}

/* Hero Card Modal Overlay */
.hero-card-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  direction: rtl;
}

.hero-card-modal-dialog {
  background: #ffffff;
  border: 3px solid var(--closet-beige-dark);
  border-radius: 24px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalPopIn 0.3s ease;
}
@keyframes modalPopIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--closet-beige-mid);
  padding-bottom: 12px;
}
.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title-wrap h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: #78350f;
}
.modal-icon {
  font-size: 26px;
}

.btn-close-modal {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-weight: bold;
  transition: all 0.2s ease;
}
.btn-close-modal:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Theme Switcher */
.modal-theme-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  color: #4b5563;
  flex-wrap: wrap;
}
.btn-theme-pill {
  background: var(--closet-beige-light);
  border: 1px solid var(--closet-beige-dark);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-theme-pill:hover {
  background: var(--closet-beige-mid);
}
.btn-theme-pill.active {
  background: #78350f;
  color: #ffffff;
  border-color: #5c2c06;
}

/* Card Preview Container */
.modal-card-preview-stage {
  width: 100%;
  background: #0f172a;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.5);
  overflow: hidden;
}
.hero-card-img-preview {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Action Buttons */
.modal-actions-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-modal-action {
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-download-png {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-download-png:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}
.btn-share-web {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-share-web:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

