/*
Theme Name: Developer Starter - 3D CMS
Theme URI: https://developer-starter.local
Author: 3D CMS Team
Author URI: https://developer-starter.local
Description: A 3D-first WordPress theme where posts are interactive 3D scenes powered by Babylon.js. Posts open as 3D environments by default.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: developer-starter
*/

/* ==========================================================================
   Base Reset
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ==========================================================================
   3D Scene Container
   ========================================================================== */

.scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
}

#renderCanvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    touch-action: none;
}

/* ==========================================================================
   Loading Screen
   ========================================================================== */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #fff;
    margin-top: 20px;
    font-size: 16px;
    letter-spacing: 1px;
}

.loading-title {
    color: #4a90d9;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
}

/* ==========================================================================
   Control Panel
   ========================================================================== */

.control-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 320px;
    max-height: calc(100vh - 40px);
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: 12px;
    color: #fff;
    font-size: 13px;
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.control-panel-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.control-panel-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.control-panel-body {
    padding: 15px 20px;
}

.control-panel h3 {
    margin: 15px 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    font-weight: 600;
    color: #4a90d9;
}

.control-panel h3:first-child {
    margin-top: 0;
}

/* Control Groups */
.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #aaa;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group input[type="text"],
.control-group input[type="number"],
.control-group select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #4a90d9;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: rgba(74, 144, 217, 0.2);
    border: 1px solid rgba(74, 144, 217, 0.4);
    border-radius: 6px;
    color: #4a90d9;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: rgba(74, 144, 217, 0.3);
    border-color: #4a90d9;
}

.btn-primary {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    border-color: transparent;
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a9fe9 0%, #4589cd 100%);
}

.btn-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.btn-grid .btn {
    padding: 10px 8px;
}

/* Sliders */
.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90d9;
    border-radius: 50%;
    cursor: pointer;
}

.value-display {
    min-width: 50px;
    text-align: right;
    font-family: monospace;
    color: #4a90d9;
}

/* ==========================================================================
   Properties Panel
   ========================================================================== */

.properties-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    max-height: calc(100vh - 40px);
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: 12px;
    color: #fff;
    font-size: 13px;
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(10px);
    display: none;
}

.properties-panel.visible {
    display: block;
}

.properties-panel-header {
    padding: 15px 20px;
    background: rgba(74, 144, 217, 0.2);
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.properties-panel-body {
    padding: 15px 20px;
}

/* ==========================================================================
   Mode Toggle
   ========================================================================== */

.mode-toggle {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: 8px;
    overflow: hidden;
    z-index: 1001;
}

.mode-toggle button {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-toggle button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.mode-toggle button.active {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: #fff;
}

/* ==========================================================================
   2D Mode Specific
   ========================================================================== */

body.mode-2d {
    overflow: auto;
}

body.mode-2d .scene-container {
    position: relative;
    min-height: 100vh;
}

/* ==========================================================================
   SEO Fallback (for crawlers / no-JS)
   ========================================================================== */

.seo-fallback {
    display: none;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    color: #333;
    background: #fff;
}

noscript .seo-fallback {
    display: block;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 768px) {
    .control-panel {
        left: 10px;
        right: 10px;
        width: auto;
        top: auto;
        bottom: 10px;
        max-height: 50vh;
    }

    .properties-panel {
        left: 10px;
        right: 10px;
        width: auto;
        top: 10px;
        max-height: 40vh;
    }

    .mode-toggle {
        top: 10px;
    }
}

/* ==========================================================================
   Admin Bar Adjustment
   ========================================================================== */

body.admin-bar .scene-container,
body.admin-bar .loading-screen {
    top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .scene-container,
    body.admin-bar .loading-screen {
        top: 46px;
        height: calc(100% - 46px);
    }
}

