/* ===== CSS Variables ===== */
:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --primary-bg: #f0fdfa;
    --secondary: #1e293b;
    --accent: #f59e0b;
    --accent-light: #fef3c7;
    --text: #334155;
    --text-light: #64748b;
    --text-white: #f8fafc;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 20px;
    --radius-full: 50px;
    --transition: all 0.3s ease;
    --container: 1200px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Logo ===== */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    position: relative;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
    transition: var(--transition);
}

.logo-icon:hover {
    transform: scale(1.05) rotate(-5deg);
}

.logo-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid white;
    animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-brand {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--secondary);
}

.logo-highlight {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
}

.logo-tagline {
    font-size: 0.55rem;
    font-weight: 500;
    color: var(--text-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Footer logo */
.footer .logo .logo-icon {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    width: 38px;
    height: 38px;
    font-size: 1rem;
}

.footer .logo .logo-brand {
    color: white;
}

.footer .logo .logo-highlight {
    color: var(--primary-light);
}

.footer .logo .logo-tagline {
    color: #94a3b8;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.05rem;
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.btn-destaque {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--secondary);
    font-weight: 700;
}

.btn-destaque:hover {
    background: #d97706;
    border-color: #d97706;
    color: white;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.header.scrolled {
    box-shadow: var(--shadow);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-menu a {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
    transition: var(--transition);
}

.nav-menu a:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.nav-btn {
    display: inline-flex !important;
    padding: 10px 20px !important;
    font-size: 0.85rem !important;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    width: 24px;
    height: 2.5px;
    background: var(--secondary);
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Hero ===== */
.hero {
    padding: 140px 0 80px;
    background: linear-gradient(135deg, #f0fdfa 0%, #e6f7f5 30%, #fef3c7 100%);
    position: relative;
    overflow: hidden;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--secondary);
    line-height: 1.15;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 32px;
    max-width: 500px;
}

.hero-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.hero-stats {
    display: flex;
    gap: 40px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.hero-image {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 350px;
}

.hero-main-icon {
    width: 160px;
    height: 160px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--primary);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--primary-light);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.hero-floating-card {
    position: absolute;
    background: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1;
    animation: float 3s ease-in-out infinite;
}

.hero-floating-card i {
    color: var(--primary);
    font-size: 1.2rem;
}

.card-1 { top: 10%; left: 5%; animation-delay: 0s; }
.card-2 { top: 55%; right: 0; animation-delay: 0.5s; }
.card-3 { bottom: 5%; left: 15%; animation-delay: 1s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.wave-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.wave-divider svg {
    fill: var(--bg);
    width: 100%;
    height: 60px;
}

/* ===== Section Header ===== */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-tag {
    display: inline-block;
    background: var(--primary-bg);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 12px;
}

.section-header p {
    color: var(--text-light);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Disciplinas ===== */
.disciplinas {
    padding: 100px 0;
    background: var(--bg);
}

.disciplinas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.disciplina-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: var(--transition);
    text-align: center;
}

.disciplina-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.disciplina-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.4rem;
    color: var(--primary);
}

.disciplina-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--secondary);
}

.disciplina-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.aula-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

/* ===== Recursos ===== */
.recursos {
    padding: 100px 0;
    background: var(--bg-alt);
}

.recursos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.recurso-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.recurso-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.recurso-icon-wrapper {
    width: 48px;
    height: 48px;
    background: var(--primary-bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.recurso-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--secondary);
}

.recurso-card p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===== Planos ===== */
.planos {
    padding: 100px 0;
    background: var(--bg);
}

.planos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    max-width: 800px;
    margin: 0 auto;
}

.plano-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
}

.plano-card:hover {
    box-shadow: var(--shadow-lg);
}

.plano-destaque {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: scale(1.03);
}

.plano-destaque:hover {
    transform: scale(1.05);
}

.plano-header {
    padding: 32px 28px 24px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.plano-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 6px 20px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.plano-badge.destaque {
    background: var(--accent);
    color: var(--secondary);
}

.plano-header h3 {
    font-size: 1.4rem;
    color: var(--secondary);
    margin-bottom: 12px;
    margin-top: 8px;
}

.plano-preco {
    margin-bottom: 8px;
}

.plano-preco .moeda {
    font-size: 1.2rem;
    font-weight: 600;
    vertical-align: top;
    color: var(--text-light);
}

.plano-preco .valor {
    font-size: 3rem;
    font-weight: 800;
    color: var(--secondary);
}

.plano-preco .periodo {
    font-size: 1rem;
    color: var(--text-light);
}

.plano-header > p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.plano-body {
    padding: 24px 28px;
}

.plano-features {
    list-style: none;
}

.plano-features li {
    padding: 10px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.plano-features li i.fa-check {
    color: var(--primary);
    font-size: 0.9rem;
}

.plano-features li.feature-disabled {
    color: #cbd5e1;
}

.plano-features li.feature-disabled i {
    color: #cbd5e1;
}

.plano-footer {
    padding: 0 28px 28px;
}

/* ===== Apostilas ===== */
.apostilas {
    padding: 100px 0;
    background: var(--bg-alt);
}

.apostilas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.apostila-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
}

.apostila-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.apostila-img {
    width: 64px;
    height: 64px;
    background: var(--primary-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.6rem;
    color: var(--primary);
}

.apostila-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--secondary);
}

.apostila-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.apostila-preco {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 16px;
}

/* ===== Depoimentos ===== */
.depoimentos {
    padding: 100px 0;
    background: var(--bg);
}

.depoimentos-slider {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.depoimento-card {
    background: var(--bg-alt);
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--border);
    display: none;
}

.depoimento-card.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.depoimento-stars {
    color: var(--accent);
    font-size: 1.2rem;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.depoimento-card > p {
    font-size: 1.05rem;
    color: var(--text);
    font-style: italic;
    margin-bottom: 20px;
    line-height: 1.7;
}

.depoimento-autor {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autor-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.depoimento-autor strong {
    display: block;
    font-size: 0.9rem;
}

.depoimento-autor span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.depoimento-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.depoimento-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.depoimento-dot.active {
    background: var(--primary);
    width: 28px;
    border-radius: 5px;
}

/* ===== FAQ ===== */
.faq {
    padding: 100px 0;
    background: var(--bg-alt);
}

.faq-list {
    max-width: 700px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border);
    padding: 4px 0;
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    cursor: pointer;
    text-align: left;
}

.faq-question i {
    font-size: 0.9rem;
    color: var(--primary);
    transition: var(--transition);
}

.faq-question.active i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer.open {
    max-height: 200px;
    padding-bottom: 20px;
}

.faq-answer p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ===== CTA Final ===== */
.cta-final {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    text-align: center;
    color: white;
}

.cta-final h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.cta-final p {
    font-size: 1.05rem;
    margin-bottom: 32px;
    opacity: 0.9;
}

.cta-final .btn-primary {
    background: white;
    color: var(--primary);
    border-color: white;
}

.cta-final .btn-primary:hover {
    background: var(--accent-light);
    color: var(--secondary);
    border-color: var(--accent-light);
}

/* ===== Footer ===== */
.footer {
    background: var(--secondary);
    color: #cbd5e1;
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    gap: 12px;
}

.social-links a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    color: white;
}

.social-links a:hover {
    background: var(--primary);
}

.footer-links h4 {
    color: white;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-light);
}

