/* Root theme variables */
:root {
    /* Colors */
    --primary-color: #2196F3;
    --primary-hover: #1976D2;
    --background-light: #ffffff;
    --background-off-white: #f8f9fa;
    --background-hover: #e9ecef;
    --border-color: #dee2e6;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    
    /* Spacing */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    
    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(33, 150, 243, 0.25);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --editor-bg: #282c34;
    --editor-text: #abb2bf;
}

body, html {   
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    overflow: hidden;
}


.container p {
    white-space: normal;
}
.editor-section {
    width: 38%;
    min-width: 200px;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    background-color: var(--background-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.preview-section {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}
.resizer {
    width: 5px;
    background: var(--border-color);
    cursor: col-resize;
    transition: background-color var(--transition-fast);
}
.resizer:hover {
    background: var(--primary-color);
}
.editor-header {
    padding: 10px;
    background-color: #f8f9fa;
    border-bottom: none;
}
.editor-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border-bottom: 1px solid #ccc;
}
#editor {
    flex: 1;
    border: none;
    resize: none;
    font-family: 'Fira Code', monospace;
    line-height: 1.6;
    padding: var(--spacing-md);
    transition: background-color var(--transition-normal);
    background-color: var(--editor-bg);
    color: var(--editor-text);
}
#preview {
    flex: 1;
    width: 100%;
    border: none;
    transition: width 0.3s, height 0.3s;
}
#preview.mobile {
    width: 375px;
    height: 667px;
    margin: 20px auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
#preview.tablet {
    width: 768px;
    height: 1024px;
    margin: 20px auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
#preview.desktop {
    width: 100%;
    height: 100%;
}
select, button, input {
    margin: 5px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}
#languageSelect, #libraryDropdown {
    flex: 1;
    min-width: 120px;
}
#customLibraryUrl {
    flex: 2;
    min-width: 200px;
    background-color: #fff;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    font-size: 14px;
}
#customLibraryUrl::placeholder {
    color: #999;
    font-style: italic;
}
#customLibraryUrl:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.25);
}
#addCustomLibrary, #updateLibraries {
    flex: 0 0 auto;
    white-space: nowrap;
    min-width: 120px;
}
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--background-light);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 1;
    max-height: 300px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    margin-top: 2px;
    border: 1px solid var(--border-color);
}
.dropdown-content label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    transition: background-color 0.2s ease;
    text-align: left;
}
.dropdown-content label input[type="checkbox"] {
    margin-right: 8px;
    margin-left: 0;
}
.dropdown-content label:hover {
    background-color: #f8f9fa;
}
.show {
    display: block;
}

.preview-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--background-off-white);
    border-bottom: 1px solid var(--border-color);
}

/* Tweak controls inside Showroom preview header */
.showroom-preview-header .preview-controls {
    padding: 0;
    background: transparent;
    border: 0;
    gap: 8px;
}

.preview-button {
    background: none;
    border: none;
    font-size: 1.2em;
    margin-left: 10px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.preview-button:hover, .preview-button.active {
    opacity: 1;
    color: var(--primary-color);
}



.login-container button, #logout {
    padding: 5px 10px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.login-container button:hover, #logout:hover {
    background-color: #1976D2;
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-container {
    background: var(--background-light);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 300px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: auto;
    margin: auto;
}

.login-container h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.login-container form {
    width: 100%;
}

.login-container input {
    display: block;
    width: calc(100% - 20px);
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 3px;
}

#errorMessage {
    margin-top: 10px;
    font-size: 14px;
}

.container {
    display: flex;
    opacity: 1;
    transition: opacity 0.3s ease;
    height: 100%;
    text-align: center;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.container.hidden {
    display: none !important;
}

.container.dimmed {
    opacity: 0.5;
    pointer-events: none;
}

#logout {
    margin-left: 20px;
}

.editor-controls button {
    background-color: var(--background-off-white);
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.editor-controls button:hover {
    background-color: var(--background-hover);
    box-shadow: var(--shadow-sm);
}

.editor-controls button:active {
    transform: translateY(1px);
    box-shadow: none;
    background-color: #dee2e6;
}

.editor-controls select {
    cursor: pointer;
    background-color: #f8f9fa;
}

.editor-controls select:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.editor-controls input {
    background-color: #fff;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.editor-controls input:hover {
    border-color: #80bdff;
}

.editor-controls input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.25);
}

#libraryDropdown {
    background-color: #f8f9fa;
    position: relative;
}

#libraryDropdown:after {
    content: '▼';
    font-size: 0.8em;
    margin-left: 5px;
    transition: transform 0.2s ease;
}

#libraryDropdown:hover:after {
    transform: translateY(2px);
}

#libraryDropdown.active {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.dropdown-content {
    border-radius: 4px;
    margin-top: 2px;
    border: 1px solid #dee2e6;
    background-color: #fff;
}

.dropdown-content label {
    padding: 8px 12px;
    transition: background-color 0.2s ease;
}

.dropdown-content label:hover {
    background-color: #f8f9fa;
}

.editor-controls button:focus,
.editor-controls select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.25);
}

