:root {
    --bg: #f6f4ee;
    --card: #ffffff;
    --line: #dde3dc;
    --ink: #16332a;
    --muted: #5c7469;
    --brand: #0f4c3a;
    --brand-2: #0a3327;
    --brand-soft: #e7f1ec;
    --accent: #e8974a;
    --accent-2: #c47a34;
    --accent-soft: #fbe9d7;
    --ok: #e3f4e9;
    --ok-ink: #1c5d3e;
    --error: #ffe6e6;
    --error-ink: #871c1c;
    --shadow: 0 20px 36px rgba(15, 45, 35, 0.14);
    --glow-1: #dcefe6;
    --glow-2: #f6e3cd;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 8%, var(--glow-1), transparent 40%),
        radial-gradient(circle at 92% 92%, var(--glow-2), transparent 38%),
        var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--brand);
    text-decoration: none;
}

img {
    max-width: 100%;
}

h1,
h2,
h3 {
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--brand-2);
    line-height: 1.3;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.6rem;
    width: 100%;
    flex: 1;
}

/* ===== Topbar ===== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.6rem;
    background: rgba(250, 249, 245, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-logo {
    max-width: 150px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 45, 35, 0.14);
}

.brand-affiliation {
    display: none;
    padding-left: 0.7rem;
    border-left: 1px solid var(--line);
    line-height: 1.15;
}

.brand-affiliation strong {
    display: block;
    font-size: 0.78rem;
    color: var(--ink);
    font-weight: 700;
}

.brand-affiliation span {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}

@media (min-width: 860px) {
    .brand-affiliation {
        display: block;
    }
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.main-nav a {
    padding: 0.5rem 0.75rem;
    border-radius: 9px;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.94rem;
    transition: all 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
    background: var(--brand-soft);
    color: var(--brand);
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: 0 6px 16px rgba(196, 122, 52, 0.32);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
}

.cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(196, 122, 52, 0.4);
    color: #fff;
}

/* ===== Hero ===== */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.1rem;
    padding: 3.6rem 1.5rem 3rem;
    margin: -1.6rem -1.6rem 0;
    border-radius: 0 0 32px 32px;
    background:
        radial-gradient(circle at 12% 20%, rgba(15, 76, 58, 0.07), transparent 45%),
        radial-gradient(circle at 88% 15%, rgba(232, 151, 74, 0.12), transparent 40%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
    animation: fade-up 0.5s ease;
}

.hero-logo {
    max-width: 300px;
    height: auto;
    margin-bottom: 0.2rem;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.85rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-2);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    font-size: 2.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    max-width: 780px;
    line-height: 1.25;
    color: var(--brand-2);
}

.hero p {
    margin: 0;
    max-width: 660px;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
}

/* ===== Sections / cards ===== */

.section {
    margin: 2.4rem 0;
    animation: fade-up 0.45s ease;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
}

.section-head h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--brand-2);
}

.section-head .see-all {
    font-weight: 700;
    color: var(--brand);
}

/* ===== Faixa institucional (vinculo com a UFRN) ===== */

.institutional {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.8rem;
    padding: 2.2rem 2.4rem;
    border-radius: 22px;
    background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(10, 51, 39, 0.22);
}

.institutional-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 112px;
    height: 112px;
    flex-shrink: 0;
    padding: 18px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(10, 51, 39, 0.2);
}

.institutional-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.institutional-body h2 {
    margin: 0 0 0.5rem;
    font-size: 1.3rem;
    color: #ffffff;
}

.institutional-body p {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.65;
    max-width: 760px;
}

.institutional-body p + p {
    margin-top: 0.6rem;
}

@media (max-width: 720px) {
    .institutional {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        padding: 1.8rem;
    }
}

/* ===== Noticias: lista vertical com cards largos ===== */

.news-list {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.news-row {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 8px 22px rgba(15, 45, 35, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.news-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 45, 35, 0.15);
}

.news-row-image {
    width: 320px;
    min-width: 320px;
    object-fit: cover;
    background: var(--brand-soft);
}

.news-row-image-placeholder {
    width: 320px;
    min-width: 320px;
    background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft));
}