.footer-newsletter h4 {
    color: white;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.footer-newsletter p {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.newsletter-form {
    display: flex;
    gap: 4px;
}

.newsletter-form input {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 0.85rem;
    outline: none;
}

.newsletter-form button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
}

/* ===== WhatsApp Float ===== */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transition: var(--transition);
    animation: pulse-wa 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
}

@keyframes pulse-wa {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0.4); }
    50% { box-shadow: 0 0 0 18px rgba(37,211,102,0); }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero p { max-width: 100%; }
    .hero-cta { justify-content: center; }
    .hero-stats { justify-content: center; }
    .hero-image { height: 250px; margin-top: 40px; }
    
    .disciplinas-grid { grid-template-columns: repeat(2, 1fr); }
    .recursos-grid { grid-template-columns: repeat(2, 1fr); }
    .apostilas-grid { grid-template-columns: repeat(2, 1fr); }
    .planos-grid { grid-template-columns: 1fr; max-width: 450px; }
    .plano-destaque { transform: scale(1); }
    .plano-destaque:hover { transform: scale(1.02); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .logo-brand, .logo-highlight {
        font-size: 1.1rem;
    }
    .logo-tagline {
        font-size: 0.45rem;
    }
    .logo-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
    .logo-dot {
        width: 10px;
        height: 10px;
        top: -3px;
        right: -3px;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: white;
        flex-direction: column;
        padding: 32px;
        gap: 8px;
        transition: var(--transition);
    }
    .nav-menu.active { left: 0; }
    .nav-btn { display: none !important; }
    .hamburger { display: flex; }
    
    .hero { padding: 120px 0 60px; }
    .hero h1 { font-size: 2rem; }
    .hero-stats { gap: 24px; flex-wrap: wrap; }
    
    .disciplinas-grid { grid-template-columns: 1fr; }
    .recursos-grid { grid-template-columns: 1fr; }
    .apostilas-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .logo-brand, .logo-highlight {
        font-size: 0.95rem;
    }
    .logo-tagline {
        font-size: 0.4rem;
    }
    .logo-icon {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    .logo-dot {
        width: 8px;
        height: 8px;
        top: -2px;
        right: -2px;
    }
    
    .hero h1 { font-size: 1.7rem; }
    .hero-cta { flex-direction: column; }
    .apostilas-grid { grid-template-columns: 1fr; }
    .section-header h2 { font-size: 1.6rem; }
}

// ===== Header Scroll Effect =====
const header = document.getElementById('header');
window.addEventListener('scroll', () => {
    if (window.scrollY > 80) {
        header.classList.add('scrolled');
    } else {
        header.classList.remove('scrolled');
    }
});

// ===== Mobile Menu Toggle =====
const hamburger = document.getElementById('hamburger');
const navMenu = document.getElementById('navMenu');

hamburger.addEventListener('click', () => {
    hamburger.classList.toggle('active');
    navMenu.classList.toggle('active');
});

// Fechar menu ao clicar em um link
document.querySelectorAll('.nav-menu a').forEach(link => {
    link.addEventListener('click', () => {
        hamburger.classList.remove('active');
        navMenu.classList.remove('active');
    });
});

// ===== Depoimentos Slider =====
const depoimentos = document.querySelectorAll('.depoimento-card');
const dots = document.querySelectorAll('.depoimento-dot');
let currentDepoimento = 0;
let depoimentoInterval;

function showDepoimento(index) {
    depoimentos.forEach((d, i) => {
        d.classList.toggle('active', i === index);
    });
    dots.forEach((dot, i) => {
        dot.classList.toggle('active', i === index);
    });
    currentDepoimento = index;
}

dots.forEach(dot => {
    dot.addEventListener('click', () => {
        const index = parseInt(dot.getAttribute('data-index'));
        showDepoimento(index);
        resetDepoimentoInterval();
    });
});

function nextDepoimento() {
    const next = (currentDepoimento + 1) % depoimentos.length;
    showDepoimento(next);
}

function resetDepoimentoInterval() {
    clearInterval(depoimentoInterval);
    depoimentoInterval = setInterval(nextDepoimento, 4000);
}

// Iniciar slider automático
if (depoimentos.length > 1) {
    depoimentoInterval = setInterval(nextDepoimento, 4000);
}

// ===== FAQ Accordion =====
const faqQuestions = document.querySelectorAll('.faq-question');

faqQuestions.forEach(question => {
    question.addEventListener('click', () => {
        const answer = question.nextElementSibling;
        const icon = question.querySelector('i');
        const isOpen = answer.classList.contains('open');
        
        // Fechar todas
        document.querySelectorAll('.faq-answer.open').forEach(openAnswer => {
            if (openAnswer !== answer) {
                openAnswer.classList.remove('open');
                openAnswer.previousElementSibling.querySelector('i').classList.remove('active');
                openAnswer.previousElementSibling.classList.remove('active');
            }
        });
        
        // Toggle atual
        if (!isOpen) {
            answer.classList.add('open');
            icon.classList.add('active');
            question.classList.add('active');
        } else {
            answer.classList.remove('open');
            icon.classList.remove('active');
            question.classList.remove('active');
        }
    });
});

// ===== Smooth Scroll para links internos =====
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', function(e) {
        const href = this.getAttribute('href');
        if (href === '#') return;
        
        const target = document.querySelector(href);
        if (target) {
            e.preventDefault();
            const headerHeight = header.offsetHeight;
            const targetPosition = target.offsetTop - headerHeight - 20;
            
            window.scrollTo({
                top: targetPosition,
                behavior: 'smooth'
            });
        }
    });
});

