* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 1rem;
    padding: 1rem;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
}

.sidebar-header h2 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-left {
    overflow-y: auto;
}

.sidebar-left::-webkit-scrollbar {
    width: 8px;
}

.sidebar-left::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.sidebar-left::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar-left::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Component Section */
.component-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.component-section:last-child {
    border-bottom: none;
}

.component-section h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.component-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.component-item {
    padding: 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    user-select: none;
}

.component-item:hover {
    background: var(--border-color);
    border-color: var(--primary-color);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.component-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.component-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-hover);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--border-color);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.upload-area p {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.upload-area span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.canvas-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
}

.canvas-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.canvas-controls {
    display: flex;
    gap: 0.5rem;
}

.canvas {
    flex: 1;
    position: relative;
    background: 
        linear-gradient(90deg, var(--bg-dark) 1px, transparent 1px),
        linear-gradient(var(--bg-dark) 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: var(--bg-darker);
    overflow: auto;
    padding: 2rem;
    min-height: 100%;
}

.canvas-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}

.canvas-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.canvas-placeholder p {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.canvas-placeholder span {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Draggable Elements */
.draggable-element {
    position: absolute;
    cursor: move;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.draggable-element:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.draggable-element.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}

.draggable-element .element-controls {
    position: absolute;
    top: -30px;
    left: 0;
    display: none;
    gap: 0.25rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

.draggable-element.selected .element-controls {
    display: flex;
}

.element-controls button {
    padding: 0.25rem 0.5rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.element-controls button:hover {
    background: var(--danger-color);
}

/* Element Types */
.element-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 120px;
    text-align: center;
}

.element-progress {
    width: 300px;
    height: 30px;
    background: var(--bg-hover);
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.element-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 50%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.element-text {
    padding: 0.5rem 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    min-width: 150px;
    text-align: center;
}

.element-iframe {
    width: 400px;
    height: 300px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.element-iframe i {
    font-size: 2rem;
}

/* Properties Panel */
.sidebar-right {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.properties-panel {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.empty-properties {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-properties i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.property-group {
    margin-bottom: 1.5rem;
}

.property-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.property-group input,
.property-group select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.property-group input:focus,
.property-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.property-group input[type="color"] {
    height: 50px;
    cursor: pointer;
}

.property-group input[type="range"] {
    width: 100%;
}

.property-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Image Upload Area */
.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-hover);
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--border-color);
}

.image-upload-area i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.image-upload-area p {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.image-upload-area span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.image-upload-area .preview-image {
    max-width: 100%;
    max-height: 150px;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    object-fit: contain;
}

.btn-remove-image {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-remove-image:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Config Panel */
.config-panel {
    border-bottom: 2px solid var(--border-color);
    padding: 1.5rem;
    background: var(--bg-dark);
    order: -1;
}

/* Config in Modal */
#configModal .config-form {
    padding: 0;
}

.config-header {
    margin-bottom: 1.5rem;
}

.config-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-large {
    width: 90%;
    height: 90%;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow: auto;
}

/* Preview Window */
.preview-window {
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    border-radius: 0.5rem;
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

/* Export Options */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.export-btn {
    padding: 1.5rem;
    background: var(--bg-hover);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.export-btn:hover {
    border-color: var(--primary-color);
    background: var(--border-color);
    transform: translateX(10px);
}

.export-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 1400px) {
    .sidebar {
        width: 250px;
    }
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 300px;
    }
    
    .canvas {
        min-height: 400px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success Message */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

