/* Light-green theme for digimus public pages. */
:root {
    --green-50:  #f6fbf2;
    --green-100: #eaf7e1;
    --green-200: #d6efc6;
    --green-300: #b9e3a7;
    --green-400: #9ad08a;
    --green-500: #7cc36b;
    --green-600: #5ea655;
    --green-700: #3f7a3a;
    --green-800: #1f3d1a;
    --ink: #1f2a1a;
    --ink-soft: #475044;
    --line: #d8e7ce;
    --bg: #f6fbf2;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}
a { color: var(--green-700); }
a:hover { color: var(--green-800); }
h1, h2, h3 { color: var(--green-800); letter-spacing: -0.01em; }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--green-800); color: #fff; padding: 0.5rem 1rem;
}
.skip-link:focus { left: 0; z-index: 10; }

/* ----- topbar ----- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: linear-gradient(135deg, var(--green-600), var(--green-500));
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky; top: 0; z-index: 6;
}
.topbar__hamburger {
    display: none;
    width: 38px; height: 38px;
    flex-direction: column;
    justify-content: space-around;
    padding: 8px 6px;
    cursor: pointer;
    border-radius: 6px;
    user-select: none;
    background: rgba(255,255,255,0.10);
}
.topbar__hamburger:hover { background: rgba(255,255,255,0.18); }
.topbar__hamburger span {
    display: block;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    pointer-events: none;
}
.drawer-toggle { position: absolute; left: -9999px; }
.drawer-backdrop { display: none; }
.brand { display: flex; align-items: center; gap: 0.7rem; color: #fff; text-decoration: none; font-weight: 600; }
.brand__logo {
    width: 32px; height: 32px;
    /* White rounded backdrop gives the green leaf-mark contrast against the
       green topbar gradient. */
    background: #ffffff;
    border-radius: 8px;
    padding: 3px;
    display: block;
    box-shadow: 0 1px 2px rgba(0,0,0,0.10);
}
.brand__name { font-size: 1.05rem; }
.topbar__nav { display: flex; align-items: center; gap: 1rem; }
.topbar__nav a { color: #fff; text-decoration: none; opacity: 0.92; }
.topbar__nav a:hover { opacity: 1; text-decoration: underline; }
.topbar__user { opacity: 0.85; font-size: 0.9rem; }

/* ----- layout ----- */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    min-height: calc(100vh - 56px - 60px);
}

/* User-nav strip inside the sidebar — visible only inside the mobile drawer. */
.sidebar__user-nav { display: none; }

/* ----- sidebar ----- */
.sidebar {
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 1.25rem 0.75rem;
    position: sticky; top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}
