/**
 * DICE-ROLL-STYLES.CSS - Dice roll page specific styles
 * Based on classic-wheel-styles.css but adapted for dice
 */

/* ===== ROOT VARIABLES ===== */
:root {
  --dice-color: #ffffff;
}

/* ===== BODY & LAYOUT ===== */
body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

/* ===== CARD STYLES ===== */
.card {
  border: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.wheel-card-mobile .card-body {
  padding: 1rem 1.25rem;
}

.wheel-card-mobile .card-title {
  margin-bottom: 1rem !important;
}

/* ===== DICE CONTAINER ===== */
.spin-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 0;
}

.dice-wrapper {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 1;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#diceContainer {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#diceContainer canvas {
  max-width: 100%;
  max-height: 100%;
}

/* Reduce spacing in dice display section */
#diceRoll .text-center.mt-3 {
  margin-top: 0.5rem !important;
}

/* ===== SPIN MODE CARDS ===== */
.spin-mode-card {
  padding: 1rem;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
  text-decoration: none;
  color: inherit;
  display: block;
}

.spin-mode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border-color: #0d6efd;
  text-decoration: none;
}

.spin-mode-card.active {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  box-shadow: 0 8px 24px rgba(40, 167, 69, 0.3);
}

.spin-mode-card.active .mode-title,
.spin-mode-card.active small {
  color: white !important;
}

.mode-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.mode-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

/* ===== PRESET CARDS ===== */
.preset-card {
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  padding: 1rem;
  border-radius: 12px;
  border: 2px solid #e9ecef;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.preset-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color) !important;
}

.preset-card:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.preset-card .preset-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: block;
  line-height: 1;
}

.preset-card .preset-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #495057;
  margin: 0;
  line-height: 1.3;
}

.preset-card:hover .preset-title {
  color: var(--primary-color);
}

/* ===== ADVANCED OPTIONS TOGGLE ===== */
.advanced-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  transition: all 0.2s ease;
}

.advanced-toggle:hover {
  transform: scale(1.05);
}

#advancedOptions {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

#advancedOptions.show {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.navbar-nav .nav-link:hover, 
.navbar-nav .nav-link.active {
  color: var(--primary-color);
}

