/* ==========================================================================
   Portal de Avisos e Editais - Etec São Sebastião
   Arquitetura CSS: Mobile-First
   ========================================================================== */

:root {
    --etec-red: #B20000;
    --etec-red-hover: #7E0000;
    --etec-red-soft: #fdf2f2;
    --etec-dark: #111111;
    --etec-gray-bg: #f4f5f7;
    --etec-card-border: #dee2e6;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--etec-gray-bg);
    color: #212529;
}

/* Layout Flex para impedir que os editais sobreponham o rodapé */
body.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main.main-content {
    flex: 1 0 auto;
    width: 100%;
    padding-bottom: 2.5rem;
}

/* Topo Institucional (Mobile First) */
.header-institucional {
    background-color: #000000;
    padding: 0.75rem 1rem;
    border-bottom: 3px solid var(--etec-red);
}

.header-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-logos img {
    max-height: 42px;
    width: auto;
    object-fit: contain;
}

/* Navbar Admin Colorida e Elegante */
.adm-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.adm-nav-link {
    color: #343a40;
    font-weight: 500;
    border-radius: 0.4rem;
    padding: 0.45rem 1rem !important;
    transition: all 0.2s ease;
}

.adm-nav-link:hover {
    color: var(--etec-red);
    background-color: var(--etec-red-soft);
}

.adm-nav-link.active {
    color: var(--etec-red) !important;
    background-color: var(--etec-red-soft);
    font-weight: 700;
}

/* Cards do Painel Admin com destaque de cor */
.adm-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-top: 4px solid var(--etec-red);
    border-radius: 0.6rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.adm-title {
    color: var(--etec-red);
    font-weight: 700;
}

.adm-form-control:focus, .adm-form-select:focus {
    border-color: var(--etec-red);
    box-shadow: 0 0 0 0.2rem rgba(178, 0, 0, 0.15);
}

/* Botões com cor viva no Admin */
.btn-adm-submit {
    background: linear-gradient(135deg, #B20000 0%, #850000 100%);
    color: #ffffff !important;
    font-weight: 600;
    border: none;
    border-radius: 0.45rem;
    padding: 0.6rem 1.25rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 3px 8px rgba(178, 0, 0, 0.25);
}

.btn-adm-submit:hover {
    opacity: 0.94;
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(178, 0, 0, 0.32);
}

.btn-adm-edit {
    background-color: #f59e0b;
    color: #ffffff !important;
    font-weight: 600;
    border: none;
    border-radius: 0.375rem;
    padding: 0.35rem 0.85rem;
    transition: background-color 0.15s ease;
}

.btn-adm-edit:hover {
    background-color: #d97706;
}

.btn-adm-delete {
    background-color: #dc3545;
    color: #ffffff !important;
    font-weight: 600;
    border: none;
    border-radius: 0.375rem;
    padding: 0.35rem 0.85rem;
    transition: background-color 0.15s ease;
}

.btn-adm-delete:hover {
    background-color: #bb2d3b;
}

/* Tabela Admin com cabeçalho colorido suave */
.adm-table thead th {
    background-color: var(--etec-red-soft);
    color: #850000;
    font-weight: 700;
    border-bottom: 2px solid #f1aeb5;
    padding: 0.75rem 1rem;
}

.adm-table tbody tr:hover {
    background-color: #fffafa;
}

/* Abas de Categorias (Mobile First: rolagem horizontal suave em telas pequenas) */
.nav-tabs-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs-custom {
    flex-wrap: nowrap;
    border-bottom: none;
    gap: 0.25rem;
}

.nav-tabs-custom .nav-link {
    color: var(--etec-red);
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    transition: all 0.2s ease-in-out;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--etec-red-hover);
    background-color: rgba(178, 0, 0, 0.05);
}

.nav-tabs-custom .nav-link.active {
    color: #ffffff !important;
    background-color: var(--etec-red) !important;
    border-color: var(--etec-red) !important;
}

.nav-tabs-custom .nav-link .badge-counter {
    background-color: rgba(178, 0, 0, 0.12);
    color: var(--etec-red);
    font-size: 0.75rem;
    margin-left: 0.4rem;
}

.nav-tabs-custom .nav-link.active .badge-counter {
    background-color: #ffffff;
    color: var(--etec-red);
}

/* Caixa de Filtros de Pesquisa (Ano + Mês + Palavra-chave) */
.filter-card {
    background: #ffffff;
    border: 1px solid var(--etec-card-border);
    border-left: 4px solid var(--etec-red);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Cards de Editais e Avisos (Mobile First) */
.edital-card {
    background-color: #ffffff;
    border: 1px solid #ced4da;
    border-left: 5px solid var(--etec-red);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edital-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--etec-red);
}

.edital-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
    line-height: 1.35;
    word-break: break-word;
}

.edital-card-desc {
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 0;
    line-height: 1.45;
    word-break: break-word;
}

.edital-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.35rem;
}

.badge-date {
    background-color: #f1f3f5;
    color: #495057;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.3em 0.65em;
    border-radius: 0.35rem;
    border: 1px solid #dee2e6;
}

.btn-etec {
    background-color: var(--etec-red);
    color: #ffffff;
    font-weight: 600;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: 0.375rem;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    transition: background-color 0.2s ease;
}

.btn-etec:hover, .btn-etec:focus {
    background-color: var(--etec-red-hover);
    color: #ffffff;
}

/* Rodapé Flexível (Nunca sobrepõe os editais) */
footer.site-footer {
    flex-shrink: 0;
    margin-top: auto;
    background-color: #000000;
    color: #ffffff;
    padding: 1.1rem 0;
    font-size: 0.85rem;
    border-top: 3px solid var(--etec-red);
    position: static !important;
}

footer.site-footer a {
    color: #ff4d4d;
    text-decoration: none;
    font-weight: 600;
}

footer.site-footer a:hover {
    text-decoration: underline;
    color: #ff8080;
}

/* Breakpoints: Tablet e Desktop (min-width: 576px e 768px) */
@media (min-width: 576px) {
    .btn-etec-Action {
        width: auto;
        min-width: 130px;
    }
}

@media (min-width: 768px) {
    .header-logos {
        justify-content: flex-start;
        gap: 1.75rem;
    }

    .header-logos img {
        max-height: 54px;
    }

    .nav-tabs-custom {
        flex-wrap: wrap;
    }

    .edital-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1.25rem 1.5rem;
    }

    .edital-card-title {
        font-size: 1.08rem;
    }

    .filter-card {
        padding: 1.25rem 1.5rem;
    }
}
