/* ============================================
   Josh Plan - Modern Floor Plan Measurement App
   ============================================ */

:root {
    /* Color Palette - Warm Industrial */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --bg-elevated: #2a2a2a;
    
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    
    /* Modern gradient accents - Red to Orange (Warm & Energetic) - ACTIVE */
    --accent-primary: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    --accent-secondary: linear-gradient(135deg, #dc2626 0%, #fb923c 100%);
    --accent-glow: rgba(239, 68, 68, 0.4);
    
    /* Fallback solid colors for non-gradient contexts */
    --accent-primary-solid: #ef4444;
    --accent-secondary-solid: #f97316;
    
    /* Alternative color schemes (uncomment to use):
    
    Option 2: Cyan to Purple (Cyberpunk)
    --accent-primary: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    --accent-secondary: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    --accent-glow: rgba(0, 212, 255, 0.4);
    --accent-primary-solid: #00d4ff;
    --accent-secondary-solid: #7c3aed;
    
    Option 3: Blue to Pink (Modern)
    --accent-primary: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%);
    --accent-secondary: linear-gradient(135deg, #2563eb 0%, #f472b6 100%);
    --accent-glow: rgba(59, 130, 246, 0.4);
    --accent-primary-solid: #3b82f6;
    --accent-secondary-solid: #ec4899;
    
    Option 4: Green to Cyan (Fresh)
    --accent-primary: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --accent-secondary: linear-gradient(135deg, #059669 0%, #0891b2 100%);
    --accent-glow: rgba(16, 185, 129, 0.4);
    --accent-primary-solid: #10b981;
    --accent-secondary-solid: #06b6d4;
    
    Option 5: Purple to Blue (Royal)
    --accent-primary: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --accent-secondary: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    --accent-glow: rgba(139, 92, 246, 0.4);
    --accent-primary-solid: #8b5cf6;
    --accent-secondary-solid: #3b82f6;
    */
    
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    
    --border-color: #333333;
    --border-subtle: #2a2a2a;
    
    /* Typography */
    --font-main: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Space Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Borders */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

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

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.logo svg {
    flex-shrink: 0;
    color: var(--accent-primary-solid);
}

.logo span {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--accent-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar Sections */
.sidebar-section {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-tertiary);
}

.upload-zone:hover {
    border-color: var(--accent-primary-solid);
    background: rgba(232, 168, 73, 0.05);
}

.upload-zone.drag-over {
    border-color: var(--accent-primary-solid);
    background: rgba(232, 168, 73, 0.1);
    transform: scale(1.02);
}

.upload-content svg {
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    transition: color var(--transition-normal);
}

.upload-zone:hover .upload-content svg {
    color: var(--accent-primary-solid);
}

.upload-content p {
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.upload-content span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
}

.file-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-primary-solid);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scale Controls */
.scale-controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.scale-input-group {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
}

.scale-input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.input-row {
    display: flex;
    gap: var(--spacing-sm);
}

.scale-input-group input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.scale-input-group input:focus {
    outline: none;
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.scale-tip {
    display: block;
    margin-top: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.scale-display {
    background: linear-gradient(135deg, rgba(232, 168, 73, 0.1), rgba(232, 168, 73, 0.05));
    border: 1px solid rgba(232, 168, 73, 0.3);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
}

.scale-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
}

.scale-value strong {
    color: var(--accent-primary-solid);
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

/* Elements Grid */
.elements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.element-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.element-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.element-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.element-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary-solid);
    color: var(--bg-primary);
    box-shadow: var(--shadow-glow);
}

.element-btn svg {
    flex-shrink: 0;
}

.element-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

.tool-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tool-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tool-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary-solid);
    color: var(--bg-primary);
    box-shadow: var(--shadow-glow);
}

/* Rooms List */
.rooms-list {
    flex: 1;
    overflow-y: auto;
}

.rooms-list::-webkit-scrollbar {
    width: 6px;
}

.rooms-list::-webkit-scrollbar-track {
    background: transparent;
}

.rooms-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.empty-state {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: var(--spacing-xs);
}

.empty-state small {
    font-size: 0.8rem;
}

.room-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.room-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

.room-item.selected {
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.room-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

/* Color picker pour les pièces */
.room-color-picker {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.room-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.room-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.room-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}

.room-color-picker:hover {
    border-color: var(--accent-primary-solid);
    transform: scale(1.1);
}

.room-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Actions des pièces */
.room-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.room-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    line-height: 1;
}

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

