:root {
    --primary: #247ba0ff;
    --primary-light: #1b98e0ff;
    --primary-dark: #13293dff;
    --secondary: #006494ff;
    --accent: #13293dff;
    --success: #10b981;
    --error: #ef4444;
    --dark: #13293dff;
    --light: #E8F1F2ff;
    --border: #e2e8f0;
    --text-primary: #13293dff;
    --text-secondary: #006494ff;
    --text-light: #247ba0ff;

    /* Espaçamento */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Raio de borda */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
    --shadow: 0 8px 32px rgba(36, 123, 160, 0.10);
}

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


a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s, transform 0.2s;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(118deg, #465EB5 0%, #364070 50%, #2B2C41 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.header {
    background: rgba(255,255,255,0.95);
    color: var(--primary-dark);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}


.logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
}


.logo img {
    height: 44px;
    width: auto;
    border-radius: 10px;
}
.logo-text {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.primary-text {
    color: #1366CB;
    font-weight: 700;
}

.accent-text {
    color: var(--accent);
    font-weight: 700;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    color: #1366CB;
    align-items: center;
}

.main-nav a {
    color: var(--primary-dark);
    text-decoration: none;
    padding: 0.5rem 1.2rem;
    margin: 0 0.2rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    position: relative;
    background: none;
    display: flex;
    align-items: center;
}

.main-nav a.active,
.main-nav a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.main-nav a i {
    margin-right: 0.5rem;
}

.container {
    display: flex;
    min-height: calc(100vh - 120px);
    padding: 2rem;
    gap: 2rem;
    justify-content: center;
}

.sidebar {
    width: 320px;
    background: #fff;
    padding: 2rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    height: fit-content;
    border: 1px solid var(--border);
}

.sidebar h3 {
    color: var(--primary);
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.lista-desafios {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.desafio-item {
    padding: 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-weight: 500;
}

.desafio-item:hover {
    background: var(--primary-light);
    color: #fff;
    transform: translateX(5px) scale(1.03);
    border-color: var(--primary);
}

.desafio-item.completo {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

#desafio-container {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.desafio-header {
    background: var(--primary);
    color: #fff;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.desafio-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.dificuldade {
    display: flex;
    gap: 1rem;
}

.dificuldade span {
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    background: var(--primary-light);
    color: #fff;
    font-weight: 600;
}

.desafio-content {
    padding: 2rem;
}

.descricao-container {
    margin-bottom: 2rem;
}

.descricao {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    margin: 1rem 0;
    font-size: 1.05rem;
}

.exemplos {
    margin-top: 2rem;
}

.exemplo {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.exemplo p {
    margin: 0.5rem 0;
}

.exemplo strong {
    color: var(--primary);
}

.exemplo pre {
    background: var(--dark);
    color: white;
    padding: 1rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    font-family: 'Fira Code', monospace;
    white-space: pre-wrap;
}

.editor-container {
    margin: 2rem 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--dark);
    box-shadow: 0 4px 16px rgba(36, 123, 160, 0.10);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #21252b;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.window-controls {
    display: flex;
    gap: 6px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: transform 0.2s;
}

.control:hover {
    transform: scale(1.1);
}

.control.red {
    background: #ff5f56;
}

.control.yellow {
    background: #ffbd2e;
}

.control.green {
    background: #27c93f;
}

.language-selector select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary);
}

.language-selector option {
    background: #282c34;
    color: white;
}

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

.icon-btn {
    background: var(--primary-light);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--primary);
    transform: translateY(-2px) scale(1.08);
}

.code-content {
    padding: 1rem;
    background: #282c34;
    max-height: 400px;
    overflow: auto;
    border-radius: 0 0 8px 8px;
}

.code-content pre {
    margin: 0;
    padding: 0;
}

.code-content code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    tab-size: 4;
}

.code-content textarea {
    width: 100%;
    height: 300px;
    background: #282c34;
    color: #fff;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 1rem;
    border: none;
    resize: vertical;
    outline: none;
    tab-size: 4;
}

.code-content textarea:focus {
    outline: 1px solid rgba(255, 255, 255, 0.1);
}

/* Estilização da barra de rolagem */
.code-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.code-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.code-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.io-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.input-container,
.output-container {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(36, 123, 160, 0.07);
}

.input-container h3,
.output-container h3 {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1rem;
    margin: 0;
    font-size: 1rem;
}

.input-container textarea {
    width: 100%;
    height: 150px;
    background: #f8fafc;
    color: var(--text-primary);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    resize: vertical;
}

.input-container textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(36, 123, 160, 0.1);
}

#saida {
    height: 150px;
    padding: 1rem;
    margin: 0;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: #f8fafc;
    white-space: pre-wrap;
    color: var(--text-primary);
}

footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    box-shadow: 0 -2px 8px rgba(36, 123, 160, 0.07);
}

.editor-actions select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-right: 1rem;
    cursor: pointer;
}

.editor-actions select:focus {
    outline: none;
    border-color: var(--primary);
}

.templates {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--light);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.template-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.template-btn {
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    font-size: 0.95rem;
    font-weight: 600;
}

.template-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-2px) scale(1.07);
}

/* Responsividade */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
        padding: 1rem;
    }
    .sidebar {
        width: 100%;
        margin-bottom: 1.5rem;
    }
    .io-container {
        grid-template-columns: 1fr;
    }
}