/* Importando uma fonte mais moderna do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* --- Variáveis de Cor --- */
:root {
    --primary-color: #007BFF;
    --primary-hover-color: #0056b3;
    --secondary-color: #f9f9f9;
    --text-color: #333;
    --heading-color: #111;
    --light-gray: #ddd;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --success-color: #28a745;
    --error-color: #dc3545;
}

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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    background-color: var(--white);
    color: var(--text-color);
}

/* --- Barra de Navegação --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

#navbar-logo {
    height: 40px; /* Adjust as needed */
    width: auto; /* Maintain aspect ratio */
    vertical-align: middle; /* Align with text elements if any */
    margin-right: 10px; /* Space between logo and other elements */
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin: 0 1rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.cta-button {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
}

.cta-button-form {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.7rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
}

.cta-button:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
}

.cta-button-form:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
}

/* --- Seção Hero --- */
.hero {
    background: linear-gradient(rgba(0, 123, 255, 0.05), rgba(0, 123, 255, 0.05)), url('https://www.transparenttextures.com/patterns/subtle-prism.png');
    padding: 4rem 2rem;
    text-align: center;
}

.hero-content h1 {
    font-size: 2.8rem;
    color: var(--heading-color);
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-content p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: auto;
    color: #555;
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    justify-content: center;
    max-width: 500px;
    margin: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    overflow: hidden;
}

#search-input {
    flex-grow: 1;
    border: none;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
}

#search-input:focus {
    outline: none;
}

#search-button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

#search-button:hover {
    background: var(--primary-hover-color);
}


/* --- Conteúdo Principal --- */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
}

.courses-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.courses-header h2 {
    font-size: 2.2rem;
    color: var(--heading-color);
    margin-bottom: 1rem;
}

/* --- Container dos Cursos --- */
#courses-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* --- Card de Curso Individual --- */
.course-card {
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.course-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.course-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.course-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.course-info h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 0.5rem;
}

.course-info p {
    flex-grow: 1;
    margin-bottom: 1rem;
    color: #666;
}

.course-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.4rem;
}

.buy-button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.buy-button:hover {
    background-color: var(--primary-hover-color);
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.4s;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
}

#add-course-form {
    display: flex;
    flex-direction: column;
}

#add-course-form label {
    margin-top: 1rem;
    font-weight: 600;
}

#add-course-form input,
#add-course-form textarea {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.5rem;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    font-size: 1rem;
}

#add-course-form button {
    margin-top: 1.5rem;
    padding: 0.8rem;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

#add-course-form button:hover {
    background-color: #218838;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Rodapé --- */
footer {
    text-align: center;
    padding: 2.5rem 0;
    background-color: #111;
    color: var(--white);
    margin-top: 3rem;
}

/* --- Dark Mode --- */
body.dark-mode {
    --primary-color: #007BFF;
    --primary-hover-color: #0056b3;
    --secondary-color: #1a1a1a;
    --text-color: #ccc;
    --heading-color: #fff;
    --light-gray: #444;
    --white: #2a2a2a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-actions {
    display: flex;
    align-items: center;
}

.theme-button {
    background: none;
    border: none;
    color: var(--heading-color);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 1rem;
    transition: color 0.3s;
}

.theme-button:hover {
    color: var(--primary-color);
}

/* --- Creator CTA Section --- */
.creator-cta {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--secondary-color);
    margin: 4rem 0;
    border-radius: 12px;
}

.creator-cta h2 {
    font-size: 2.2rem;
    color: var(--heading-color);
    margin-bottom: 1rem;
}

.creator-cta p {
    font-size: 1.1rem;
    color: var(--text-color);
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

/* --- Chat Widget Styles --- */
#chat-widget-container {
    position: fixed;
    bottom: 20px;
    left: 20px; /* User requested left corner */
    z-index: 1000;
}

.chat-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: var(--shadow);
}

.chat-button:hover {
    background-color: var(--primary-hover-color);
}

#chat-window {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 80px; /* Above the toggle button */
    left: 20px;
    width: 300px;
    height: 400px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

#chat-close-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.chat-messages {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: var(--secondary-color);
    border-bottom: 1px solid var(--light-gray);
}

.chat-message {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.sent {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.chat-message.received {
    background-color: var(--light-gray);
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid var(--light-gray);
    background-color: var(--white);
}

#chat-message-input {
    flex-grow: 1;
    border: 1px solid var(--light-gray);
    border-radius: 20px;
    padding: 8px 12px;
    margin-right: 10px;
    font-size: 0.9rem;
}

#chat-send-button {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    #chat-widget-container {
        bottom: 10px;
        left: 10px;
    }

    #chat-window {
        bottom: 70px;
        left: 10px;
        width: calc(100% - 20px);
        height: 300px;
    }
}