/* ====================================================================
   Padrão Novo Definitivo - Tela de Educação (Dark Glow Moderno)
   ==================================================================== */

:root {
    --primary: #0284c7;
    --primary-dark: #0369a1;
    --accent: #38bdf8;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.75);
    --border-color: rgba(56, 189, 248, 0.2);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glow: rgba(56, 189, 248, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.bg-educacao, body {
    background-color: var(--bg-color) !important;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 0;
}

/* Efeitos de Luz de Fundo (Glow Background) */
.bg-glow-1 {
    position: fixed;
    top: -100px;
    left: -100px;
    width: 450px;
    height: 450px;
    background: rgba(2, 132, 199, 0.22);
    filter: blur(130px);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.bg-glow-2 {
    position: fixed;
    top: 30%;
    right: -100px;
    width: 500px;
    height: 500px;
    background: rgba(56, 189, 248, 0.15);
    filter: blur(150px);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

/* Garante que elementos fiquem acima dos glows */
header, main, footer, .dialog-backdrop, .custom-toast-backdrop {
    position: relative;
    z-index: 10;
}

/* --- CABEÇALHO / HEADER E BOTÃO VOLTAR --- */
.app-header {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.badge-portal {
    display: inline-block;
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.brand-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-voltar-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 9999px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.btn-voltar-header:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(30, 41, 59, 0.9);
    transform: translateX(-4px);
    box-shadow: 0 6px 20px var(--glow);
}

/* --- LAYOUT PRINCIPAL & HERO --- */
.container, .container-modulo-premium {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 40px 16px;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.modulo-header-premium {
    margin-bottom: 28px;
    text-align: left;
    background: transparent !important;
}

.header-tag {
    display: inline-block;
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 9999px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.modulo-header-premium h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    word-break: break-word;
}

.modulo-header-premium p {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.section-block {
    margin-bottom: 36px;
}

/* --- GRADE DE CARDS (MOBILE FIRST: 1 COLUNA) --- */
.linear-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    width: 100%;
}

.linear-card {
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.linear-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2;
}

.linear-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(2, 132, 199, 0.25);
    border-color: rgba(56, 189, 248, 0.5);
}

.linear-card:hover::before {
    opacity: 1;
}

.linear-card-image {
    width: 100%;
    height: 190px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.linear-card:hover .linear-card-image {
    transform: scale(1.03);
}

.linear-card-footer {
    padding: 14px 16px;
    background-color: rgba(15, 23, 42, 0.6);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.linear-card-title {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
    word-break: break-word;
}

.linear-card-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background-color: var(--primary);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.linear-card:hover .linear-card-btn {
    background-color: var(--primary-dark);
    transform: scale(1.1);
}

/* --- SEÇÃO DE SERVIÇOS (MOBILE FIRST: 1 COLUNA) --- */
.section-title-wrapper {
    margin-bottom: 16px;
}

.section-title-wrapper h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 4px 0;
}

.section-title-wrapper p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.service-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    transition: border-color 0.3s ease;
}

.service-card:hover {
    border-color: rgba(56, 189, 248, 0.5);
}

.service-header {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.service-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.blue-theme .service-icon { background-color: rgba(2, 132, 199, 0.15); color: var(--accent); }
.indigo-theme .service-icon { background-color: rgba(79, 70, 229, 0.15); color: #818cf8; }

.service-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 4px 0;
    word-break: break-word;
}

.service-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.btn-service {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: none;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-service:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-blue { background-color: var(--primary); color: #ffffff; }
.btn-indigo { background-color: #4f46e5; color: #ffffff; }


/* ==========================================================================
   MODAL, DIALOG & TOASTS - MOBILE FIRST & CORREÇÃO DEFINITIVA DE POSICIONAMENTO
   ========================================================================== */

.dialog-backdrop, 
.custom-toast-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dialog-backdrop.active,
.custom-toast-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.dialog-container {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    box-sizing: border-box;
    margin: auto;
}

.dialog-content {
    position: relative;
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 88vh;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.dialog-backdrop.active .dialog-content {
    transform: scale(1);
}

/* Botão X fixo de forma segura no canto superior direito interno do modal */
.dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 50;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dialog-close:hover {
    background-color: var(--primary);
    color: #ffffff;
}

.modal-grid-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.modal-image-wrapper {
    position: relative;
    width: 100%;
    height: 190px;
    flex-shrink: 0;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-badge-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 10px 0;
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: break-word;
}

.modal-details p, 
.modal-details span {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.5;
    margin-bottom: 8px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.modal-details strong {
    color: var(--text-main);
}

/* --- TOASTS / NOTIFICAÇÕES --- */
.custom-toast-backdrop {
    z-index: 10000;
}

.custom-toast-card {
    background-color: #1e293b;
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transform: translateY(10px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.custom-toast-backdrop.active .custom-toast-card {
    transform: translateY(0) scale(1);
}

.toast-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 10px 16px;
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    flex-grow: 1;
    word-break: break-word;
}

.toast-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.toast-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.toast-body {
    padding: 0 16px 14px 16px;
}

.toast-body p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    word-break: break-word;
}

.toast-footer {
    padding: 10px 16px 16px 16px;
    display: flex;
    justify-content: flex-end;
}

.btn-toast-confirm {
    background-color: #4f46e5;
    color: #ffffff;
    border: none;
    padding: 9px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn-toast-confirm:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* --- RODAPÉ --- */
.app-footer {
    width: 100%;
    background-color: #0b1329;
    color: var(--text-main);
    margin-top: 40px;
    padding: 36px 16px 20px 16px;
    border-top: 1px solid #1e293b;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
}

.footer-brand {
    margin-bottom: 20px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    color: #ffffff;
    margin-bottom: 6px;
    font-weight: 700;
}

.footer-brand p {
    color: #94a3b8;
    font-size: 0.85rem;
    max-width: 600px;
    margin: 0;
    line-height: 1.5;
}

.footer-copyright {
    border-top: 1px solid #1e293b;
    padding-top: 20px;
    text-align: center;
}

.footer-copyright p {
    color: #64748b;
    font-size: 0.78rem;
    margin: 0;
}


/* ==========================================================================
   BREAKPOINTS: EXPANSÃO PARA TABLETS E DESKTOPS (min-width)
   ========================================================================== */

@media screen and (min-width: 768px) {
    .header-container {
        padding: 14px 20px;
    }

    .brand-title {
        font-size: 1.15rem;
    }

    .container, .container-modulo-premium {
        padding: 36px 20px 60px 20px;
    }

    .modulo-header-premium h1 {
        font-size: 2.2rem;
    }

    .linear-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .linear-card.card-featured {
        grid-column: 1 / -1;
    }

    .linear-card-image {
        height: 220px;
    }

    .linear-card.card-featured .linear-card-image {
        height: 280px;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .dialog-backdrop, 
    .custom-toast-backdrop {
        padding: 20px;
    }

    .dialog-container {
        max-width: 900px;
    }

    .modal-grid-layout {
        display: grid;
        grid-template-columns: 1.1fr 1fr;
    }

    .modal-image-wrapper {
        height: 100%;
        min-height: 350px;
    }

    .modal-image {
        max-height: none;
    }

    .modal-body {
        padding: 28px;
        justify-content: center;
    }

    .modal-title {
        font-size: 1.65rem;
        margin-bottom: 16px;
    }

    .modal-details p {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }
    
    .dialog-close {
        top: 16px;
        right: 16px;
    }

    .app-footer {
        padding: 48px 20px 24px 20px;
    }
}