/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    overflow: hidden;
    height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo h1 {
    color: #2563eb;
    font-size: 1.5rem;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.btn-secondary:hover {
    background: #4b5563;
}

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

/* Sidebar */
.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.toolbar {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.toolbar h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.tool-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.tool-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.tool-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

/* Asset Library */
.asset-library {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.asset-library h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.asset-categories {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.category-btn {
    flex: 1;
    padding: 0.375rem 0.5rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.category-btn:hover {
    background: #f3f4f6;
}

.category-btn.active {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Furniture Subcategories */
.furniture-subcategories {
    display: none; /* Hidden by default */
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.furniture-subcategories.active {
    display: flex; /* Show when furniture category is selected */
}

.subcategory-btn {
    flex: 1;
    padding: 0.25rem 0.375rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.subcategory-btn:hover {
    background: #f9fafb;
}

.subcategory-btn.active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.asset-item {
    aspect-ratio: 1;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #6b7280;
    transition: all 0.2s;
}

.asset-item:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 1rem 2rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.view-controls {
    display: flex;
    gap: 0.25rem;
}

.view-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.view-btn:hover {
    background: #f3f4f6;
}

.view-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.grid-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    position: absolute;
    right: 2rem;
    padding: 1rem 0;
}


.zoom-btn {
    width: 2rem;
    height: 2rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: #f3f4f6;
}

.zoom-input {
    width: 4rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    text-align: center;
}

.zoom-percent {
    font-size: 0.875rem;
    color: #6b7280;
}

.grid-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.grid-controls label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.grid-controls select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Canvas Wrapper */
.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#floorplan-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    background: #fff;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Properties Panel */
.properties-panel {
    width: 250px;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.properties-panel.collapsed {
    width: 40px;
}

.properties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    min-height: 48px;
}

.properties-panel.collapsed .properties-header {
    justify-content: center;
    padding: 0.75rem;
}

.properties-panel h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
    transition: opacity 0.3s ease;
}

.properties-panel.collapsed h3 {
    display: none;
}

.panel-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.panel-toggle-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

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

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

.property-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    transition: opacity 0.3s ease;
}

.properties-panel.collapsed .property-form {
    opacity: 0;
    pointer-events: none;
}

.property-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.property-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
}

.property-group input,
.property-group select {
    padding: 0.375rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 0.5rem;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.5rem;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.option-group select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .properties-panel {
        width: 200px;
    }

    .properties-panel.collapsed {
        width: 40px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar,
    .properties-panel {
        width: 100%;
        height: auto;
    }

    .properties-panel.collapsed {
        width: 100%;
        height: 40px;
    }

    .properties-panel.collapsed .property-form {
        display: none;
    }

    .properties-panel.collapsed .properties-header {
        padding: 0.5rem;
        min-height: 40px;
    }

    .tool-group {
        grid-template-columns: repeat(6, 1fr);
    }

    .asset-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .panel-toggle-btn {
        margin-left: auto;
    }
}