.sidebar__title {
    margin: 0 0.5rem 0.75rem;
    font-size: 0.8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--green-700);
}
.sidebar__list { list-style: none; padding: 0; margin: 0; }
.sidebar__item a {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    color: var(--ink); text-decoration: none;
    font-size: 0.95rem;
}
.sidebar__item a:hover { background: var(--green-100); color: var(--green-800); }
.sidebar__item.is-active > a {
    background: var(--green-200); color: var(--green-800); font-weight: 600;
}
.sidebar__icon { width: 1.3em; text-align: center; flex-shrink: 0; }
.sidebar__label { flex: 1; }
.sidebar__cta {
    display: block;
    margin: 1rem 0.5rem 0;
    padding: 0.55rem 0.8rem;
    background: var(--green-600);
    color: #fff;
    text-decoration: none;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s ease;
}
.sidebar__cta:hover { background: var(--green-700); color: #fff; }

/* ----- main content ----- */
.content {
    padding: 2rem 2rem 3rem;
    max-width: 1100px;
}
@media (max-width: 760px) { .content { padding: 1.25rem; } }

.hero {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.hero h1 { margin: 0 0 0.4rem; font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
.hero__tagline { margin: 0 0 1rem; color: var(--green-700); font-weight: 500; }
.hero__lead { margin: 0; color: var(--ink-soft); max-width: 60ch; }

.section { margin-bottom: 2.5rem; }
.section__title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    border-bottom: 2px solid var(--green-200);
    padding-bottom: 0.4rem;
}

/* category cards grid */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.card {
    display: flex; align-items: flex-start; gap: 0.9rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.card:hover {
    transform: translateY(-2px);
    border-color: var(--green-400);
    box-shadow: 0 4px 12px rgba(60, 120, 50, 0.10);
}
.card__icon { font-size: 1.6rem; line-height: 1; }
.card__body { flex: 1; }
.card__title { margin: 0 0 0.3rem; font-size: 1.05rem; }
.card__desc { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.9rem; }
.card__meta { margin: 0; color: var(--green-700); font-size: 0.8rem; font-weight: 600; }

/* page heading */
.page-head { margin-bottom: 1.5rem; }
.page-head__crumbs {
    margin: 0 0 0.3rem;
    color: var(--ink-soft); font-size: 0.85rem;
}
.page-head__crumbs a { color: var(--green-700); text-decoration: none; }
.page-head__crumbs a:hover { text-decoration: underline; }
.page-head__title { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); }
.page-head__lead { margin: 0.4rem 0 0; color: var(--ink-soft); max-width: 70ch; }

/* item lists */
.items { list-style: none; padding: 0; margin: 0; }
.items--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}
.items__entry {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.items__entry:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(60,120,50,0.10); }
.items__thumb {
    display: block;
    aspect-ratio: 16 / 10;
    background: var(--green-100);
    overflow: hidden;
}
.items__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.items__body { padding: 0.85rem 1rem 1rem; }
.items__category {
    margin: 0 0 0.25rem; font-size: 0.78rem;
    color: var(--green-700); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.items__title { margin: 0 0 0.25rem; font-size: 1.05rem; }
.items__title a { color: inherit; text-decoration: none; }
.items__title a:hover { color: var(--green-700); }
.items__year { margin: 0 0 0.4rem; color: var(--ink-soft); font-size: 0.85rem; }
.items__desc { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.9rem; }
.items__meta { margin: 0; color: var(--ink-soft); font-size: 0.78rem; }

/* item detail */
.item { max-width: 820px; }
.item__media, .item__video {
    margin: 0 0 1.25rem;
    background: var(--green-100);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.item__media img { display: block; width: 100%; height: auto; }
.item__video { position: relative; padding-top: 56.25%; }
.item__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.item__desc {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.65;
}
.item__links { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.item__meta {
    display: flex; flex-wrap: wrap; gap: 1rem;
    padding-top: 1rem; border-top: 1px solid var(--line);
    color: var(--ink-soft); font-size: 0.85rem;
}
.item__meta a { color: var(--green-700); }

.empty {
    padding: 2rem; text-align: center;
    background: #fff; border: 1px dashed var(--green-300); border-radius: 12px;
    color: var(--ink-soft);
}

.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    background: var(--green-600);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.15s ease;
}
.btn:hover { background: var(--green-700); color: #fff; }
.btn--outline { background: #fff; color: var(--green-700); border: 1.5px solid var(--green-500); }
.btn--outline:hover { background: var(--green-100); color: var(--green-800); }

.footer { text-align: center; padding: 1.5rem 1rem; color: var(--ink-soft); font-size: 0.85rem; }

/* ----- ghost CTA + messages + submission form ----- */
.sidebar__cta--ghost {
    background: #fff;
    color: var(--green-700);
    border: 1.5px dashed var(--green-400);
}
.sidebar__cta--ghost:hover { background: var(--green-100); color: var(--green-800); }

.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.messages__item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--green-100);
    border: 1px solid var(--green-200);
    color: var(--green-800);
    margin-bottom: 0.5rem;
}
.messages__item--error { background: #fdeceb; border-color: #f5b3ae; color: #8a1a13; }

.form { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; max-width: 720px; }
.form__row { margin-bottom: 1rem; }
.form__label { display: block; font-weight: 600; color: var(--green-800); margin-bottom: 0.3rem; }
.form__req { color: #c0392b; font-weight: 700; }
.form input[type="text"], .form input[type="url"], .form input[type="number"],
.form input[type="file"], .form textarea, .form select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font: inherit;
    border: 1px solid var(--green-200);
    border-radius: 8px;
    background: #fbfdf8;
    color: var(--ink);
}
.form input:focus, .form textarea:focus, .form select:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(124, 195, 107, 0.25);
    background: #fff;
}
.form__help { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.form__error { margin: 0.3rem 0 0; font-size: 0.85rem; color: #8a1a13; }
.form__errors { margin-bottom: 1rem; padding: 0.75rem 1rem; background: #fdeceb; border: 1px solid #f5b3ae; border-radius: 8px; color: #8a1a13; }
.form__actions { margin-top: 1.25rem; display: flex; gap: 0.6rem; }

/* ----- review queue ----- */
.topbar__badge {
    display: inline-block;
    min-width: 1.4em;
    padding: 0.05em 0.45em;
    margin-left: 0.25em;
    background: #fff;
    color: var(--green-700);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    vertical-align: 0.05em;
}
.review-bulk {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 1.25rem;
}
.review-bulk__count { margin: 0; color: var(--green-800); font-weight: 600; }
.review-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.review-item {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 1.2rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem;
}
@media (max-width: 760px) {
    .review-item { grid-template-columns: 1fr; }
}
.review-item__media {
    width: 160px; height: 110px;
    background: var(--green-100);
    border-radius: 8px;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.review-item__media img { width: 100%; height: 100%; object-fit: cover; }
.review-item__placeholder { font-size: 2.5rem; color: var(--green-600); }
.review-item__body { min-width: 0; }
.review-item__meta { margin: 0 0 0.3rem; color: var(--ink-soft); font-size: 0.85rem; }
.review-item__title { margin: 0 0 0.4rem; font-size: 1.1rem; }
.review-item__desc { margin: 0 0 0.5rem; color: var(--ink); font-size: 0.92rem; }
.review-item__links { list-style: none; padding: 0; margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.85rem; }
.review-item__actions {
    display: flex; flex-direction: column; gap: 0.4rem;
    align-self: flex-start;
}
.review-item__actions form { display: flex; flex-direction: column; gap: 0.4rem; min-width: 130px; }
.btn--danger { color: #8a1a13; border-color: #f5b3ae; }
.btn--danger:hover { background: #fdeceb; color: #6b140f; }

/* ----- my-items page ----- */
.my-items {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.my-items th, .my-items td {
    text-align: left;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.my-items thead th {
    background: var(--green-100);
    color: var(--green-800);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.my-items tbody tr:last-child td { border-bottom: 0; }
.my-items tbody tr:hover { background: var(--green-50); }
.my-items__title { font-weight: 600; }
.my-items__date { color: var(--ink-soft); white-space: nowrap; }
.my-items__actions { display: flex; gap: 0.8rem; }
.my-items__actions a { color: var(--green-700); text-decoration: none; font-weight: 500; }
.my-items__actions a:hover { text-decoration: underline; }

.status {
    display: inline-block;
    padding: 0.15em 0.6em;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status--ok       { background: #d6efc6; color: #1f3d1a; }
.status--pending  { background: #fff3cd; color: #715a16; }
.status--rejected { background: #fdeceb; color: #8a1a13; }

.my-items-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   Mobile (≤760 px): collapsible drawer for the sidebar +
   compact topbar that hides desktop-only links.
   ============================================================ */
@media (max-width: 760px) {
    .topbar { padding: 0.6rem 0.9rem; gap: 0.5rem; }
    .topbar__hamburger { display: inline-flex; }
    .brand__name { display: none; }     /* keep the logo only */
    .brand { flex: 1; }                 /* let brand center take remaining width */
    .topbar__link--desktop { display: none; }
    .topbar__nav { gap: 0.6rem; }

    .layout { display: block; }
    .content { padding: 1.25rem 1rem 2.5rem; max-width: 100%; }

    /* Sidebar becomes a slide-in drawer pinned to the viewport. */
    .sidebar {
        position: fixed;
        top: 56px;
        bottom: 0;
        left: 0;
        width: 280px;
        height: auto;
        max-width: 85vw;
        z-index: 10;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 16px rgba(0,0,0,0.15);
        border-right: 1px solid var(--line);
        border-bottom: 0;
        overflow-y: auto;
    }

    /* Backdrop covers everything but the topbar; tapping it closes the drawer
       because clicking the <label> toggles the underlying checkbox. */
    .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 56px 0 0 0;
        background: rgba(0,0,0,0.45);
        z-index: 9;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    .drawer-toggle:checked ~ .layout .sidebar { transform: translateX(0); }
    .drawer-toggle:checked ~ .drawer-backdrop { opacity: 1; pointer-events: auto; }

    /* Show duplicated user-nav inside the drawer. */
    .sidebar__user-nav {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        padding-bottom: 0.85rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid var(--line);
    }
    .sidebar__user-nav a {
        padding: 0.5rem 0.7rem;
        color: var(--green-800);
        text-decoration: none;
        border-radius: 8px;
        font-weight: 500;
    }
    .sidebar__user-nav a:hover { background: var(--green-100); }

    /* Hero + cards a bit tighter on small screens. */
    .hero { padding: 1.25rem; }
    .cards { grid-template-columns: 1fr; }
    .items--grid { grid-template-columns: 1fr 1fr; gap: 0.85rem; }
    .form { padding: 1.1rem; }
    .review-bulk { flex-direction: column; align-items: stretch; gap: 0.7rem; text-align: center; }
}

@media (max-width: 420px) {
    .items--grid { grid-template-columns: 1fr; }
}
