/* Color Picker Button Styles */
.color-button-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 5px; /* Reduced from 10px */
}

.color-display-button {
  width: 36px; /* Slightly smaller */
  height: 36px; /* Slightly smaller */
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle shadow for depth */
}

.color-display-button::after {
  content: '🎨';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); /* Darker shadow for better visibility */
  font-size: 1.2rem; /* Slightly larger emoji */
  z-index: 5; /* Ensure emoji is on top */
  pointer-events: none; /* Allow clicks to pass through to the button */
}

.color-display-button:hover {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  transform: scale(1.05);
}

/* Modal overlay centers content both vertically and horizontally */
#new-team-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
  overflow: hidden;
}

#new-team-modal {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: 95%;
  max-height: 300px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: block;
  contain: layout; /* Contain layout to prevent overflow issues */
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#new-team-modal .modal-title {
  margin: 0;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--card-border);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
}

#new-team-modal .modal-body {
  padding: var(--spacing-md);
  overflow-y: auto;
  max-height: 200px; /* Set a specific max height */
}

#new-team-modal .modal-actions {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-top: 1px solid var(--card-border);
  background: var(--card-bg);
  width: 100%;
  box-sizing: border-box;
  position: relative;
  margin: 0;
  left: 0;
  right: 0;
  clear: both; /* Clear any floats */
}

#new-team-modal .btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--bg-secondary);
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 10;
  position: static; /* Changed from relative to static */
  margin: 0;
  float: none; /* Ensure no floating */
}

#new-team-modal .btn-save {
  background: var(--success-bg);
  color: var(--success);
}

#new-team-modal .btn-cancel {
  background: var(--danger-bg);
  color: var(--danger);
}

#new-team-modal .btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

html.dark-mode #new-team-modal .btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Remove problematic modal class override */

/* Color Picker Widget Styling - exactly like play editor */
.color-picker-widget {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  width: auto;
  min-width: 220px;
  max-width: 300px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-picker-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.color-picker-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.color-picker-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.basic-color-option {
  width: 2.2rem;
  height: 2.2rem;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.basic-color-option:hover {
  border-color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.basic-color-option.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.8), 0 0 0 4px rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.custom-color-button {
  width: 2rem;
  height: 2rem;
  background: linear-gradient(90deg, 
    #ff0000 0%, #ffff00 16.67%, #00ff00 33.33%, 
    #00ffff 50%, #0000ff 66.67%, #ff00ff 83.33%, #ff0000 100%);
  border: 2px solid #4b5563;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.875rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
  padding: 0;
}

.custom-color-button:hover {
  border-color: #3b82f6;
}

/* Dark mode support for color picker */
html.dark-mode .color-picker-widget,
body.dark-mode .color-picker-widget {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}

/* Adjustments for color fields to be on same line */
.team-name-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 100%; /* Prevent overflow */
  overflow: hidden; /* Hide any overflow */
}

.team-name-color-row .form-input {
  flex: 1;
  max-width: calc(100% - 80px); /* Leave space for color buttons */
  min-width: 150px;
  font-size: 1.1rem;
  padding: 0.6rem 0.8rem;
}

.color-buttons-container {
  display: flex;
  gap: 5px; /* Reduced from 8px */
  flex-shrink: 0; /* Prevent shrinking */
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-color);
}

/* Ensure color buttons always display their background color */
#primary-color-button[style*="background-color"],
#secondary-color-button[style*="background-color"] {
  background-color: var(--bg-color, inherit) !important;
}

/* Form label styles */
.form-label {
  display: block;
  margin-bottom: 0.3rem; /* Reduced space */
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem; /* Slightly smaller */
}
