@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent: #f43f5e;
    --success: #10b981;
    --warning: #fbbf24;
    --bg-dark: #020617;
    --card-bg: rgba(15, 23, 42, 0.7);
    --sidebar-bg: rgba(7, 10, 25, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --z-ui: 1000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    display: flex;
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Left Sidebar - High Level Tools */
.tool-rail {
    width: 70px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 20px;
    z-index: var(--z-ui);
}

.rail-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.2rem;
}

.rail-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.rail-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Center Content */
.editor-canvas-area {
    flex: 1;
    position: relative;
    background-color: #050505;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Toolbar */
.top-bar {
    height: 60px;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    z-index: 100;
}

.app-logo {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-logo span {
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: default;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    image-rendering: auto;
}

/* Right Property Panel */
.prop-sidebar {
    width: 340px;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    padding: 24px;
    gap: 24px;
    scrollbar-width: none;
}

.prop-sidebar::-webkit-scrollbar {
    display: none;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

/* Control Components */
.group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.label-val {
    font-size: 0.8rem;
    color: var(--primary);
    font-family: monospace;
}

/* Enhanced sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    border: 2px solid white;
}

/* Modern Segmented Control */
.btn-toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    gap: 4px;
}

.btn-mode {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.btn-mode i {
    font-size: 1rem;
}

.btn-mode:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.btn-mode.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-mode[data-mode="erase"].active {
    background: var(--accent);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-mode[data-mode="restore"].active {
    background: var(--success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* V4 Buttons */
.btn-v4 {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-v4-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-v4-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    background: #4f46e5;
}

.btn-v4-primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-v4-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-v4-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: white;
}

/* Preset Selectors */
.preset-flex {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.preset-flex::-webkit-scrollbar {
    display: none;
}

.bg-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.bg-dot.active {
    border-color: var(--primary);
    transform: scale(1.15);
    box-shadow: 0 0 10px var(--primary-glow);
}

.bg-dot-trans {
    background: linear-gradient(45deg, #444 25%, transparent 25%), linear-gradient(-45deg, #444 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #444 75%), linear-gradient(-45deg, transparent 75%, #444 75%);
    background-size: 8px 8px;
}

/* Overlays */
.dropzone-v4 {
    position: absolute;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    transition: all 0.5s ease;
}

.dropzone-v4.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

.upload-box {
    width: 500px;
    padding: 60px;
    border-radius: 40px;
    background: rgba(15, 23, 42, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    text-align: center;
    transition: var(--transition);
}

.upload-box:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Status Toast - Professional Style */
.status-indicator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    padding: 16px 24px;
    border-radius: 16px;
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s var(--transition);
}

.status-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Progress Bar */
.progress-ring {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rotate-v4 1s linear infinite;
}

@keyframes rotate-v4 {
    to {
        transform: rotate(360deg);
    }
}

/* Floating UI Hints */
.floating-hints {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    padding: 10px 30px;
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mouse-icon {
    width: 14px;
    height: 20px;
    border: 2px solid currentColor;
    border-radius: 7px;
    position: relative;
    opacity: 0.8;
}

.mouse-icon::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 5px;
    background: currentColor;
    border-radius: 1px;
}

.mouse-icon.left-active::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 8px;
    height: 10px;
    background: var(--primary);
    border-radius: 5px 0 0 0;
    opacity: 0.6;
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-family: inherit;
    font-weight: 700;
}