// ===== Animação de entrada ao scroll =====
const observerOptions = {
    threshold: 0.1,
    rootMargin: '0px 0px -50px 0px'
};

const observer = new IntersectionObserver((entries) => {
    entries.forEach(entry => {
        if (entry.isIntersecting) {
            entry.target.style.opacity = '1';
            entry.target.style.transform = 'translateY(0)';
        }
    });
}, observerOptions);

// Observar cards para animação
const animatableElements = document.querySelectorAll(
    '.disciplina-card, .recurso-card, .plano-card, .apostila-card, .depoimento-card'
);

animatableElements.forEach(el => {
    el.style.opacity = '0';
    el.style.transform = 'translateY(20px)';
    el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
    observer.observe(el);
});

// ===== Newsletter Form =====
const newsletterForm = document.querySelector('.newsletter-form');
if (newsletterForm) {
    newsletterForm.addEventListener('submit', function(e) {
        e.preventDefault();
        const input = this.querySelector('input');
        const email = input.value.trim();
        
        if (email && isValidEmail(email)) {
            input.value = '';
            input.placeholder = 'Inscrito com sucesso! 🎉';
            setTimeout(() => {
                input.placeholder = 'Seu melhor e-mail';
            }, 3000);
        } else {
            input.style.border = '2px solid #ef4444';
            setTimeout(() => {
                input.style.border = 'none';
            }, 2000);
        }
    });
}