.news-row-body {
    padding: 1.8rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.7rem;
    min-width: 0;
}

.news-row-body h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--ink);
}

.news-row-desc {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.65;
}

.news-row-meta {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

@media (max-width: 720px) {
    .news-row {
        flex-direction: column;
    }

    .news-row-image,
    .news-row-image-placeholder {
        width: 100%;
        min-width: 0;
        height: 200px;
    }

    .news-row-body {
        padding: 1.4rem 1.5rem;
    }
}

.card {
    display: block;
    padding: 1.4rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 45, 35, 0.07);
}

.lift {
    animation: fade-up 0.45s ease;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.1rem;
}

.card-grid.explore-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.item-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 45, 35, 0.07);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 26px rgba(15, 45, 35, 0.14);
}

.item-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--brand-soft);
}

.item-card-image.item-card-image-contain {
    object-fit: contain;
    padding: 1.1rem;
}

.item-card-image.round {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    margin: 1.4rem auto 0;
}

.item-card-body {
    padding: 1.1rem 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.item-card-body h3 {
    margin: 0;
    font-size: 1.08rem;
}

.item-card-tag {
    display: inline-flex;
    align-self: flex-start;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-2);
    font-size: 0.76rem;
    font-weight: 700;
}

.item-card-desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.item-card-meta {
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--muted);
}

.item-card-link {
    margin-top: 0.4rem;
    font-weight: 700;
    color: var(--brand);
}

.team-card {
    text-align: center;
}

.team-card .item-card-body {
    align-items: center;
}

.team-card .item-card-tag {
    align-self: center;
}

.empty-state {
    padding: 2.4rem 1rem;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 16px;
    background: var(--card);
}

/* ===== News detail / article ===== */

.article {
    max-width: 760px;
    margin: 0 auto;
}

.article img {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 1.2rem;
}

.article h1 {
    margin: 0 0 0.4rem;
}

.article-meta {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 1.4rem;
}

.article-cta {
    margin-top: 1.2rem;
}

.article-body {
    line-height: 1.7;
    font-size: 1.02rem;
}

/* ===== Conteudo gerado pelo editor de texto rico (Quill) ===== */

.richtext-content h2,
.richtext-content h3 {
    margin: 1.2rem 0 0.5rem;
}

.richtext-content p {
    margin: 0 0 0.9rem;
}

.richtext-content ul,
.richtext-content ol {
    margin: 0 0 0.9rem;
    padding-left: 1.4rem;
}

.richtext-content li {
    margin-bottom: 0.3rem;
}

.richtext-content blockquote {
    margin: 0 0 0.9rem;
    padding: 0.6rem 1rem;
    border-left: 4px solid var(--brand);
    background: var(--brand-soft);
    color: var(--ink);
    border-radius: 0 10px 10px 0;
}

.richtext-content a {
    font-weight: 700;
    text-decoration: underline;
}

.richtext-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 0.6rem 0;
}

/* ===== Editor de texto rico (admin) ===== */

.richtext-editor {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fdfdfb;
    text-transform: none;
    font-weight: 400;
    color: var(--ink);
}

.richtext-toolbar.ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid var(--line);
    background: var(--brand-soft);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.35rem;
}

.richtext-container {
    min-height: 220px;
}

.richtext-container .ql-editor {
    min-height: 220px;
    font-size: 1rem;
    font-family: inherit;
}

/* O seletor "ql-snow .ql-toolbar button" do Quill fixa width:28px/padding:3px 5px
   pra qualquer <button> dentro da toolbar (pensado pra botoes so-icone) - isso
   espremia o texto do botao de anexar arquivo. Precisa de mais classes no
   seletor pra vencer essa regra por especificidade. */
.richtext-toolbar.ql-toolbar .richtext-file-btn {
    width: auto;
    height: 24px;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    float: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: #444;
}

/* Mesma razao: .ql-snow .ql-picker.ql-header fixa width:98px, curto demais
   pros rotulos em portugues ("Texto normal", "Título 2"). */
