/* ===========================
   RESET E VARIÁVEIS
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e7e34;
    --secondary-color: #2d9c4f;
    --accent-color: #ff6b35;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

/* ===========================
   LAYOUT PRINCIPAL
   =========================== */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper {
    display: flex;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ===========================
   HEADER
   =========================== */
.header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

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

.logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.3rem;
    transition: var(--transition);
}

.logo a:hover {
    color: var(--secondary-color);
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    display: none;
}

@media (min-width: 768px) {
    .logo-text {
        display: inline;
    }
}

.top-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.search-box {
    display: flex;
    gap: 0.5rem;
    background-color: var(--bg-light);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    width: 150px;
    color: var(--text-dark);
}

.search-box input::placeholder {
    color: var(--text-light);
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.search-btn:hover {
    transform: scale(1.1);
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
    width: 250px;
    background-color: var(--bg-white);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.sidebar-header {
    padding: 0 1.5rem 1rem;
    border-bottom: 2px solid var(--border-color);
}

.sidebar-header h3 {
    color: var(--primary-color);
    font-size: 1rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.tutorial-section {
    margin-bottom: 0.5rem;
}

.tutorial-title a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: var(--transition);
}

.tutorial-title a:hover,
.tutorial-title.active a {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.tutorial-title .icon {
    font-size: 1.2rem;
}

.lessons-list {
    background-color: var(--bg-light);
    max-height: 400px;
    overflow-y: auto;
}

.lesson-item {
    display: block;
    padding: 0.6rem 1.5rem 0.6rem 3rem;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.lesson-item:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
}

.lesson-item.active {
    background-color: #e8f5e9;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

/* ===========================
   CONTEÚDO PRINCIPAL
   =========================== */
.content {
    flex: 1;
    padding: 2rem;
    background-color: var(--bg-white);
    margin: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.page-title {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.page-description {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* ===========================
   HOME PAGE
   =========================== */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: #ff5722;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background-color: var(--bg-light);
    transform: translateY(-2px);
}

.tutorials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.tutorial-card {
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

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

.tutorial-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tutorial-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.tutorial-card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.tutorial-card a {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
}

.tutorial-card a:hover {
    background-color: var(--secondary-color);
}

/* ===========================
   TUTORIAL PAGE
   =========================== */
.tutorial-header {
    margin-bottom: 2rem;
}

.tutorial-header h1 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.tutorial-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.lesson-content {
    margin-bottom: 2rem;
}

.lesson-content h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin: 1.5rem 0 1rem;
}

.lesson-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* ===========================
   CÓDIGO E EXEMPLOS
   =========================== */
.example-section {
    background-color: var(--bg-light);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 6px;
    margin: 2rem 0;
}

.example-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.code-block {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1.5rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}

.code-block code {
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.try-button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.try-button:hover {
    background-color: #ff5722;
    transform: translateY(-2px);
}

/* ===========================
   EDITOR MODAL
   =========================== */
.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;
}

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

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

.modal-content {
    background-color: var(--bg-white);
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-dark);
}

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

.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-header,
.preview-header {
    padding: 1rem;
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.editor-textarea {
    flex: 1;
    padding: 1rem;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: none;
    outline: none;
}

.preview-iframe {
    flex: 1;
    border: none;
    background-color: white;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.modal-footer button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

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

.btn-run:hover {
    background-color: var(--secondary-color);
}

.btn-close-modal {
    background-color: var(--border-color);
    color: var(--text-dark);
}

.btn-close-modal:hover {
    background-color: #d0d0d0;
}

/* ===========================
   FOOTER
   =========================== */
.footer {
    background-color: var(--text-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: auto;
}

.footer-content p {
    margin: 0.5rem 0;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .main-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: auto;
    }

    .content {
        margin: 0;
        border-radius: 0;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }

    .top-nav {
        order: 3;
        width: 100%;
        gap: 1rem;
    }

    .search-box {
        order: 2;
    }

    .search-box input {
        width: 100px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .tutorials-grid {
        grid-template-columns: 1fr;
    }

    .modal-body {
        flex-direction: column;
    }

    .editor-area {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0.75rem;
    }

    .logo-text {
        display: none !important;
    }

    .top-nav {
        gap: 0.5rem;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    .search-box {
        padding: 0.4rem 0.8rem;
    }

    .search-box input {
        width: 80px;
        font-size: 0.9rem;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .code-block {
        padding: 1rem;
        font-size: 0.85rem;
    }
}
