:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-humanas: #f59e0b;
    --accent-saude: #ef4444;
    --accent-exatas: #3b82f6;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-lg: 16px;
    --radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-color: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #ffffff;
    padding: 2rem 1.5rem 6.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-mini {
    font-weight: 700;
    font-size: 1.05rem;
    color: #ffffff;
}

.auth-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-auth {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 0.55rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-auth:hover {
    background: #ffffff;
    color: #1e3a8a;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-logout:hover {
    background: #ef4444;
    color: #ffffff;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

header p {
    font-size: 1.15rem;
    color: #93c5fd;
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    font-weight: 400;
}

.controls-wrapper {
    max-width: 650px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-container input {
    width: 100%;
    padding: 1.1rem 1.5rem 1.1rem 3.5rem;
    font-size: 1.05rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    outline: none;
    transition: var(--transition);
}

.search-container input::placeholder {
    color: #cbd5e1;
}

.search-container input:focus {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4);
    border-color: transparent;
}

.search-icon {
    position: absolute;
    left: 1.3rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    pointer-events: none;
    transition: var(--transition);
}

.search-container input:focus ~ .search-icon {
    filter: invert(1) brightness(0.2);
}

.filter-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    background: #ffffff;
    color: #1e3a8a;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.container {
    max-width: 1250px;
    margin: -3.5rem auto 5rem auto;
    padding: 0 1.5rem;
}

.grid-cursos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.curso-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    animation: cardFade 0.4s ease-out;
}

.curso-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
}

.curso-card.humanas::before { background: var(--accent-humanas); }
.curso-card.saude::before { background: var(--accent-saude); }
.curso-card.exatas::before { background: var(--accent-exatas); }

.curso-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: transparent;
}

.curso-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    padding-right: 2rem;
}

.btn-favoritar {
    position: absolute;
    top: 1.4rem;
    right: 1.4rem;
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #cbd5e1;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}

.btn-favoritar:hover {
    color: #f59e0b;
    transform: scale(1.15);
}

.btn-favoritar.favoritado {
    color: #f59e0b;
}

.info {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    letter-spacing: 0.02em;
}

.nota {
    background-color: #f0fdf4;
    color: #16a34a;
}

.duracao {
    background-color: #f1f5f9;
    color: #475569;
}

.curso-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.curso-card strong {
    color: #1e293b;
    font-weight: 600;
    display: inline-block;
    margin-right: 2px;
}

.btn-detalhes {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    transition: var(--transition);
}

.btn-detalhes:hover {
    color: #1d4ed8;
    transform: translateX(4px);
}

.hidden-message {
    display: none;
    text-align: center;
    padding: 4rem 1.5rem;
    font-size: 1.15rem;
    color: var(--text-secondary);
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

footer {
    background: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 3rem 1.5rem;
    font-size: 0.95rem;
    border-top: 1px solid #1e293b;
}

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

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.auth-overlay.visivel {
    display: flex;
}

.auth-modal {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow-hover);
    animation: cardFade 0.25s ease-out;
}

.btn-fechar-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.auth-tab.active {
    color: #1e3a8a;
    border-bottom-color: #1e3a8a;
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 0.9rem;
}

.auth-form.active {
    display: flex;
}

.auth-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-form input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.auth-form input:focus {
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.btn-auth-submit {
    margin-top: 0.5rem;
    background: #1e3a8a;
    color: #ffffff;
    border: none;
    padding: 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-auth-submit:hover {
    background: #1d4ed8;
}

.auth-msg {
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2rem;
}

.auth-msg.erro { color: #ef4444; }
.auth-msg.sucesso { color: #16a34a; }

@media (max-width: 640px) {
    header {
        padding: 1.5rem 1rem 5rem 1rem;
    }
    header h1 { font-size: 2rem; }
    header p { font-size: 1rem; }
    .container { margin-top: -2rem; }
    .grid-cursos { grid-template-columns: 1fr; }
    .curso-card { padding: 1.5rem; }
    .top-bar { justify-content: center; text-align: center; }
}