/* ========================================
   Doccc Baseplate Editor - Main Styles
   ======================================== */

:root {
    /* Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-canvas: #1e1e1e;

    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    --border-color: #30363d;
    --border-subtle: #21262d;

    /* Sizing */
    --toolbar-height: 48px;
    --panel-width: 280px;
    --timeline-height: 160px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ========================================
   Toolbar
   ======================================== */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--toolbar-height);
    padding: 0 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-left {
    flex: 1;
}

.toolbar-right {
    flex: 1;
    justify-content: flex-end;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.logo svg {
    color: var(--accent-primary);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 8px;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent-primary);
    color: white;
}

#baseplate-name {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    width: 240px;
    transition: var(--transition-fast);
}

#baseplate-name:hover {
    border-color: var(--border-color);
}

#baseplate-name:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn svg {
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-accent {
    background: var(--accent-secondary);
    color: white;
}

.btn-accent:hover {
    background: #7c3aed;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ========================================
   Main Container
   ======================================== */

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========================================
   Canvas Area
   ======================================== */

.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-canvas);
    position: relative;
    overflow: hidden;
}

.canvas-controls {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 8px;
}

#zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: auto;
}

#canvas {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    max-width: 100%;
    max-height: 100%;
    transition: box-shadow 0.2s, outline 0.2s;
}

#canvas.drag-over {
    outline: 3px dashed var(--accent-primary);
    outline-offset: 4px;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
}

/* Selection overlay */
#selection-overlay rect,
#selection-overlay circle {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 2;
    stroke-dasharray: 5 5;
}

.selection-handle {
    fill: white;
    stroke: var(--accent-primary);
    stroke-width: 2;
    cursor: pointer;
}

/* ========================================
   Utility Classes
   ======================================== */

.hidden {
    display: none !important;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-muted);
    text-align: center;
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}