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

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

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

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.drawing-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.drawing-selector select {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    background: white;
    color: #667eea;
    transition: all 0.2s;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

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

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

/* Toolbar */
.toolbar {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e5e5;
    overflow-y: auto;
    padding: 1rem;
}

.toolbar-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

.toolbar-section:last-child {
    border-bottom: none;
}

.toolbar-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Groups */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: #666;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.form-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
}

/* Tool Buttons */
.tool-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    border: 2px solid #e5e5e5;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.tool-btn .icon {
    font-size: 1.5rem;
}

.tool-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.tool-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Furniture List */
.furniture-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.furniture-item {
    padding: 0.5rem;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.furniture-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.furniture-item.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-buttons .btn {
    width: 100%;
    justify-content: flex-start;
}

/* Dimensions Info */
.dimensions-info {
    font-size: 0.85rem;
    line-height: 1.6;
}

.dimensions-info p {
    margin-bottom: 0.25rem;
}

.dimensions-info strong {
    color: #667eea;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background: #fafafa;
    overflow: hidden;
}

#floorPlanCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

#floorPlanCanvas.grab {
    cursor: grab;
}

#floorPlanCanvas.grabbing {
    cursor: grabbing;
}

#floorPlanCanvas.pointer {
    cursor: pointer;
}

#floorPlanCanvas.move {
    cursor: move;
}

/* Canvas Info */
.canvas-info {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.canvas-info span {
    color: #666;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    min-width: 150px;
    z-index: 1000;
}

.context-menu button {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
}

.context-menu button:hover {
    background: #f5f5f5;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Scrollbar Styling */
.toolbar::-webkit-scrollbar {
    width: 8px;
}

.toolbar::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.toolbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.toolbar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .toolbar {
        width: 240px;
    }
    
    .app-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .drawing-selector {
        flex-wrap: wrap;
    }
}
