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

body {
    font-family: "Segoe UI", Tahoma, sans-serif;
    line-height: 1.6;
    background: #121212;
    color: #ecf0f1;
}

.wrapper {
    display: flex;
}

/* ================================================ */
/* SIDEBAR                                          */
/* ================================================ */
.sidebar {
    width: 250px;
    background: #1a1a1a;
    color: #ecf0f1;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sidebar-header .foto-perfil {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid #8e44ad;
    margin-bottom: 1rem;
    object-fit: cover;
    object-position: center -33px;
}

.sidebar-header h1 {
    margin-bottom: 0.5rem;
}

.sidebar-header .resumo {
    font-size: 0.9rem;
    color: #bdc3c7;
    margin-bottom: 2rem;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sidebar nav a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 500;
    padding: 0.8rem 0;
    transition: background 0.3s, color 0.3s;
    border-radius: 5px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
}

.sidebar-footer a {
    color: #8e44ad;
    text-decoration: none;
    margin: 0 0.5rem;
}

.sidebar-content {
    transition: max-height 0.4s ease-in-out;
}

/* ================================================ */
/* CONTEÚDO PRINCIPAL                               */
/* ================================================ */
.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 2rem;
}

h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    display: inline-block;
    color: #ecf0f1;
    border-bottom: 2px solid #8e44ad;
}

footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    color: #bdc3c7;
}

/* ================================================ */
/* CARDS (Experiência, Educação, Projetos)          */
/* ================================================ */
.card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    background: #222;
    border-left: 5px solid #8e44ad;
    color: #ecf0f1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.card h3 {
    margin-bottom: .5rem;
    color: #ecf0f1;
}

.card span.badge {
    display: block;
    font-size: 0.9rem;
    color: #bdc3c7;
    margin-bottom: 1rem;
}

.card a {
    color: #8e44ad;
    font-weight: bold;
    text-decoration: none;
}

.card ul {
    margin-top: 8px;
    margin-bottom: 0;
    padding-left: 18px;
}

.card ul ul {
    margin-top: 4px;
}

.cards-grid,
.grid-projetos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.project-card {
    min-height: 420px;
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: top;
    border-radius: 8px 8px 0 0;
}

.project-card img {
    height: 250px;
}

/* ================================================ */
/* TAGS (Habilidades e Tecnologias)                 */
/* ================================================ */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.skill {
    background-color: #8e44ad;
    color: #ecf0f1;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.tecnologias {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tecnologias span {
    padding: 3px 8px;
    border-radius: 4px;
    margin-top: 5px;
    font-size: 0.85rem;
    display: inline-block;
    background-color: #8e44ad;
    color: #fff;
}

/* ================================================ */
/* SEÇÃO HERO                                       */
/* ================================================ */
.hero {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40vh;
    text-align: center;
    padding: 0 2rem;
    color: #fff;
    position: relative;
    background: linear-gradient(135deg, #8e44ad, #5e2a7e, #2c3e50);
    background-size: 200% 200%;
    animation: animatedGradient 20s ease infinite;
    clip-path: ellipse(100% 60% at 50% 40%);
}

.hero-content .hero-subtitle,
.hero-content .hero-title,
.hero-content .hero-description {
    animation: slideUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
}

.hero-content .hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    animation-delay: 0.2s;
}

.hero-content .hero-title {
    font-size: 3rem;
    margin-bottom: 0.3rem;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-content .hero-role {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: .15em solid #ecf0f1;
    width: 0;
    animation: typing 2.5s steps(40, end) forwards, blink-caret .75s step-end infinite;
    animation-delay: 1.2s;
}

.hero-content .hero-description {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    animation-delay: 4s;
}

/* ================================================ */
/* CONTROLE DO BOTÃO DE TEMA                        */
/* ================================================ */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
}

#toggle-theme-desktop {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background: #8e44ad;
    color: #fff;
    z-index: 1000;
    font-weight: bold;
}

