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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
}

/* Header Styles */
.header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-section, .project-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
}

.input-group input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    min-width: 150px;
}

.input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: #545b62;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.status {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.status.success {
    background-color: #d4edda;
    color: #155724;
}

.status.error {
    background-color: #f8d7da;
    color: #721c24;
}

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

/* Panel Styles */
.panel {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e0e0e0;
    margin: 1rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.left-panel {
    flex: 1;
    min-width: 400px;
}

.right-panel {
    flex: 1;
    min-width: 400px;
}

.panel-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

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

/* JSON Editor */
.json-editor {
    flex: 1;
    padding: 1rem;
    border: none;
    resize: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: #fafafa;
    color: #333;
}

.json-editor:focus {
    outline: none;
    background: white;
}

/* Transform Section */
.transform-section {
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    gap: 1rem;
    align-items: end;
}

.transform-section .input-group {
    flex: 1;
}

/* Render Container */
.render-container {
    flex: 1;
    position: relative;
    background: #fafafa;
}

.render-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Status Bar */
.status-bar {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.status-message {
    color: #666;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-panel, .right-panel {
        min-width: auto;
        margin: 0.5rem;
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .auth-section, .project-section {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .auth-section, .project-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group input {
        min-width: auto;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .panel-controls {
        justify-content: center;
    }
    
    .transform-section {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/Error States */
.success {
    border-color: #28a745;
}

.error {
    border-color: #dc3545;
}

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

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    height: 80%;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.modal-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}



.modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.preview-content {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: white;
}

.preview-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.preview-content img {
    width: 100%;
    height: auto;
    display: block;
}

.preview-content .html-content {
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: #fafafa;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 100%;
    overflow: auto;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        height: 90%;
    }
    
    .modal-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .modal-controls {
        justify-content: center;
    }
}
