/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1e1e1e;
    color: #d4d4d4;
    height: 100vh;
    overflow: hidden;
}

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

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-height: 60px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.logo span {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    display: block;
}

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

.language-selector {
    display: flex;
    align-items: center;
}

.language-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.language-select:hover {
    background: rgba(255, 255, 255, 0.2);
}

.language-select:focus {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.language-select option {
    background: #2d2d30;
    color: white;
    padding: 0.4rem;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.2rem;
}

.zoom-display {
    min-width: 50px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 500;
}

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

.btn, .btn-primary, .btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-color: transparent;
}

.btn-icon {
    padding: 0.5rem;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover, .btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

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

/* Editor Section */
.editor-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 300px;
    background: #252526;
    border-right: 1px solid #3e3e42;
}

.editor-header {
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    padding: 0;
}

.editor-tabs {
    display: flex;
}

.tab {
    background: transparent;
    border: none;
    color: #cccccc;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.tab.active {
    color: #ffffff;
    border-bottom-color: #007acc;
    background: #1e1e1e;
}

.editor-content {
    flex: 1;
    position: relative;
}

.editor {
    height: 100%;
    width: 100%;
}

/* Save Indicator */
.save-indicator {
    position: absolute;
    bottom: 10px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: #4CAF50;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.save-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.save-indicator .save-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Code Tabs System */
.code-tabs-container {
    background: #252526;
    border-bottom: 1px solid #3e3e42;
    padding: 0;
    min-height: 42px;
    max-height: 60px; /* Aumentar para acomodar melhor */
    overflow-x: auto;
    overflow-y: hidden;
    display: block; /* Show by default */
    flex-shrink: 0; /* Não permitir que seja comprimido */
}

/* Show tabs when Code tab is active */
.tab[data-tab="code"].active ~ .content-area .code-tabs-container,
.code-tabs-container.show,
.code-tabs-container {
    display: block !important;
}

.code-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    min-height: 42px;
    flex-wrap: nowrap; /* Não quebrar linha */
    overflow-x: auto; /* Permitir scroll horizontal se necessário */
}

.code-tabs > * {
}

.code-tab {
    display: flex;
    align-items: center;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px 4px 0 0;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #cccccc;
    transition: all 0.2s ease;
    max-width: 200px;
    min-width: 80px;
    position: relative;
    flex-shrink: 0; /* Não permitir que seja comprimido */
    white-space: nowrap; /* Não quebrar texto */
}

.code-tab:hover {
    background: #37373d;
    border-color: #007acc;
}

.code-tab.active {
    background: #1e1e1e;
    border-color: #007acc;
    color: #ffffff;
    border-bottom: 1px solid #1e1e1e;
}

.code-tab .tab-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.code-tab .tab-close {
    background: none;
    border: none;
    color: #cccccc;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    padding: 0;
    margin-left: 8px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.code-tab .tab-close:hover {
    background: #e74c3c;
    color: white;
}

.add-tab-btn {
    background: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s ease;
    margin-left: 4px;
    flex-shrink: 0; /* Não permitir que seja comprimido */
    min-width: 32px; /* Garantir largura mínima */
}

.add-tab-btn:hover {
    background: #007acc;
    border-color: #007acc;
    color: white;
}

/* Splitter */
.splitter {
    width: 8px;
    background: #3e3e42;
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.splitter:hover {
    background: #007acc;
}

.splitter-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: #666;
    border-radius: 1px;
    transition: all 0.2s ease;
}

.splitter:hover .splitter-handle {
    background: #ffffff;
    height: 60px;
}

/* Canvas Section */
.canvas-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 400px;
    background: #1e1e1e;
}

.canvas-header {
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-tabs {
    display: flex;
}



.canvas-content {
    flex: 1;
    background: #f5f5f5;
    overflow: auto;
    position: relative;
}

.canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#bmcCanvas {
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: white;
    max-width: 100%;
    max-height: 100%;
}

/* Status Bar */
.status-bar {
    background: #007acc;
    color: white;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.developer-info {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.github-link {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.2rem;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.github-link svg {
    width: 14px;
    height: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .splitter {
        width: 100%;
        height: 8px;
        cursor: row-resize;
    }
    
    .editor-section,
    .canvas-section {
        min-width: unset;
        min-height: 200px;
    }
    
    /* Garantir que as abas sejam visíveis em telas pequenas */
    .code-tabs-container {
        max-height: 70px;
    }
    
    .code-tab {
        min-width: 60px;
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .add-tab-btn {
        min-width: 28px;
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

/* Regras específicas para zoom alto (125%+ ou telas pequenas) */
@media (max-width: 1200px) {
    .code-tabs-container {
        max-height: 80px; /* Mais espaço em zoom alto */
    }
    
    .code-tab {
        min-width: 70px;
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .code-tab .tab-name {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .add-tab-btn {
        min-width: 30px;
        padding: 4px 6px;
    }
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 1.1rem;
    color: #666;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007acc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.error {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem;
    border: 1px solid rgba(244, 67, 54, 0.2);
}

/* Success State */
.success {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #2d2d30;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

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

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #2d2d30;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 400px;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.modal-close {
    background: none;
    border: none;
    color: #d4d4d4;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #3e3e42;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    color: #d4d4d4;
    font-size: 0.9rem;
}

.modal-body input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-size: 1rem;
}

.modal-body input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #3e3e42;
}

.modal-footer .btn-secondary {
    background: #3e3e42;
    color: #d4d4d4;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.modal-footer .btn-secondary:hover {
    background: #4a4a4e;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.modal-footer .btn-primary:hover {
    opacity: 0.9;
}

/* Auth specific styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group.hidden {
    display: none;
}

.error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 14px;
}

.verification-message {
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 16px;
    border-radius: 6px;
    text-align: center;
}

.verification-message p {
    margin: 0 0 12px 0;
}

.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 8px 0;
}

.btn-link:hover {
    color: #5a67d8;
}

/* Loading screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1f2937;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

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

.loading-content h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    color: #60a5fa;
}

.loading-content p {
    font-size: 1.1rem;
    color: #9ca3af;
}

/* User info in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 16px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    color: #d4d4d4;
    font-weight: 500;
}

.logout-btn {
    background: none;
    border: 1px solid #3e3e42;
    color: #d4d4d4;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.logout-btn:hover {
    background-color: #3e3e42;
    color: #ffffff;
} 