:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background: #fafafa;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --font-family: 'Cal Sans', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-primary);
    overflow: hidden;
}

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

/* Pill Button Styles */
.pill-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow);
}

.pill-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.pill-btn.primary {
    background: var(--primary-color);
    color: white;
}

.pill-btn.secondary {
    background: var(--secondary-color);
    color: white;
}

.pill-btn.mini {
    padding: 6px 12px;
    font-size: 12px;
}

.pill-btn.active {
    background: var(--accent-color);
    color: white;
}

/* Header */
.header-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 12px;
}

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

/* Sidebar Pills */
.sidebar-pill {
    width: 280px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar-pill.collapsed {
    width: 60px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* Component Grid */
.component-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 16px;
}

.component-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: grab;
    transition: all 0.2s ease;
    background: var(--surface);
}

.component-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.component-item i {
    font-size: 24px;
    color: var(--secondary-color);
}

.component-item span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Canvas */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.device-selector {
    display: flex;
    gap: 4px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-level {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.canvas-wrapper {
    flex: 1;
    overflow: auto;
    padding: 24px;
    background: #f8fafc;
}

.canvas {
    min-height: 600px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    transition: all 0.3s ease;
}

.drop-zone {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
}

.drop-zone i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.drop-zone p {
    font-size: 16px;
    opacity: 0.7;
}

/* Properties Panel */
.properties-panel {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.no-selection {
    text-align: center;
    color: var(--text-secondary);
    padding: 32px 16px;
}

.no-selection i {
    font-size: 32px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Bottom Toolbar */
.bottom-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow);
}

.toolbar-section {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-indicator i {
    color: var(--success-color);
    font-size: 8px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    font-size: 20px;
    transition: all 0.2s ease;
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

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

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 24px;
}

.help-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.help-section ul {
    list-style: none;
    padding-left: 0;
}

.help-section li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

kbd {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .sidebar-pill {
        width: 100%;
        height: 200px;
    }
    
    .component-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .canvas-wrapper {
        padding: 16px;
    }
    
    .header-pill {
        padding: 12px 16px;
    }
    
    .bottom-toolbar {
        padding: 12px 16px;
    }
}

/* Element Selection and Editing */
.canvas-element {
    position: relative;
    min-height: 40px;
    margin: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.canvas-element:hover {
    outline: 2px dashed var(--accent-color);
    outline-offset: 2px;
}

.canvas-element.selected {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.canvas-element.selected::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 4px;
    pointer-events: none;
}

/* Drag and Drop */
.canvas.drag-over {
    background: rgba(14, 165, 233, 0.05);
    border: 2px dashed var(--accent-color);
}

.drag-placeholder {
    height: 2px;
    background: var(--accent-color);
    margin: 4px 0;
    border-radius: 1px;
    opacity: 0.8;
}

/* Property Editor Styles */
.property-group {
    margin-bottom: 20px;
}

.property-group h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.property-field {
    margin-bottom: 12px;
}

.property-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.property-field input,
.property-field select,
.property-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-family);
    background: var(--surface);
    transition: all 0.2s ease;
}

.property-field input:focus,
.property-field select:focus,
.property-field textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.color-picker {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-picker input[type="color"] {
    width: 40px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.property-field input[type="range"] {
    -webkit-appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.property-field input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
}