.richtext-toolbar.ql-toolbar .ql-picker.ql-header {
    width: 130px;
}

.edit-form-image-preview {
    max-width: 180px;
    border-radius: 10px;
    margin-top: 0.4rem;
}

/* ===== Buttons ===== */

button,
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 0.65rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

button:not(.btn-secondary),
.btn-primary {
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff;
}

button:not(.btn-secondary):hover,
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 45, 35, 0.26);
    color: #fff;
}

.btn-secondary {
    background: var(--brand-soft);
    color: var(--brand-2);
    border: 1px solid var(--brand);
}

.btn-secondary:hover {
    background: var(--brand);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(120deg, #b94242, #8a2f2f);
    color: #fff;
}

/* ===== Forms ===== */

label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 0.9rem;
}

/* Mesmo visual de label, mas sem ser um <label> de verdade - usado no campo de
   texto rico (ver comentario no edit_form.html sobre o bug de clique). */
.field-block {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

.field-label-text {
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.58rem 0.7rem;
    background: #fdfdfb;
    color: var(--ink);
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 76, 58, 0.16);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: none;
}

.checkbox-row input {
    width: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.2rem;
}

.form-actions {
    display: flex;
    gap: 0.7rem;
    margin-top: 0.6rem;
}

.narrow {
    max-width: 440px;
    margin: 8vh auto;
}

.muted {
    color: var(--muted);
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 0.8rem;
}

.login-logo {
    max-width: 220px;
    height: 72px;
    object-fit: contain;
    background: #fff;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(15, 45, 35, 0.18);
}

/* ===== Messages ===== */

.messages {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.msg {
    padding: 0.62rem 0.85rem;
    border-radius: 10px;
    border: 1px solid transparent;
}

.msg.success {
    background: var(--ok);
    color: var(--ok-ink);
    border-color: #b9dfc8;
}

.msg.error {
    background: var(--error);
    color: var(--error-ink);
    border-color: #f7baba;
}

/* ===== Admin ===== */

.admin-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.4rem;
}

.admin-side {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.admin-side a {
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.92rem;
}

.admin-side a:hover,
.admin-side a.active {
    background: var(--brand-soft);
    color: var(--brand-2);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}

.stat-card {
    display: block;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(150deg, #ffffff 10%, #f6faf8 100%);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 45, 35, 0.14);
}

.stat-card strong {
    display: block;
    font-size: 1.7rem;
    color: var(--brand-2);
}

.stat-card span {
    color: var(--muted);
    font-size: 0.86rem;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    padding: 0.65rem 0.8rem;
    font-size: 0.88rem;
}

th {
    background: var(--brand-soft);
    color: var(--brand-2);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: var(--brand-soft);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
}

.status-badge.published {
    background: var(--brand-soft);
    color: var(--brand-2);
    border: 1px solid var(--line);
}

.status-badge.unpublished {
    background: #f2f3f2;
    color: #556155;
    border: 1px solid #d7dcd7;
}

.action-group {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.action-group form {
    margin: 0;
}

.action-btn {
    padding: 0.35rem 0.6rem;
    border-radius: 9px;
    font-size: 0.78rem;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.section-title-row h1,
.section-title-row h2 {
    margin: 0;
}

.admin-block + .admin-block {
    margin-top: 1.4rem;
}

.password-details summary {
    cursor: pointer;
    list-style: none;
}

.password-details summary::-webkit-details-marker {
    display: none;
}

.inline-password-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.inline-password-form input {
    width: auto;
    min-width: 140px;
}

/* ===== Footer ===== */

.footer-ufrn-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    margin-bottom: 0.1rem;
    opacity: 0.85;
}

.site-footer {
    margin-top: 3rem;
    padding: 1.6rem;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.6);
    text-align: center;
    color: var(--muted);
    font-size: 0.86rem;
}

.site-footer p {
    margin: 0.3rem 0;
}

.site-footer a {
    color: var(--muted);
    text-decoration: underline;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-side {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .topbar {
        justify-content: center;
    }

    .main-nav {
        justify-content: center;
    }

    .container {
        padding: 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }
}
