/* Live Preview Styles */

.live-preview-container {
    position: fixed;
    bottom: -60vh;
    left: 0;
    right: 0;
    height: 60vh;
    z-index: 1050;
    transition: bottom 0.3s ease;
    background: var(--card-bg, #ffffff);
    border-top: 1px solid var(--border-color, #e2e2e2);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.live-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--card-bg, #ffffff);
}

.live-preview.visible {
    bottom: 0;
}

.live-preview-container .live-preview.visible {
    transform: translateY(-60vh);
}

/* Preview Header */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #e2e2e2);
    padding: 0;
    height: 48px;
    flex-shrink: 0;
}

.preview-tabs {
    display: flex;
    height: 100%;
}

.preview-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 100%;
    background: none;
    border: none;
    border-right: 1px solid var(--border-color, #e2e2e2);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--text-color-secondary, #666666);
}

.preview-tab.active {
    background: var(--card-bg, #ffffff);
    color: var(--primary-color, #007bff);
    border-bottom: 2px solid var(--primary-color, #007bff);
}

.preview-tab:hover:not(.active) {
    background: var(--hover-bg, #f0f0f0);
    color: var(--text-color, #333333);
}

.preview-tab svg {
    width: 16px;
    height: 16px;
}

/* Preview Controls */
.preview-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
}

.preview-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: var(--text-color-secondary, #666666);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-btn:hover {
    background: var(--hover-bg, #f0f0f0);
    color: var(--text-color, #333333);
}

.preview-btn:active {
    transform: scale(0.95);
}

/* Preview Content */
.preview-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.preview-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.preview-view.active {
    display: flex;
    flex-direction: column;
}

/* Preview View */
.preview-iframe-container {
    flex: 1;
    position: relative;
    background: #ffffff;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

.preview-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #ffffff);
    z-index: 1;
}

.placeholder-content {
    text-align: center;
    color: var(--text-color-secondary, #666666);
}

.placeholder-content svg {
    opacity: 0.5;
    margin-bottom: 16px;
}

.placeholder-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.placeholder-content p {
    margin: 0;
    font-size: 14px;
}

/* Console View */
#console-view {
    background: var(--console-bg, #1e1e1e);
    color: var(--console-text, #ffffff);
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--console-header-bg, #2d2d2d);
    border-bottom: 1px solid var(--console-border, #404040);
    font-size: 14px;
    font-weight: 600;
}

.console-clear {
    background: none;
    border: 1px solid var(--console-border, #404040);
    color: var(--console-text, #ffffff);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.console-clear:hover {
    background: var(--console-hover, #404040);
}

.console-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.console-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--console-text-secondary, #888888);
    font-style: italic;
}

.console-message {
    display: flex;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
    word-break: break-all;
}

.console-message:hover {
    background: var(--console-hover, #2d2d2d);
}

.console-timestamp {
    color: var(--console-timestamp, #888888);
    font-size: 11px;
    white-space: nowrap;
    min-width: 60px;
}

.console-type {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    min-width: 40px;
}

.console-text {
    flex: 1;
    white-space: pre-wrap;
}

/* Console Message Types */
.console-log .console-type {
    color: var(--console-log, #61dafb);
}

.console-error .console-type {
    color: var(--console-error, #ff6b6b);
}

.console-warn .console-type {
    color: var(--console-warn, #ffd93d);
}

.console-info .console-type {
    color: var(--console-info, #6bcf7f);
}

.console-error {
    background: var(--console-error-bg, #332222);
    border-left: 3px solid var(--console-error, #ff6b6b);
}

.console-warn {
    background: var(--console-warn-bg, #333322);
    border-left: 3px solid var(--console-warn, #ffd93d);
}

/* Preview Status Bar */
.preview-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--status-bar-bg, #f8f9fa);
    border-top: 1px solid var(--border-color, #e2e2e2);
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-color-secondary, #666666);
    height: 32px;
    flex-shrink: 0;
}

#preview-status {
    font-weight: 500;
}

#preview-files {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Responsive Design */
@media (max-width: 768px) {
    .live-preview-container {
        height: 70vh;
        bottom: -70vh;
    }
    
    .live-preview-container .live-preview.visible {
        transform: translateY(-70vh);
    }
    
    .preview-header {
        padding: 0 8px;
    }
    
    .preview-tab {
        padding: 0 12px;
        font-size: 13px;
    }
    
    .preview-controls {
        padding: 0 8px;
    }
    
    .preview-status-bar {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .console-message {
        flex-direction: column;
        gap: 4px;
    }
    
    .console-timestamp,
    .console-type {
        min-width: auto;
    }
}

/* Dark Theme Support */
.dark-theme .live-preview-container,
.dark-theme .live-preview {
    --card-bg: #1a1a1a;
    --header-bg: #2d2d2d;
    --status-bar-bg: #2d2d2d;
    --text-color: #ffffff;
    --text-color-secondary: #b0b0b0;
    --border-color: #404040;
    --hover-bg: #2d2d2d;
    --console-bg: #0f0f0f;
    --console-text: #ffffff;
    --console-header-bg: #1a1a1a;
    --console-border: #333333;
    --console-hover: #262626;
    --console-text-secondary: #666666;
    --console-timestamp: #888888;
    --console-log: #61dafb;
    --console-error: #ff6b6b;
    --console-warn: #ffd93d;
    --console-info: #6bcf7f;
    --console-error-bg: #2a1a1a;
    --console-warn-bg: #2a2a1a;
}

/* Loading States */
.preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.dark-theme .preview-loading {
    background: rgba(26, 26, 26, 0.9);
}

.preview-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, #e2e2e2);
    border-top: 3px solid var(--primary-color, #007bff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Quick Preview Toggle */
.quick-preview-btn {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--secondary-color, #6c757d);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
    transition: all 0.3s ease;
    z-index: 997;
}

.quick-preview-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.quick-preview-btn.active {
    background: var(--primary-color, #007bff);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Animations */
@keyframes slideUpPreview {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.live-preview.visible {
    animation: slideUpPreview 0.3s ease;
}

/* Scrollbar Styling */
.console-content::-webkit-scrollbar {
    width: 8px;
}

.console-content::-webkit-scrollbar-track {
    background: var(--console-bg, #1e1e1e);
}

.console-content::-webkit-scrollbar-thumb {
    background: var(--console-border, #404040);
    border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb:hover {
    background: var(--console-hover, #555555);
}

/* Error Handling */
.preview-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--error-bg, #fff5f5);
    color: var(--error-color, #dc3545);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.preview-error h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.preview-error p {
    margin: 0;
    font-size: 14px;
    opacity: 0.8;
}