* {
    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;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1em;
}

.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: start;
}

.controls-panel {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
}

.controls-panel h2, .controls-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.controls-panel h3 {
    margin-top: 30px;
    font-size: 1.1em;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.control-group input[type="number"],
.control-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.control-group input[type="number"]:focus,
.control-group input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
}

.control-group input[type="number"] + span {
    margin-left: 5px;
    color: #666;
}

.btn-primary, .btn-secondary, .btn-danger {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.preview-area {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.preview-area h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.grid-container {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    min-height: 400px;
    margin-bottom: 30px;
    position: relative;
}

.grid-item {
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 5px;
    cursor: move;
    transition: all 0.3s;
    position: relative;
}

.grid-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.grid-item.selected {
    background: #e74c3c;
    outline: 3px solid #c0392b;
    outline-offset: 2px;
}

.grid-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.drop-zone {
    border: 2px dashed #3498db;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 5px;
}

.code-output {
    margin-top: 30px;
}

.code-output h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.code-output pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.hidden {
    display: none;
}

.item-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
}

.item-controls .control-group {
    margin-bottom: 10px;
}

#selectedItem {
    font-weight: bold;
    color: #3498db;
}

/* Responsive design */
@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        position: static;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .container {
        padding: 10px;
    }
}