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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-card);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
}

.logo-text span {
    color: var(--secondary);
}

/* Navigation */
nav {
    display: flex;
    gap: 0.5rem;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
}

nav a:hover, nav a.active {
    color: var(--text-primary);
    background: var(--bg-light);
}

/* Main layout */
.main-container {
    display: flex;
    height: calc(100vh - 65px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
}

.sidebar h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.module-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.module-item {
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.module-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

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

.module-item .icon {
    display: inline-block;
    margin-right: 0.5rem;
}

.module-item .name {
    font-weight: 500;
}

.module-item .desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Canvas area */
.canvas-area {
    flex: 1;
    padding: 1.5rem;
    overflow: auto;
    position: relative;
}

.canvas {
    background: var(--bg-card);
    border-radius: 12px;
    min-height: 100%;
    border: 2px dashed var(--border);
    position: relative;
    padding: 2rem;
}

.canvas.drag-over {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

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

.canvas-placeholder svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Dropped modules */
.dropped-module {
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropped-module.ai-assistant {
    border-color: var(--primary);
}

.dropped-module.crm {
    border-color: var(--secondary);
}

.dropped-module.analytics {
    border-color: var(--accent);
}

.dropped-module.notifications {
    border-color: var(--danger);
}

.dropped-module .module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.dropped-module .module-title {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropped-module .remove-btn {
    background: var(--danger);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: transform 0.2s;
}

.dropped-module .remove-btn:hover {
    transform: scale(1.1);
}

.dropped-module .module-preview {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1rem;
    min-height: 150px;
}

/* AI Assistant preview */
.ai-chat-preview {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 80%;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chat-message.user {
    background: var(--primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    background: var(--bg-light);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-input-preview {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.chat-input-preview input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    outline: none;
}

.chat-input-preview button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-input-preview button:hover {
    background: var(--primary-dark);
}

/* CRM preview */
.crm-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.crm-card {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.crm-card .number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

.crm-card .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Analytics preview */
.analytics-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-bar .label {
    width: 80px;
    font-size: 0.875rem;
}

.chart-bar .bar {
    flex: 1;
    height: 24px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Notifications preview */
.notifications-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-dark);
    border-radius: 8px;
    border-left: 3px solid var(--danger);
}

.notification-item.success {
    border-left-color: var(--secondary);
}

.notification-item.warning {
    border-left-color: var(--accent);
}

.notification-item .icon {
    font-size: 1.25rem;
}

.notification-item .text {
    font-size: 0.875rem;
}

/* Implementation steps */
.implementation-panel {
    width: 320px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
}

.implementation-panel h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-item {
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.step-item .step-number {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.step-item .step-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.step-item .step-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.step-item code {
    display: block;
    margin-top: 0.5rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    overflow-x: auto;
}

/* Empty state */
.empty-steps {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.empty-steps svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.875rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Footer actions */
.canvas-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .implementation-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}
