/* ============================================================
   sticker3d.css - M-Stones 3D Designer Pro
   ============================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #0a0e1a;
    --bg-panel: #141824;
    --bg-section: #1a1f2e;
    --border: #2a3142;
    --accent: #3b82f6;
    --accent-2: #8b5cf6;
    --accent-3: #06b6d4;
    --text: #e5e7eb;
    --text-dim: #9ca3af;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body {
    background: var(--bg-dark);
    color: var(--text);
    font-family: 'Kanit', sans-serif;
    overflow: hidden;
    height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
}

/* ========== HEADER ========== */
.app-header {
    height: 60px;
    background: linear-gradient(90deg, #0f172a 0%, #1e1b4b 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.brand-3d {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

.rotating-cube-icon {
    font-size: 1.8rem;
    color: var(--accent);
    animation: rotateIcon 4s linear infinite;
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
}

@keyframes rotateIcon {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.version-badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-header {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-header:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.btn-export {
    background: linear-gradient(135deg, var(--success), #059669);
    border-color: var(--success);
    color: white;
    font-weight: 600;
}

.btn-export:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-back {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-back:hover {
    background: var(--danger);
    color: white;
}

/* ========== MAIN LAYOUT ========== */
.main-wrapper {
    display: flex;
    height: calc(100vh - 60px);
}

.sidebar {
    width: 300px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 15px;
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid var(--border);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: var(--bg-panel);
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ========== PANELS ========== */
.panel-section {
    background: var(--bg-section);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.panel-title i {
    color: var(--accent-3);
}

/* ========== SHAPE GRID ========== */
.shape-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.shape-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.shape-btn i {
    font-size: 1.4rem;
    color: var(--accent-3);
}

.shape-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.shape-btn:hover i {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.shape-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.shape-btn.active i {
    color: #fff;
}

/* ========== CONTROLS ========== */
.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 5px;
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    accent-color: var(--accent);
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.control-group input[type="color"] {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-dark);
    cursor: pointer;
    padding: 2px;
}

.color-row {
    display: flex;
    gap: 6px;
}

.color-row input[type="color"] {
    flex: 0 0 50px;
}

.hex-input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.range-value {
    display: inline-block;
    float: right;
    font-size: 0.75rem;
    color: var(--accent-3);
    font-weight: 600;
    margin-top: -20px;
    font-family: 'Courier New', monospace;
}

.styled-select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 6px;
    font-family: 'Kanit', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
}

.styled-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ========== TOGGLE SWITCH ========== */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.toggle-row label {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text);
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    transition: 0.3s;
    border-radius: 22px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider-toggle {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

input:checked + .slider-toggle:before {
    transform: translateX(18px);
}

/* ========== WORKSPACE ========== */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    position: relative;
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#canvas3d {
    background: #000;
    border-radius: 8px;
    box-shadow: 
        0 0 40px rgba(59, 130, 246, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: grab;
    max-width: 100%;
    max-height: 100%;
}

#canvas3d:active {
    cursor: grabbing;
}

.canvas-info {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--accent-3);
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

/* ========== BOTTOM TOOLBAR ========== */
.bottom-toolbar {
    height: 80px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    overflow-x: auto;
}

.toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.toolbar-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.toolbar-group input[type="range"] {
    width: 140px;
    accent-color: var(--accent);
}

.toolbar-divider {
    width: 1px;
    height: 50px;
    background: var(--border);
}

/* ========== HELP TEXT ========== */
.help-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.8;
}

.help-text p {
    margin-bottom: 4px;
}

.help-text i {
    color: var(--accent-3);
    width: 16px;
    margin-right: 4px;
}

.help-text b {
    color: var(--text);
}

/* ========== LOADING ========== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    text-align: center;
    color: var(--accent);
}

.loading-spinner i {
    font-size: 4rem;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
}

.loading-spinner p {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    .sidebar {
        width: 260px;
    }
}
/* ========== Texture Grid ========== */
.texture-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.texture-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: all 0.2s;
}

.texture-preview {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    image-rendering: pixelated;
}

.texture-btn:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    transform: translateY(-1px);
}

.texture-btn.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 88, 12, 0.2));
    border-color: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.texture-btn.active span {
    color: #fbbf24;
    font-weight: 600;
}

.custom-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border);
    color: var(--text-dim);
    font-size: 1.2rem;
}

.custom-upload:hover {
    border-color: #f59e0b;
    color: #fbbf24;
}