/* ==================== PLAYGROUND-SPECIFIC STYLES ==================== */

/* Import site-wide styles via ../style.css in HTML */

/* Override/Add playground-specific styles */
body {
    overflow: hidden;
    touch-action: none;
}

body.dark-mode {
    background-color: #000000;
    color: #ffffff;
}

body.frozen-mode #canvas-container {
    cursor: default !important;
}

/* --- TOOLS PANEL --- */
#tools-panel {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 300px;
    background: #fff;
    border-right: 2px solid #000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 25px;
    z-index: 900;
    overflow-y: auto;
    transition: all 0.5s ease;
}

body.dark-mode #tools-panel {
    background: #000;
    border-right: 2px solid #fff;
}

@media (max-width: 800px) {
    #tools-panel {
        width: 100%;
        height: auto;
        max-height: 80vh;
        top: 50px;
        border-right: none;
        border-bottom: 2px solid #000;
        padding: 15px;
        gap: 20px;
        display: none;
    }
    body.dark-mode #tools-panel {
        border-bottom: 2px solid #fff;
    }
}

/* CONTROL GROUPS */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

body.dark-mode .control-group {
    border-bottom: 1px solid #333;
}

.control-group:last-child {
    border-bottom: none;
}

.control-group-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    color: #666;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .control-group-title {
    color: #aaa;
}

/* INPUTS */
select, input[type="text"], textarea {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #000;
    border-radius: 0;
    background: #fff;
    font-family: inherit;
    font-size: 12px;
    color: #000;
    outline: none;
    transition: all 0.3s ease;
    resize: vertical;
}

body.dark-mode select,
body.dark-mode input[type="text"],
body.dark-mode textarea {
    border: 1px solid #fff;
    background: #000;
    color: #fff;
}

select:focus, input:focus, textarea:focus { 
    background: #f0f0f0; 
    border-width: 2px;
}

body.dark-mode select:focus,
body.dark-mode input:focus,
body.dark-mode textarea:focus { 
    background: #222; 
}

.select-wrapper { position: relative; }
.select-wrapper::after {
    content: "▼";
    font-size: 8px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* BUTTONS */
button {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #000;
    border: 1px solid #000;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

body.dark-mode button {
    background: #000;
    color: #fff;
    border: 1px solid #fff;
}

button:hover { 
    background: #000; 
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
body.dark-mode button:hover { 
    background: #fff; 
    color: #000;
    box-shadow: 0 4px 12px rgba(255,255,255,0.1);
}

button:active {
    transform: translateY(0);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.button-group button {
    flex: 1;
}

/* SLIDERS */
input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 3px;
    background: #ddd;
    outline: none;
    margin: 12px 0;
    border-radius: 0;
}

body.dark-mode input[type="range"] {
    background: #444;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.3s ease;
    border: 1px solid #000;
}

body.dark-mode input[type="range"]::-webkit-slider-thumb {
    background: #fff;
    border: 1px solid #fff;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.slider-value {
    font-size: 10px;
    text-align: center;
    color: #666;
    margin-top: -8px;
    font-weight: bold;
}

body.dark-mode .slider-value {
    color: #aaa;
}

/* CHECKBOXES & TOGGLES */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    padding: 4px 0;
}

.checkbox-row:hover {
    background: rgba(0,0,0,0.02);
}

body.dark-mode .checkbox-row:hover {
    background: rgba(255,255,255,0.05);
}

input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #000;
    border-radius: 0;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

body.dark-mode input[type="checkbox"] {
    border: 1px solid #fff;
}

input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    background-color: #000;
    transition: transform 0.3s ease;
}

body.dark-mode input[type="checkbox"]::before {
    background-color: #fff;
}

input[type="checkbox"]:checked::before { 
    transform: scale(1); 
}

input[type="checkbox"]:checked {
    border-width: 2px;
}

/* MODE SELECTORS */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 5px;
}

/* --- CANVAS --- */
#canvas-container {
    position: fixed;
    top: 60px;
    left: 300px;
    right: 0;
    bottom: 0;
    overflow: hidden;
    cursor: none;
    transition: left 0.3s ease;
}

body.frozen-mode #canvas-container {
    cursor: default;
}

@media (max-width: 800px) {
    #canvas-container { left: 0; top: 50px; }
}

/* LOADING SCREEN */
#loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: opacity 0.5s ease;
}

body.dark-mode #loader {
    background: #000;
    color: #fff;
}

#loader::after {
    content: "";
    width: 40px;
    height: 40px;
    margin-top: 20px;
    border: 2px solid #000;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

body.dark-mode #loader::after {
    border: 2px solid #fff;
    border-top: 2px solid transparent;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* TOAST NOTIFICATIONS */
#toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    background: #000;
    color: #fff;
    padding: 15px 20px;
    border-radius: 0;
    font-size: 12px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 100%;
    word-break: break-word;
}

body.dark-mode .toast {
    background: #fff;
    color: #000;
    border-left: 4px solid #000;
}

.toast.warning { border-left-color: #ff9800; }
.toast.success { border-left-color: #4caf50; }
.toast.error { border-left-color: #f44336; }
.toast.info { border-left-color: #2196f3; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* MOBILE TOGGLE */
#mobile-toggle-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #000;
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    font-size: 28px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

body.dark-mode #mobile-toggle-btn {
    background: #fff;
    color: #000;
}

#mobile-toggle-btn:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

@media (max-width: 800px) {
    #mobile-toggle-btn { display: flex; }
}

/* PERFORMANCE INDICATOR */
#performance-indicator {
    position: fixed;
    bottom: 25px;
    left: 25px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 15px;
    font-size: 11px;
    z-index: 100;
    display: none;
    border: 1px solid #000;
    font-family: monospace;
}

body.dark-mode #performance-indicator {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border: 1px solid #fff;
}

#performance-indicator.low {
    background: rgba(244, 67, 54, 0.9);
    color: #fff;
}

/* KEYBOARD SHORTCUTS HINT */
#shortcuts-hint {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 10px;
    font-size: 10px;
    z-index: 100;
    display: none;
    border: 1px solid #000;
}

body.dark-mode #shortcuts-hint {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border: 1px solid #fff;
}