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

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    color: white;
    animation: splashFadeIn 1s ease-out;
}

.splash-logo-container {
    position: relative;
    margin-bottom: 2rem;
}

.splash-logo {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: logoFloat 2s ease-in-out infinite;
}

.loading-animation {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

.splash-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: titleSlideUp 1s ease-out 0.3s both;
}

.splash-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 3rem;
    letter-spacing: 2px;
    animation: subtitleSlideUp 1s ease-out 0.6s both;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
    animation: barFadeIn 1s ease-out 0.9s both;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 2px;
    animation: loadingProgress 2s ease-in-out infinite;
}

/* Animações */
@keyframes splashFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes titleSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes subtitleSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

@keyframes barFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loadingProgress {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(100%);
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    height: 100vh;
    overflow: hidden;
}

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

/* App Header with Logo */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-logo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.app-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    background: linear-gradient(135deg, #3498db, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-title p {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    color: #4a5568;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.header-content h1 i {
    color: #667eea;
    margin-right: 0.5rem;
}

.header-content p {
    color: #718096;
    font-size: 1.1rem;
}

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

/* Sidebar */
.sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    max-height: 100%;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section h3 i {
    color: #667eea;
}

/* Examples */
.examples-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.example-item {
    padding: 0.5rem;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.example-item:hover {
    background: #f8fafc;
    border-color: #667eea;
}

.example-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.example-item h4 {
    color: #2d3748;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.2;
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
}

.example-filename {
    background: #edf2f7;
    color: #4a5568;
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    flex-shrink: 0;
}

.example-description {
    display: none; /* Oculta para economizar espaço */
}

.example-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.load-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.2s ease;
}

.load-btn:hover {
    background: #5a67d8;
}

/* Syntax Help */
.syntax-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f7fafc;
    border-radius: 8px;
}

.syntax-item strong {
    color: #4a5568;
    display: block;
    margin-bottom: 0.25rem;
}

.syntax-item code {
    background: #2d3748;
    color: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    display: block;
}

/* Variables */
.variables-list {
    font-size: 0.9rem;
}

.variable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f7fafc;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.variable-name {
    color: #4a5568;
    font-weight: 500;
}

.variable-count {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.no-variables {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Editor Area */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 0; /* Permite que flex children encolham */
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

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

.tab {
    padding: 0.5rem 1rem;
    background: #e2e8f0;
    border-radius: 6px 6px 0 0;
    color: #4a5568;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab.active {
    background: white;
    color: #2d3748;
}

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

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

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

/* Editor Container */
.editor-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    flex-shrink: 1; /* Permite que encolha quando necessário */
}

.line-numbers {
    background: #2d3748;
    color: #a0aec0;
    padding: 1rem 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-align: right;
    user-select: none;
    min-width: 50px;
    border-right: 1px solid #4a5568;
    overflow: hidden;
}

.line-number {
    line-height: 1.5;
    height: 1.5em;
    display: block;
    white-space: nowrap;
}

.code-editor {
    flex: 1;
    background: #2d3748;
    color: #e2e8f0;
    border: none;
    outline: none;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow: auto;
    height: 100%;
}

.code-editor::placeholder {
    color: #718096;
}

/* Resize Handle */
.resize-handle {
    height: 8px;
    background: #e2e8f0;
    cursor: row-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.2s ease;
}

.resize-handle:hover {
    background: #cbd5e0;
}

.resize-line {
    width: 40px;
    height: 2px;
    background: #a0aec0;
    border-radius: 1px;
    transition: all 0.2s ease;
}

.resize-handle:hover .resize-line {
    background: #667eea;
    width: 60px;
}

.resize-handle.dragging {
    background: #667eea;
}

.resize-handle.dragging .resize-line {
    background: white;
    width: 80px;
}

/* Output Container */
.output-container {
    display: flex;
    flex-direction: column;
    min-height: 150px;
    height: 300px;
    flex-shrink: 0; /* Impede que encolha automaticamente */
    overflow: hidden; /* Evita overflow do container */
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.output-header h3 {
    color: #4a5568;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.output-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.output {
    flex: 1;
    padding: 1rem 1.5rem;
    background: #1a202c;
    color: #e2e8f0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-y: auto;
    border-radius: 0 0 12px 12px;
}

.output-welcome {
    color: #a0aec0;
    text-align: center;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.output-success {
    color: #68d391;
}

.output-error {
    color: #fc8181;
}

.output-info {
    color: #63b3ed;
}

.output-result {
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: #4a5568;
    font-weight: 500;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #4a5568;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
}

/* Download Buttons */
.download-container {
    margin: 10px 0;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.btn-download {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-download:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-success {
    color: #38a169 !important;
}

.text-error {
    color: #e53e3e !important;
}

.text-info {
    color: #3182ce !important;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        order: 2;
        min-width: unset;
        width: 100%;
    }
    
    .editor-container {
        order: 1;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .header-content p {
        font-size: 1rem;
    }
    
    /* Melhorias para exemplos em mobile */
    .example-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .example-filename {
        max-width: 100%;
        align-self: flex-end;
        font-size: 0.65rem;
    }
    
    .example-item h4 {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .example-description {
        font-size: 0.8rem;
        margin: 0.25rem 0 0.5rem 0;
    }
}