.room-visibility:hover {
    color: var(--info);
    background: rgba(96, 165, 250, 0.1);
}

.room-edit:hover {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
}

.room-delete:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
}

/* État pièce masquée */
.room-item.hidden-room {
    opacity: 0.5;
}

.room-item.hidden-room .room-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* État pièce en édition */
.room-item.editing {
    border-color: var(--warning);
    background: rgba(251, 191, 36, 0.08);
}

.room-item.editing .room-edit {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.2);
}

.room-stats {
    display: flex;
    gap: var(--spacing-lg);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.room-stats strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.room-height-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.room-height-section label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.room-height-input {
    flex: 1;
    max-width: 120px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: all var(--transition-fast);
}

.room-height-input:focus {
    outline: none;
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-elevated);
}

.room-height-input:hover {
    border-color: var(--accent-primary-solid);
    background: var(--bg-elevated);
}

.room-height-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.room-windows {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.window-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.window-item span {
    font-family: var(--font-mono);
    color: var(--info);
}

.window-header,
.door-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    width: 100%;
}

.window-name,
.door-name {
    font-family: var(--font-mono);
    font-weight: 500;
    flex: 1;
}

.window-room,
.door-room {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.window-item.editing,
.door-item.editing {
    border-color: var(--warning);
    background: rgba(251, 191, 36, 0.08);
}

.window-btn,
.door-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    line-height: 1;
}

.window-btn:hover,
.door-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.window-edit:hover,
.door-edit:hover {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
}

.window-delete:hover,
.door-delete:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
}

.window-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    line-height: 1;
}

.window-delete:hover {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}

.room-doors {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.door-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.door-item span {
    font-family: var(--font-mono);
    color: #f97316;
}

.door-item.selected {
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 2px var(--accent-glow);
    background: rgba(232, 168, 73, 0.1);
}

.door-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.door-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    line-height: 1;
}

.door-delete:hover {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}

.door-associate {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    line-height: 1;
}

.door-associate:hover {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.doors-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.doors-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.unassociated-doors {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.unassociated-doors .door-item {
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.unassociated-doors .door-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

.window-item.selected {
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 2px var(--accent-glow);
    background: rgba(232, 168, 73, 0.1);
}

.window-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.window-associate {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    line-height: 1;
}

.window-associate:hover {
    background: rgba(96, 165, 250, 0.1);
    color: var(--info);
}

.windows-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.windows-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.unassociated-windows {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.unassociated-windows .window-item {
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.unassociated-windows .window-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

.rooms-total {
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rooms-total strong {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--accent-primary-solid);
}

/* ============================================
   Right Panel - Rooms
   ============================================ */
.right-panel {
    width: 300px;
    min-width: 300px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.3s ease, min-width 0.3s ease, margin-right 0.3s ease;
}

.right-panel.collapsed {
    width: 0;
    min-width: 0;
    border-left: none;
}

.right-panel.collapsed .panel-content {
    opacity: 0;
    pointer-events: none;
}

.right-panel.collapsed .panel-toggle svg {
    transform: rotate(180deg);
}

.panel-toggle {
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    z-index: 10;
}

.panel-toggle:hover {
    background: var(--bg-elevated);
    color: var(--accent-primary-solid);
}

.panel-toggle svg {
    transition: transform 0.3s ease;
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

.panel-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.elements-tabs {
    display: flex;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-md);
}

.tab-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-align: center;
}

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

.tab-btn.active {
    color: var(--accent-primary-solid);
    border-bottom-color: var(--accent-primary-solid);
    background: var(--bg-tertiary);
}

.elements-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.windows-list,
.doors-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.right-panel .rooms-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.windows-list,
.doors-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.windows-list .window-item,
.doors-list .door-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.windows-list .window-item:hover,
.doors-list .door-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

.windows-list .window-item.selected,
.doors-list .door-item.selected {
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.windows-list .window-item.editing,
.doors-list .door-item.editing {
    border-color: var(--warning);
    background: rgba(251, 191, 36, 0.08);
}

.windows-list .window-item .window-header,
.doors-list .door-item .door-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    width: 100%;
}

.windows-list .window-item .window-name,
.doors-list .door-item .door-name {
    font-family: var(--font-mono);
    font-weight: 500;
    flex: 1;
    color: var(--info);
}

.doors-list .door-item .door-name {
    color: #f97316;
}

.windows-list .window-item .window-room,
.doors-list .door-item .door-room {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: auto;
    margin-right: var(--spacing-sm);
}

.right-panel .rooms-total {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

/* ============================================
   Canvas Area
   ============================================ */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.zoom-controls span {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    min-width: 50px;
    text-align: center;
}

.toolbar-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.toolbar-info .hint {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.cursor-pos {
    display: flex;
    gap: var(--spacing-md);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: 
        radial-gradient(circle at 50% 50%, var(--bg-tertiary) 0%, var(--bg-primary) 100%),
        repeating-linear-gradient(0deg, transparent, transparent 40px, var(--border-subtle) 40px, var(--border-subtle) 41px),
        repeating-linear-gradient(90deg, transparent, transparent 40px, var(--border-subtle) 40px, var(--border-subtle) 41px);
}

.canvas-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--shadow-lg);
}

#pdfCanvas {
    display: block;
    background: #1e1e1e;
    image-rendering: auto;
}

#drawCanvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
}

/* Zoom fluide - pas de transition pour éviter le décalage des dessins */

/* Empty Canvas State */
.empty-canvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-xl);
}

