/* Buttons & Inputs */
button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
    backdrop-filter: blur(5px);
}

button:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-1px);
}

button.secondary {
    border-color: var(--border-color);
}

button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-main);
    box-shadow: none;
}

button.danger-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--danger);
}

button.danger-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    color: white;
}

input[type="text"], input[type="number"] {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 1rem;
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.3s;
    width: 100%;
}

/* Hide spin buttons for number inputs */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
  text-align: center;
  font-family: 'Orbitron', sans-serif; /* Match theme font for numbers */
  letter-spacing: 1px;
}

input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
    background: rgba(0, 0, 0, 0.4);
}

.input-group {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.full-width {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    height: 48px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    pointer-events: none;
    transition: left 0.3s ease;
}

/* Adjust toast position when game is active (sidebars visible) */
body.game-active #toast-container {
    left: calc(50% + (280px * var(--scale-factor)));
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
    font-size: 1rem;
    font-weight: 500;
    pointer-events: auto;
}

.toast.info {
    border-left: 5px solid var(--primary);
}

.toast.error {
    border-left: 5px solid var(--danger);
}

.toast.success {
    border-left: 5px solid var(--success);
}

.toast-icon {
    font-size: 1.2rem;
}

/* Loading Dots */
.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

/* Checkboxes - Toggle Switch Style */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    margin: 0;
    flex-shrink: 0; /* Prevent shrinking */
    box-sizing: border-box;
}

.checkbox-group input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.checkbox-group input[type="checkbox"]:checked {
    background: rgba(52, 152, 219, 0.2); /* Primary color with opacity */
    border-color: var(--primary);
}