#toggle-theme-mobile {
    display: none;
}

/* ================================================ */
/* TEMAS (Dark/Light Mode)                          */
/* ================================================ */
body.light-mode {
    background: #f4f4f5;
    color: #2c3e50;
}

body.light-mode .sidebar {
    background: #ffffff;
    color: #2c3e50;
}

body.light-mode .sidebar-header .resumo {
    color: #7f8c8d;
}

body.light-mode .sidebar nav a {
    color: #2c3e50;
}

body.light-mode .sidebar nav a:hover {
    background: #f0f0f0;
    color: #8e44ad;
}

body.light-mode h2 {
    color: #2c3e50;
}

body.light-mode .card {
    background: #ffffff;
    color: #2c3e50;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body.light-mode .card h3 {
    color: #2c3e50;
}

body.light-mode .card span.badge {
    color: #7f8c8d;
}

body.light-mode .card a:hover {
    color: #5e2a7e;
}

body.light-mode .skill {
    background-color: #d3d3d3;
    color: #333;
}

body.light-mode .tecnologias span {
    background-color: #ececec;
    color: #2c3e50;
}

body.light-mode .hero {
    background: linear-gradient(135deg, #483353, #e3cce6, #483353);
    color: #2c3e50;
}

body.light-mode .hero-content .hero-title {
    text-shadow: none;
}

body.light-mode .hero-content .hero-role {
    border-right-color: #2c3e50;
    animation: typing 2.5s steps(40, end) forwards, blink-caret-light .75s step-end infinite;
    animation-delay: 1.2s;
}

/* ================================================ */
/* ANIMAÇÕES (Keyframes)                            */
/* ================================================ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes animatedGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #ecf0f1; }
}

@keyframes blink-caret-light {
    from, to { border-color: transparent; }
    50% { border-color: #2c3e50; }
}

/* ================================================ */
/* RESPONSIVIDADE (TUDO CONSOLIDADO AQUI)           */
/* ================================================ */
@media (max-width: 768px) {
    .wrapper {
        flex-direction: column;
    }

    /* --- Sidebar como Cabeçalho --- */
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
        flex-wrap: wrap;
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        text-align: left;
    }

    .sidebar-header .foto-perfil {
        width: 50px;
        height: 50px;
        margin: 0 1rem 0 0;
        object-position: center center;
    }

    .sidebar-header h1 {
        font-size: 1.2rem;
        margin: 0;
    }

    .sidebar-header .resumo {
        display: none;
    }

    /* --- Menu Hambúrguer --- */
    .menu-toggle {
        display: block;
    }

    .sidebar-content {
        max-height: 0;
        overflow: hidden;
        width: 100%;
    }

    .sidebar.menu-open .sidebar-content {
        max-height: 100vh;
        padding-top: 1.5rem;
    }

    .sidebar.menu-open nav {
        align-items: center;
    }

    /* --- Conteúdo Principal --- */
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .cards-grid,
    .grid-projetos {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    /* --- Seção Hero --- */
    .hero {
        height: auto;
        min-height: 40vh;
        padding: 3rem 1.5rem;
        clip-path: none;
        border-radius: 0 0 30px 30px;
    }

    .hero-content .hero-title {
        font-size: 2rem;
        word-break: break-word;
    }

    .hero-content .hero-role {
        font-size: 1.3rem;
    }

    .hero-content .hero-description {
        font-size: 0.95rem;
        max-width: 100%;
    }

    /* --- Botão de Tema --- */
    #toggle-theme-desktop {
        display: none;
    }

    #toggle-theme-mobile {
        display: block;
        width: 100%;
        margin-top: 1.5rem;
        padding: 0.8rem 1rem;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        background: #8e44ad;
        color: #fff;
        font-weight: bold;
        text-align: center;
    }

    body.light-mode #toggle-theme-mobile {
        background-color: #f0f0f0;
        color: #333;
    }
}