.empty-canvas[hidden] {
    display: none;
}

.empty-illustration {
    color: var(--text-muted);
    margin-bottom: var(--spacing-xl);
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-canvas h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary-solid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-canvas p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    max-width: 400px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-secondary);
    box-shadow: var(--shadow-glow);
}

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

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent-primary-solid);
    color: var(--accent-primary-solid);
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: white;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-primary-solid);
    cursor: pointer;
    font-size: 0.85rem;
    padding: var(--spacing-xs);
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.85rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    transition: all var(--transition-fast);
}

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

.btn-icon.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary-solid);
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.form-group input {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.color-input-wrapper input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
    transition: all var(--transition-fast);
}

.color-input-wrapper input[type="color"]:hover {
    border-color: var(--accent-primary-solid);
    transform: scale(1.05);
}

.color-input-wrapper input[type="color"]:focus {
    outline: none;
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.color-input-wrapper span {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    min-width: 80px;
    text-align: center;
}

.color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    position: relative;
}

.color-preset-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    background: none;
    position: relative;
}

.color-preset-btn:hover {
    transform: scale(1.15);
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 2px var(--accent-glow);
    z-index: 1;
}

.color-preset-btn:active {
    transform: scale(1.05);
}

.color-more-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.color-more-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary-solid);
    transform: scale(1.1);
}

.color-popup {
    position: absolute;
    top: calc(100% + var(--spacing-sm));
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 280px;
    max-width: 320px;
}

.color-popup-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-popup-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.color-hex-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.color-hex-input-wrapper label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.color-hex-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--accent-primary-solid);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.color-hex-input::placeholder {
    color: var(--text-muted);
    text-transform: none;
}

.room-preview {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.preview-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
}

.preview-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.preview-item strong {
    font-family: var(--font-mono);
    color: var(--accent-primary-solid);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

.modal-content p {
    margin: 0 0 var(--spacing-lg) 0;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-line;
}

.modal-associate {
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-associate .form-group {
    margin-bottom: var(--spacing-md);
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.room-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-start;
}

.room-card:hover {
    border-color: var(--accent-primary-solid);
    background: var(--bg-elevated);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.room-card.selected {
    border-color: var(--accent-primary-solid);
    background: var(--accent-glow);
}

.room-card-color {
    width: 8px;
    height: 100%;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.room-card-content {
    flex: 1;
    min-width: 0;
}

.room-card-content h4 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-card-stats {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.room-card-badge {
    display: inline-block;
    margin-top: var(--spacing-xs);
    padding: 2px 8px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================
   Toasts
   ============================================ */
.toasts {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.scale-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: var(--bg-secondary);
    border: 3px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: 0;
    font-size: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: scaleAlertIn 0.3s ease, scaleAlertPulse 2s ease-in-out infinite 0.3s;
    min-width: 400px;
    max-width: 600px;
    opacity: 1;
}

@keyframes scaleAlertIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes scaleAlertPulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 8px 40px rgba(239, 68, 68, 0.6);
    }
}

@keyframes scaleAlertOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

.scale-alert-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
}

.scale-alert-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.scale-alert-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.scale-alert-text strong {
    color: var(--danger);
    font-weight: 600;
    font-size: 1.1rem;
    display: block;
}

.scale-alert-text small {
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    flex-shrink: 0;
    opacity: 0.7;
}

.toast-close:hover {
    background: var(--bg-tertiary);
    opacity: 1;
}

.toast.info {
    border-color: var(--info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-width: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .right-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }
    
    .right-panel.collapsed {
        margin-right: -300px;
    }
}

