/* Elementic Demo - Styles */

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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-dark: #1a1a2e;
    --bg-light: #f0f2f5;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-light);
    color: var(--text);
    line-height: 1.5;
}

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

/* Header */
.app-header {
    background: var(--bg-dark);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.toolbar {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

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

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

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
}

.icon {
    font-size: 1rem;
}

/* Status Bar */
.status-bar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
}

.status-indicator.status-success { background: var(--success); }
.status-indicator.status-error { background: var(--error); }
.status-indicator.status-warning { background: var(--warning); }
.status-indicator.status-loading {
    background: var(--primary);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tenant-badge {
    background: var(--bg-light);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

/* Editor Container */
.editor-container {
    flex: 1;
    position: relative;
    background: white;
    border-right: 1px solid var(--border);
}

.editor-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ed 100%);
}

.placeholder-content {
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.placeholder-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.placeholder-content p {
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.placeholder-note {
    font-size: 0.75rem;
    opacity: 0.7;
}

#elementor-frame {
    width: 100%;
    height: 100%;
    border: none;
}

#elementor-frame.hidden,
.hidden {
    display: none !important;
}

/* Loading Overlay */
#loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Side Panel */
.side-panel {
    width: 280px;
    background: white;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.panel-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Template List */
.template-list {
    list-style: none;
}

.template-list li {
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.template-list li:hover {
    background: var(--bg-light);
}

.template-list li.empty-state {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.template-list li.empty-state:hover {
    background: none;
}

.template-id {
    font-weight: 500;
}

.template-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Log Container */
.log-container {
    background: #1e1e1e;
    border-radius: 4px;
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.7rem;
}

.log-entry {
    padding: 0.125rem 0;
    color: #ccc;
}

.log-entry.log-success { color: #4ade80; }
.log-entry.log-error { color: #f87171; }
.log-entry.log-warning { color: #fbbf24; }
.log-entry.log-debug { color: #94a3b8; }
.log-entry.log-loading { color: #818cf8; }

/* Config Form */
.config-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.config-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.config-form input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
}

.config-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Footer */
.app-footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.export-section {
    margin-bottom: 1.5rem;
}

.export-section h4 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.asset-list {
    list-style: none;
}

.asset-list li {
    padding: 0.5rem;
    background: var(--bg-light);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
}

.asset-name {
    font-weight: 500;
}

.asset-type {
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.625rem;
    text-transform: uppercase;
}

.asset-link {
    color: var(--primary);
    text-decoration: none;
}

.asset-link:hover {
    text-decoration: underline;
}

.asset-target {
    color: var(--text-muted);
    flex-basis: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .side-panel {
        width: 100%;
        max-height: 300px;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .btn span:not(.icon) {
        display: none;
    }
}
