/* ================================================
   CENTER SPIN STYLE SPINNER
   Single vertical reel based on Slot Machine architecture
   ================================================ */

.centerspin-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  min-height: 450px;
  border: 3px solid #dee2e6;
}

body.dark-mode .centerspin-container,
body[data-theme="dark"] .centerspin-container {
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  border-color: #495057;
}

body[class*="theme-"] .centerspin-container {
  border-color: var(--primary-color);
}

.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);
}

/* The reel wrapper - acts like a slot machine reel */
.centerspin-reel-wrapper {
  width: 400px;
  height: 400px;
  background: #ffffff;
  border: 2px solid var(--secondary-color);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1), 0 4px 20px rgba(0, 0, 0, 0.2);
}

body.dark-mode .centerspin-reel-wrapper,
body[data-theme="dark"] .centerspin-reel-wrapper {
  background: #2c3e50;
  border-color: var(--primary-color);
}

body[class*="theme-"] .centerspin-reel-wrapper {
  border-color: var(--primary-color);
}

/* The reel strip that scrolls */
.centerspin-reel {
  position: absolute;
  width: 100%;
  transition: transform cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Pointer/window showing the winner position */
.centerspin-pointer {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 124px;
  transform: translateY(-50%);
  background: rgba(40, 167, 69, 0.1);
  border-top: 3px solid var(--secondary-color);
  border-bottom: 3px solid var(--secondary-color);
  box-shadow: inset 0 0 20px rgba(40, 167, 69, 0.2);
  pointer-events: none;
  z-index: 10;
  animation: pointerGlow 2s ease-in-out infinite;
}

body[class*="theme-"] .centerspin-pointer {
  border-color: var(--primary-color);
  background: rgba(var(--primary-color-rgb), 0.1);
  box-shadow: inset 0 0 20px rgba(var(--primary-color-rgb), 0.2);
}

@keyframes pointerGlow {
  0%, 100% { 
    opacity: 0.8;
    box-shadow: inset 0 0 20px rgba(40, 167, 69, 0.2);
  }
  50% { 
    opacity: 1;
    box-shadow: inset 0 0 30px rgba(40, 167, 69, 0.4);
  }
}

/* Individual item - dimensions must match JS ITEM_HEIGHT and ITEM_MARGIN */
.centerspin-item {
  height: 120px;
  margin: 2px 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  position: relative;
  transition: filter 0.3s;
  background-size: cover;
  background-position: center;
}

body.dark-mode .centerspin-item,
body[data-theme="dark"] .centerspin-item {
  background: #34495e;
  border-bottom-color: #495057;
}

body[class*="theme-"] .centerspin-item {
  background-color: rgba(var(--secondary-color-rgb), 0.3);
  border-bottom-color: rgba(var(--primary-color-rgb), 0.3);
}

.centerspin-item-image {
  font-size: 3rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
}

.centerspin-item-image img {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 50%;
}

.centerspin-item-name {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  color: #212529;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

body.dark-mode .centerspin-item-name,
body[data-theme="dark"] .centerspin-item-name {
  color: #ecf0f1;
}

body[class*="theme-"] .centerspin-item-name {
  color: var(--primary-color);
  font-weight: 800;
}

/* Blur during spin */
.centerspin-reel.spinning .centerspin-item-image {
  filter: blur(4px);
}

/* Winner highlight */
.centerspin-item.center-glow {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  box-shadow: 0 0 30px rgba(40, 167, 69, 0.8), 0 0 60px rgba(40, 167, 69, 0.4);
  z-index: 5;
  position: relative;
  border-color: #ffc107;
  border-width: 3px;
  animation: winnerPulse 1s ease-in-out infinite;
}

@keyframes winnerPulse {
  0%, 100% { 
    transform: scale(1);
  }
  50% { 
    transform: scale(1.05);
  }
}

.centerspin-item.center-glow .centerspin-item-name {
  color: #ffffff !important;
  font-size: 1.3rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  font-weight: 900;
}

.centerspin-item.center-glow .centerspin-item-image {
  filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.5));
  transform: scale(1.1);
}

/* Preset Card Styles */
.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: #28a745 !important;
}

body[class*="theme-"] .preset-card:hover {
  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: #28a745;
}

body[class*="theme-"] .preset-card:hover .preset-title {
  color: var(--primary-color);
}

/* Advanced Options Animation */
#advancedOptions {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wheel Title Styling */
#wheelTitle {
  color: var(--primary-color);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

body[class*="theme-"] #wheelTitle {
  color: var(--primary-color);
}

/* Preset Dropdown Styling */
#presetDropdown {
  cursor: pointer;
  transition: border-color 0.2s ease;
}

#presetDropdown:hover {
  border-color: #28a745;
}

body[class*="theme-"] #presetDropdown:hover {
  border-color: var(--primary-color);
}

#presetDropdown:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
}

body[class*="theme-"] #presetDropdown:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(var(--primary-color-rgb), 0.25);
}

/* Background Image Button Styling */
#clearBgImage {
  transition: all 0.2s ease;
}

#clearBgImage:hover {
  background-color: #dc3545;
  color: white;
  border-color: #dc3545;
}

/* Disabled State for Controls */
input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Item Entry Grid Layout for Advanced Mode */
@media (min-width: 768px) {
  .item-entry {
    display: grid;
    grid-template-columns: 1fr 60px 100px auto;
    gap: 0.5rem;
    align-items: center;
  }
  
  .item-entry input[type="text"] {
    grid-column: 1 / 2;
  }
  
  .item-entry input[type="number"] {
    grid-column: 2 / 3;
    width: 60px;
  }
  
  .item-entry select {
    grid-column: 3 / 4;
    width: 100px;
  }
  
  .item-entry .btn-group {
    grid-column: 4 / 5;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .centerspin-container {
    padding: 20px 10px;
    min-height: 350px;
  }
  
  .centerspin-reel-wrapper {
    width: 300px;
    height: 300px;
    border-width: 3px;
  }
  
  .centerspin-pointer {
    height: 100px;
    border-top-width: 2px;
    border-bottom-width: 2px;
  }
  
  .centerspin-item {
    height: 96px;
    margin: 2px 0;
  }
  
  .centerspin-item-image {
    font-size: 2rem;
  }
  
  .centerspin-item-image img {
    max-width: 60px;
    max-height: 60px;
  }
  
  .centerspin-item-name {
    font-size: 0.9rem;
  }
  
  .preset-card .preset-emoji {
    font-size: 2rem;
  }
  
  .preset-card .preset-title {
    font-size: 0.75rem;
  }
}