.checkbox-group input[type="checkbox"]:checked::after {
    left: 22px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.checkbox-group:hover input[type="checkbox"] {
    border-color: var(--text-main);
}

.checkbox-group:hover input[type="checkbox"]::after {
    background: var(--text-main);
}

.checkbox-group:hover input[type="checkbox"]:checked::after {
    background: var(--primary-hover);
}

.checkbox-group label {
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
    color: var(--text-dim);
    transition: color 0.2s;
    line-height: 1.2;
    margin-top: 15px; /* Push text down for better visual alignment */
}

.checkbox-group:hover label {
    color: var(--text-main);
}

/* Privacy Badge */
.privacy-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: bold;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.privacy-badge.public {
    background: rgba(46, 204, 113, 0.2);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.privacy-badge.private {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* Slider */
.slider-container {
    width: 100%;
    padding: 10px 0;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    transition: opacity .2s;
}

.slider:hover {
    opacity: 1;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: transform 0.2s;
    border: none;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Custom Select */
.custom-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 0.8rem;
    padding-right: 2.5rem;
    width: 100%;
    cursor: pointer;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
    
    /* SVG Arrow - White by default */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
    background-color: rgba(0, 0, 0, 0.4);
    /* SVG Arrow - Primary Color on Focus */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

option {
    background-color: var(--bg-dark);
    color: var(--text-main);
    padding: 10px;
}

/* Color Popover & Generic Color Picker Styles */
.color-popover {
 position: fixed;
 background: var(--bg-glass-strong);
 border: 1px solid var(--border-color);
 border-radius: var(--radius-md);
 padding: 1rem;
 box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
 backdrop-filter: blur(10px);
 z-index: 2000;
 width: 280px;
 display: flex;
 flex-direction: column;
 gap: 1rem;
}

.color-popover.hidden {
 display: none;
}

.color-grid {
 display: grid;
 grid-template-columns: repeat(6, 1fr);
 gap: 6px;
 padding: 0 10px;
}

.color-swatch {
 width: 100%;
 aspect-ratio: 1;
 border-radius: 6px;
 cursor: pointer;
 border: 2px solid #404040;
 transition: transform 0.2s, border-color 0.2s;
}

.color-swatch:hover {
 transform: scale(1.1);
 border-color: white;
 z-index: 2;
}

.color-swatch.active {
 border-color: white;
 box-shadow: 0 0 10px rgba(255,255,255,0.5);
 transform: scale(1.1);
 z-index: 2;
}

.custom-color-picker {
 display: flex;
 flex-direction: column;
 gap: 1rem;
}

.cp-saturation-area {
 width: 100%;
 height: 150px;
 background: linear-gradient(to bottom, transparent, #000), linear-gradient(to right, #fff, rgba(255,255,255,0));
 position: relative;
 border-radius: 6px;
 cursor: crosshair;
 border: 1px solid #404040;
}

.cp-hue-area {
 width: 100%;
 height: 20px;
 background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
 position: relative;
 border-radius: 6px;
 cursor: crosshair;
 border: 1px solid #404040;
}

.cp-controls {
 display: flex;
 gap: 10px;
 align-items: center;
}

.cp-preview-color {
 width: 40px;
 height: 40px;
 border-radius: 6px;
 border: 1px solid #404040;
 box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.cp-rgb-inputs {
 display: flex;
 gap: 5px;
 flex: 1;
}

.cp-input-group {
 display: flex;
 flex-direction: column;
 align-items: center;
 flex: 1;
}

.cp-input-group label {
 font-size: 0.7rem;
 color: var(--text-dim);
 margin-bottom: 2px;
}

.cp-input-group input {
 width: 100%;
 background: rgba(0,0,0,0.3);
 border: 1px solid rgba(255,255,255,0.1);
 color: white;
 padding: 4px;
 border-radius: 4px;
 text-align: center;
 font-size: 0.8rem;
}

.cp-saturation-cursor {
 width: 12px;
 height: 12px;
 border: 2px solid white;
 border-radius: 50%;
 position: absolute;
 transform: translate(-50%, -50%);
 pointer-events: none;
 box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.cp-hue-cursor {
 width: 8px;
 height: 100%;
 border: 2px solid white;
 border-radius: 2px;
 position: absolute;
 top: 0;
 transform: translateX(-50%);
 pointer-events: none;
 box-shadow: 0 0 2px rgba(0,0,0,0.5);
 background: transparent;
}


/* Color Picker Tabs */
.cp-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.cp-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-family: "Orbitron", sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.cp-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.cp-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.cp-tab-content {
    display: none;
}

.cp-tab-content.active {
    display: block;
}

/* Palette Grid */
.cp-palette-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}

.cp-palette-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.1s;
}

.cp-palette-swatch:hover {
    transform: scale(1.2);
    z-index: 2;
    border-color: white;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.cp-palette-swatch.active {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--primary);
    z-index: 1;
}


/* Spectrum Picker */
.spectrum-picker-container {
    display: flex;
    justify-content: center;
    padding: 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#game-spectrum-canvas {
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: crosshair;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}


/* Color Popover & Generic Color Picker Styles */
.color-popover {
 position: fixed;
 background: var(--bg-glass-strong);
 border: 1px solid var(--border-color);
 border-radius: var(--radius-md);
 padding: 1rem;
 box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
 backdrop-filter: blur(10px);
 z-index: 2000;
 width: 280px;
 display: flex;
 flex-direction: column;
 gap: 1rem;
}

.color-popover.hidden {
 display: none;
}

.color-grid {
 display: grid;
 grid-template-columns: repeat(5, 1fr);
 gap: 8px;
}

.color-swatch {
 width: 100%;
 aspect-ratio: 1;
 border-radius: 6px;
 cursor: pointer;
 border: 2px solid rgba(255,255,255,0.1);
 transition: transform 0.2s, border-color 0.2s;
}

.color-swatch:hover {
 transform: scale(1.1);
 border-color: white;
 z-index: 2;
}

.color-swatch.active {
 border-color: white;
 box-shadow: 0 0 10px rgba(255,255,255,0.5);
 transform: scale(1.1);
 z-index: 2;
}

.custom-color-picker {
 display: flex;
 flex-direction: column;
 gap: 1rem;
}

.cp-saturation-area {
 width: 100%;
 height: 150px;
 background: linear-gradient(to bottom, transparent, #000), linear-gradient(to right, #fff, rgba(255,255,255,0));
 position: relative;
 border-radius: 6px;
 cursor: crosshair;
 border: 1px solid rgba(255,255,255,0.2);
}

.cp-hue-area {
 width: 100%;
 height: 20px;
 background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
 position: relative;
 border-radius: 6px;
 cursor: crosshair;
 border: 1px solid rgba(255,255,255,0.2);
}

.cp-controls {
 display: flex;
 gap: 10px;
 align-items: center;
}

.cp-preview-color {
 width: 40px;
 height: 40px;
 border-radius: 6px;
 border: 2px solid rgba(255,255,255,0.2);
 box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.cp-rgb-inputs {
 display: flex;
 gap: 5px;
 flex: 1;
}

.cp-input-group {
 display: flex;
 flex-direction: column;
 align-items: center;
 flex: 1;
}

.cp-input-group label {
 font-size: 0.7rem;
 color: var(--text-dim);
 margin-bottom: 2px;
}

.cp-input-group input {
 width: 100%;
 background: rgba(0,0,0,0.3);
 border: 1px solid rgba(255,255,255,0.1);
 color: white;
 padding: 4px;
 border-radius: 4px;
 text-align: center;
 font-size: 0.8rem;
}

.cp-saturation-cursor {
 width: 12px;
 height: 12px;
 border: 2px solid white;
 border-radius: 50%;
 position: absolute;
 transform: translate(-50%, -50%);
 pointer-events: none;
 box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.cp-hue-cursor {
 width: 8px;
 height: 100%;
 border: 2px solid white;
 border-radius: 2px;
 position: absolute;
 top: 0;
 transform: translateX(-50%);
 pointer-events: none;
 box-shadow: 0 0 2px rgba(0,0,0,0.5);
 background: transparent;
}


/* Tooltips */
.custom-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    text-transform: none;
    font-weight: normal;
    letter-spacing: normal;
    max-width: 250px;
    text-align: center;
    white-space: normal;
    line-height: 1.4;
    transition: opacity 0.1s;
}

.custom-tooltip.hidden {
    opacity: 0;
    pointer-events: none;
}

.setting-info {
    color: var(--primary);
    margin-left: 5px;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s;
    cursor: help;
}

.setting-info:hover {
    opacity: 1;
}

