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

/* Glassmorphism Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-hover);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: var(--radius);
    color: var(--accent);
}

.nav-center,
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-actions {
    position: relative;
    /* For the export popover */
}

#zoom-level {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 48px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    width: 280px;
    display: flex;
    flex-direction: column;
    z-index: 5;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: opacity 0.3s;
}

body:not(.has-image) .sidebar {
    display: none;
}

body:not(.has-image) .nav-center {
    opacity: 0;
    pointer-events: none;
}

body:not(.has-image) #export-format,
body:not(.has-image) #btn-export,
body:not(.has-image) #btn-batch-toggle,
body:not(.has-image) .nav-actions .divider {
    display: none;
}

.sidebar.properties-sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar.tools-sidebar {
    width: 68px;
    /* Narrow icon sidebar */
    align-items: center;
    padding-top: 16px;
    gap: 8px;
    overflow: visible;
    /* Prevent clipping of floating attribute panels */
}

/* Tool Groups */
.tool-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    position: relative;
    background-color: var(--bg-base);
    background-image:
        linear-gradient(45deg, #1c1f26 25%, transparent 25%),
        linear-gradient(-45deg, #1c1f26 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1c1f26 75%),
        linear-gradient(-45deg, transparent 75%, #1c1f26 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* We manage pan/zoom via JS/Canvas transform */
}

canvas {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: none;
    max-height: none;
    cursor: crosshair;
}

canvas.hidden {
    display: none;
}

canvas.tool-select {
    cursor: move;
}

canvas.tool-crop {
    cursor: crosshair;
}

canvas.tool-pen {
    cursor: default;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    gap: 16px;
    padding: 32px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.empty-state .empty-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    color: var(--text-primary);
}

.empty-state h2 {
    color: var(--text-primary);
    margin: 0;
}

.empty-state button {
    pointer-events: auto;
}