.editor-controls button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f1f3f5;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background-color: var(--background-light);
    margin: 5% auto;
    padding: var(--spacing-lg);
    width: 80%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
}

.iframe-options {
    margin: 20px 0;
}

.option-group {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-group label {
    min-width: 100px;
}

.option-group input[type="text"] {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 150px;
}

.export-result {
    margin-top: 20px;
}

.export-result textarea {
    width: 100%;
    height: 100px;
    margin-bottom: 10px;
    padding: 10px;
    font-family: monospace;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: none;
}

#copyIframeCode {
    background-color: #2196F3;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#copyIframeCode:hover {
    background-color: #1976D2;
}

.embed-result textarea {
    width: 100%;
    height: 300px;
    margin: 10px 0;
    padding: 10px;
    font-family: monospace;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    max-height: 50vh;
}

#copyEmbedCode {
    background-color: #2196F3;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#copyEmbedCode:hover {
    background-color: #1976D2;
}

.language-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-off-white);
    justify-content: space-between;
    padding: 0 var(--spacing-sm);
}

.tab-button {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-right: 1px solid #ddd;
    transition: all var(--transition-fast);
    position: relative;
}

.tab-button:hover {
    background: #e9ecef;
    color: #333;
}

.tab-button.active {
    background: #fff;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: opacity var(--transition-fast);
}

.embed-button {
    margin-left: auto;
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border-right: none;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
}

.embed-button:hover {
    color: var(--primary-color);
    transform: translateY(-1px);
}

.embed-button:hover {
    background: none;
    border-bottom: none;
}

.tab-button {
    border-right: 1px solid #ddd;
}

.tab-button:last-of-type {
    border-right: 1px solid #ddd;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

.embed-result {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Project Controls */
.project-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--background-off-white);
    border-bottom: 1px solid var(--border-color);
}

.project-select-group,
.project-action-group {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

#projectSelect {
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

.project-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.project-btn i {
    font-size: 12px;
}

.project-btn:hover {
    background-color: var(--background-hover);
    border-color: var(--primary-color);
}

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

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

.project-btn.danger {
    color: #dc3545;
    border-color: #dc3545;
}

.project-btn.danger:hover {
    background-color: #dc3545;
    color: white;
}

/* Project Modal */
.project-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.project-modal-content {
    background-color: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.project-modal-header {
    margin-bottom: var(--spacing-md);
}

.project-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.project-form-group {
    margin-bottom: var(--spacing-md);
}

.project-form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.project-form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.project-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* Choice Screen Styles */
.choice-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;
}

.choice-container {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    width: 90%;
    text-align: center;
}

.choice-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.choice-container > p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.environment-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.environment-card {
    background: var(--background-off-white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.environment-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.environment-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.environment-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.environment-card ul {
    text-align: left;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.environment-card li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.env-button {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

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

.env-button.primary:hover {
    background-color: var(--primary-hover);
}

.env-button.secondary {
    background-color: #6c757d;
    color: white;
}

.env-button.secondary:hover {
    background-color: #5a6268;
}

.choice-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* Showroom Styles */
.showroom-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--background-off-white);
}

.showroom-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.showroom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.showroom-nav h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.nav-btn:hover {
    background-color: var(--background-hover);
    border-color: var(--primary-color);
}

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

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

.showroom-workspace {
    display: flex;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem;
    gap: 1rem;
}

.showroom-editor-section {
    width: 50%;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.showroom-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-off-white);
}

.showroom-editor-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.editor-controls {
    display: flex;
    gap: 0.5rem;
}

.run-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.run-btn:hover {
    background-color: #218838;
}

.clear-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.clear-btn:hover {
    background-color: #c82333;
}

#react-editor {
    flex: 1;
    border: none;
    resize: none;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 1rem;
    background-color: var(--editor-bg);
    color: var(--editor-text);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.showroom-resizer {
    width: 5px;
    background: var(--border-color);
    cursor: col-resize;
    transition: background-color var(--transition-fast);
    border-radius: var(--radius-sm);
}

.showroom-resizer:hover {
    background: var(--primary-color);
}

.showroom-preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.showroom-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-off-white);
}

.showroom-preview-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.react-preview-container {
    flex: 1;
    padding: 1rem;
    overflow: auto;
    background: white;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Device presets for Showroom preview */
.react-preview-container.mobile {
    width: 375px;
    height: 667px;
    margin: 20px auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.react-preview-container.tablet {
    width: 768px;
    height: 1024px;
    margin: 20px auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.react-preview-container.desktop {
    width: 100%;
    height: 100%;
}

/* Responsive design */
@media (max-width: 768px) {
    .environment-options {
        grid-template-columns: 1fr;
    }
    
    .choice-container {
        padding: 1.5rem;
    }
    
    .choice-container h1 {
        font-size: 2rem;
    }
    
    .showroom-workspace {
        flex-direction: column;
        padding: 0.5rem;
    }
    
    .showroom-editor-section {
        width: 100%;
        height: 50vh;
    }
    
    .showroom-resizer {
        height: 5px;
        width: 100%;
        cursor: row-resize;
    }
    
    .nav-buttons {
        flex-wrap: wrap;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