.btn-theme-color {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

/* ===== ACCORDION CUSTOMIZATION ===== */
.accordion-button:not(.collapsed) {
  background-color: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

/* ===== AD CONTAINER STYLES ===== */
.ad-container {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  position: relative;
}

.ad-container-middle {
  min-height: 150px;
  max-width: 100%;
}

.ad-label {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 10px;
  color: #6c757d;
  text-transform: uppercase;
}

/* ===== STICKY SIDE ADS ===== */
.sticky-ad-left,
.sticky-ad-right {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  z-index: 100;
  transition: all 0.3s ease;
}

.sticky-ad-left {
  left: 0;
}

.sticky-ad-right {
  right: 0;
}

.sticky-ad-left .ad-container,
.sticky-ad-right .ad-container {
  min-height: 600px;
  width: 160px;
}

.sticky-ad-left.collapsed {
  left: -150px;
}

.sticky-ad-right.collapsed {
  right: -150px;
}

.ad-close-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.ad-close-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* ===== BOTTOM STICKY AD ===== */
.bottom-sticky-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: all 0.3s ease;
}

.bottom-sticky-ad .ad-container {
  min-height: 90px;
}

.bottom-sticky-ad.collapsed {
  bottom: -100%;
}

/* ===== THEME COLOR CLASSES ===== */
.theme-food { 
  --primary-color: #FF6F61; 
  --secondary-color: #FFD5CC; 
}

.theme-family { 
  --primary-color: #F6C947; 
  --secondary-color: #FFF2C5; 
}

.theme-kids { 
  --primary-color: #7ED6F3; 
  --secondary-color: #D6F6FF; 
}

.theme-classroom { 
  --primary-color: #667EEA; 
  --secondary-color: #DDE3FF; 
}

.theme-travel { 
  --primary-color: #4CAF50; 
  --secondary-color: #DFF5E1; 
}

.theme-home { 
  --primary-color: #B0BEC5; 
  --secondary-color: #ECEFF1; 
}

.theme-fitness { 
  --primary-color: #FF8A65; 
  --secondary-color: #FFDACC; 
}

.theme-games { 
  --primary-color: #9C27B0; 
  --secondary-color: #F3D1FA; 
}

.theme-gaming {
  --primary-color: #9C27B0;
  --secondary-color: #F3D1FA;
}

.theme-tasks { 
  --primary-color: #607D8B; 
  --secondary-color: #CFD8DC; 
}

.theme-lifestyle { 
  --primary-color: #8E44AD; 
  --secondary-color: #EEDDF8; 
}

.theme-fun { 
  --primary-color: #FF9800; 
  --secondary-color: #FFE0B2; 
}

.theme-creative {
  --primary-color: #667EEA;
  --secondary-color: #DDE3FF;
}

.theme-crypto {
  --primary-color: #f7931a;
  --secondary-color: #345d9d;
}

body[class*="theme-"] {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

/* ===== DICE ROLL BUTTON ===== */
.roll-center-btn {
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 50px;
  border-radius: 25px;
  border: 2px solid #fff;
  background: var(--primary-color);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 10;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.roll-center-btn:hover:not(:disabled) {
  transform: translateX(-50%) scale(1.05);
}

.roll-center-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===== ITEMS CONTAINER (Fixed 6 items) ===== */
.items-container {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background-color: #f8f9fa;
}

.item-entry {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.32rem;
  background: white;
  border-radius: 0.375rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  align-items: start;
}

.item-entry input[type="text"] {
  flex: 1;
}

.item-entry select {
  width: 120px;
}

.item-entry input[type="file"] {
  font-size: 0.875rem;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 1400px) {
  .sticky-ad-left,
  .sticky-ad-right {
    display: none;
  }
}

@media (max-width: 768px) {
  .bottom-sticky-ad {
    display: block;
  }

  .dice-wrapper {
    min-height: 300px;
  }

  .roll-center-btn {
    width: 100px;
    height: 45px;
    font-size: 0.9rem;
  }

  .item-entry {
    flex-direction: column;
  }

  .item-entry select {
    width: 100%;
  }

  .main-layout-row {
    display: flex;
    flex-direction: column;
  }

  /* Preserve gutter spacing for cards on mobile */
  .main-layout-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .advanced-toggle {
    position: static;
    margin-bottom: 1rem;
  }

  .preset-card .preset-emoji {
    font-size: 2rem;
  }

  .preset-card .preset-title {
    font-size: 0.75rem;
  }

  .mode-icon {
    font-size: 2rem;
  }
}

@media (max-width: 576px) {
  .dice-wrapper {
    min-height: 250px;
  }

  .roll-center-btn {
    width: 90px;
    height: 40px;
    font-size: 0.85rem;
  }
}

/* ===== FACE LABELS ===== */
.face-label {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
}

/* Disable add/remove buttons for dice (always 6 faces) */
.dice-fixed-faces .btn-add-item,
.dice-fixed-faces .btn-remove-item {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NUMBER DICE MODE (dice-notation.js) — 3D cube dice (d2/d3/d6), SVG shaped
   counters (d4–d100), roll-up animation, results strip. Theme-variable driven;
   scoped to the dice page structures.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Mode switch + preset chips: custom theme-variable buttons (Bootstrap's
   outline variants are hardcoded blue/grey and ignore the site themes). */
.dn-mode-btn {
    font-weight: 600;
    background: var(--theme-surface, #f8f9fa);
    border: 2px solid var(--theme-accent, #b91c1c);
    color: var(--theme-accent, #b91c1c);
}

.dn-mode-btn:hover {
    background: var(--theme-accent-soft, rgba(185, 28, 28, 0.12));
    border-color: var(--theme-accent, #b91c1c);
    color: var(--theme-accent, #b91c1c);
}

.dn-mode-btn.active,
.dn-mode-btn.active:hover {
    background: var(--theme-accent, #b91c1c);
    border-color: var(--theme-accent, #b91c1c);
    color: var(--theme-button-text, #fff);
}

.dn-mode-btn:focus-visible {
    outline: 2px solid var(--theme-accent, #b91c1c);
    outline-offset: 2px;
}

.dn-preset {
    background: var(--theme-surface, #f8f9fa);
    border: 1px solid var(--theme-border, #ced4da);
    color: var(--theme-text, #212529);
    font-weight: 600;
}

.dn-preset:hover {
    border-color: var(--theme-accent, #b91c1c);
    color: var(--theme-accent, #b91c1c);
    background: var(--theme-surface, #f8f9fa);
}

.dn-preset.active,
.dn-preset.active:hover {
    background: var(--theme-accent, #b91c1c);
    border-color: var(--theme-accent, #b91c1c);
    color: var(--theme-button-text, #fff);
}

.dn-stage {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 14px;
    min-height: 150px;
    padding: 12px 0;
}

.dn-die {
    position: relative;
    width: 110px;
    height: 110px;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 250ms ease, opacity 250ms ease;
}

.dn-die svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── True 3D cube dice (d2 / d3 / d6) ─────────────────────────────────────
   Six real faces on a preserve-3d cube; JS tumbles it with a transform
   transition and it settles on the rolled face. --dn-cube-size drives the
   face translateZ so the cube stays watertight at every breakpoint. */
.dn-cube-die {
    --dn-cube-size: 92px;
    width: var(--dn-cube-size);
    height: var(--dn-cube-size);
    filter: none; /* drop-shadow on the outer box flattens 3D children */
}

.dn-cube-scene {
    width: 100%;
    height: 100%;
    perspective: 460px;
}

.dn-cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(-18deg) rotateY(24deg);
    will-change: transform;
}

.dn-cube-face {
    position: absolute;
    inset: 0;
    border-radius: 12%;
    background: linear-gradient(145deg, #fdfaf3, #ece5d3);
    border: 2px solid #d6cdb8;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.08);
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dn-cube-face svg {
    width: 86%;
    height: 86%;
}

.dn-face-front  { transform: rotateY(0deg)   translateZ(calc(var(--dn-cube-size) / 2)); }
.dn-face-back   { transform: rotateY(180deg) translateZ(calc(var(--dn-cube-size) / 2)); }
.dn-face-right  { transform: rotateY(90deg)  translateZ(calc(var(--dn-cube-size) / 2)); }
.dn-face-left   { transform: rotateY(-90deg) translateZ(calc(var(--dn-cube-size) / 2)); }
.dn-face-top    { transform: rotateX(90deg)  translateZ(calc(var(--dn-cube-size) / 2)); }
.dn-face-bottom { transform: rotateX(-90deg) translateZ(calc(var(--dn-cube-size) / 2)); }

.dn-shape {
    fill: var(--theme-accent, #b91c1c);
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 3;
    stroke-linejoin: round;
}

.dn-die-d6 .dn-shape {
    fill: #f8f9fa;
    stroke: #b91c1c;
}

.dn-pip {
    fill: #b91c1c;
}

.dn-value {
    fill: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 34px;
    font-weight: 700;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.35);
    stroke-width: 1.5;
}

.dn-die.dn-settled {
    transform: scale(1.12);
}

.dn-die.dn-dropped {
    opacity: 0.35;
    filter: grayscale(1) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.15));
    transform: scale(0.9);
}

/* ══ PICKER CUBE — a true CSS 3D cube (same technique as the Number-Dice
   cube), with the picker's per-face colours + content and a gentle idle. ══ */
.pcube-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 260px;
    padding: 24px 0;
}
.pcube-scene {
    --pcube-size: 180px;
    width: var(--pcube-size);
    height: var(--pcube-size);
    perspective: 900px;
}
.pcube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(26deg);
    will-change: transform;
}
.pcube-face {
    position: absolute;
    inset: 0;
    border-radius: 16%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.2), inset 0 8px 12px rgba(255, 255, 255, 0.18);
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.pcube-front  { transform: rotateY(0deg)   translateZ(calc(var(--pcube-size) / 2)); }
.pcube-back   { transform: rotateY(180deg) translateZ(calc(var(--pcube-size) / 2)); }
.pcube-right  { transform: rotateY(90deg)  translateZ(calc(var(--pcube-size) / 2)); }
.pcube-left   { transform: rotateY(-90deg) translateZ(calc(var(--pcube-size) / 2)); }
.pcube-top    { transform: rotateX(90deg)  translateZ(calc(var(--pcube-size) / 2)); }
.pcube-bottom { transform: rotateX(-90deg) translateZ(calc(var(--pcube-size) / 2)); }

.pcube-pips { width: 76%; height: 76%; }
.pcube-pips circle { fill: #fff; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.pcube-label {
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    padding: 8px;
    max-width: 92%;
    word-break: break-word;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    font-size: clamp(13px, 4.2vw, 20px);
}
.pcube-label-big { font-size: clamp(34px, 12vw, 64px); padding: 0; }
.pcube-img { width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)); }

@media (max-width: 575.98px) {
    .pcube-scene { --pcube-size: 132px; }
    .pcube-wrap { min-height: 200px; }
}

/* Results strip */
.dn-results {
    padding: 4px 0 8px;
}

.dn-results-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.dn-results-spec {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--theme-muted, #6c757d);
    margin-right: 4px;
}

.dn-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    background: var(--theme-surface, #f8f9fa);
    border: 2px solid var(--theme-accent, #b91c1c);
    color: var(--theme-text, #212529);
    font-weight: 700;
    font-size: 1.05rem;
}

.dn-chip-dropped {
    opacity: 0.4;
    text-decoration: line-through;
    border-style: dashed;
}

.dn-chip-mod {
    border-color: var(--theme-border, #ced4da);
    background: transparent;
    color: var(--theme-muted, #6c757d);
}

.dn-results-eq {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--theme-muted, #6c757d);
}

.dn-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 52px;
    padding: 0 14px;
    border-radius: 14px;
    background: var(--theme-accent, #b91c1c);
    color: var(--theme-button-text, #fff);
    font-weight: 800;
    font-size: 1.5rem;
}

/* Winner-modal icon slot when showing a notation total */
.dn-modal-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 64px;
    padding: 0 16px;
    border-radius: 16px;
    background: var(--theme-accent, #b91c1c);
    color: #fff;
    font-weight: 800;
    font-size: 1.75rem;
}

@media (max-width: 576px) {
    .dn-die {
        width: 84px;
        height: 84px;
    }

    .dn-cube-die {
        --dn-cube-size: 72px;
        width: var(--dn-cube-size);
        height: var(--dn-cube-size);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dn-die {
        transition: none;
    }

    .dn-cube {
        transition: none !important; /* JS sets an inline transition for the tumble */
    }
}