function isValidEmail(email) {
    return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}

// ===== Botões de Assinatura - Animação =====
document.querySelectorAll('.plano-footer .btn, .nav-btn').forEach(btn => {
    btn.addEventListener('click', function(e) {
        if (this.getAttribute('href') === '#planos' || this.closest('.plano-card')) {
            // Ripple effect no clique
            const ripple = document.createElement('span');
            ripple.style.cssText = `
                position: absolute;
                background: rgba(255,255,255,0.5);
                border-radius: 50%;
                pointer-events: none;
                animation: ripple 0.6s ease-out;
                transform: translate(-50%, -50%);
            `;
            
            const rect = this.getBoundingClientRect();
            const size = Math.max(rect.width, rect.height);
            ripple.style.width = ripple.style.height = size + 'px';
            ripple.style.left = (e.clientX - rect.left) + 'px';
            ripple.style.top = (e.clientY - rect.top) + 'px';
            
            this.style.position = this.style.position || 'relative';
            this.style.overflow = 'hidden';
            this.appendChild(ripple);
            
            setTimeout(() => ripple.remove(), 600);
        }
    });
});

// ===== Logo Animation on Hover =====
document.querySelectorAll('.logo').forEach(logo => {
    logo.addEventListener('mouseenter', function() {
        const icon = this.querySelector('.logo-icon');
        if (icon) {
            icon.style.transform = 'scale(1.1) rotate(-8deg)';
            setTimeout(() => {
                icon.style.transform = 'scale(1) rotate(0deg)';
            }, 300);
        }
    });
});

// ===== Dot Pulse Animation for Logo (keep the pulse going) =====
// The CSS animation already handles this, just ensuring it works

// Adicionar keyframes do ripple dinamicamente
const rippleStyle = document.createElement('style');
rippleStyle.textContent = `
    @keyframes ripple {
        from { width: 0; height: 0; opacity: 0.5; }
        to { width: 500px; height: 500px; opacity: 0; }
    }
`;
document.head.appendChild(rippleStyle);

console.log('🚀 FarmacoFácil - Landing page carregada com sucesso!');
/* Badge wrapper - versão mais segura */
.plano-badge-wrapper {
    position: relative;
    height: 0;
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.plano-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 6px 20px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
    position: relative;
    top: -14px;
}

.plano-badge.destaque {
    background: var(--accent);
    color: var(--secondary);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Responsivo para o badge */
@media (max-width: 480px) {
    .plano-badge-wrapper {
        margin-bottom: 8px;
    }
    
    .plano-badge {
        font-size: 0.65rem;
        padding: 4px 14px;
        top: -12px;
    }
}