@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    --primary: #34994a;
    --primary-dark: #2a7a3b;
    --primary-soft: rgba(52, 153, 74, 0.12);
    --accent-teal: #0d9488;
    --accent-orange: #ea580c;
    --nav-bg: #090909;
    --bg: #f6f8f6;
    --surface: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.06);
    --shadow: 0 16px 40px rgba(17, 24, 39, 0.08);
    --radius: 18px;
    --radius-sm: 14px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.portal-body,
body.admin-body {
    margin: 0;
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0% 0%, rgba(52, 153, 74, 0.07), transparent 32%),
        radial-gradient(circle at 100% 10%, rgba(13, 148, 136, 0.06), transparent 28%),
        var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navbar ── */
.portal-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
}

.portal-navbar__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.portal-navbar__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    justify-self: start;
}

.portal-navbar__title {
    margin: 0;
    justify-self: center;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #fff;
    text-align: center;
    white-space: nowrap;
}

.portal-navbar__logo {
    height: 38px;
    width: auto;
    max-width: min(220px, 55vw);
    object-fit: contain;
    display: block;
}

.portal-navbar__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    justify-self: end;
}

.portal-navbar__admin {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.portal-navbar__admin:hover {
    background: rgba(52, 153, 74, 0.22);
    border-color: rgba(131, 181, 94, 0.55);
    color: #fff;
}

.portal-navbar__admin svg {
    width: 15px;
    height: 15px;
}

.portal-navbar__stripe {
    height: 3px;
    background: linear-gradient(
        90deg,
        #c0392b 0%,
        #ea580c 20%,
        #83b55e 45%,
        #34994a 65%,
        #0d9488 85%,
        #0891b2 100%
    );
}

/* ── Main ── */
.portal-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.25rem 1.5rem 1.5rem;
}

.portal-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.portal-hero__subtitle {
    margin: 0 auto 1.25rem;
    max-width: 480px;
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.55;
}

.portal-search {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.95rem 1.15rem;
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-search:focus-within {
    border-color: rgba(52, 153, 74, 0.5);
    box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow);
}

.portal-search svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.portal-search input {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.98rem;
    outline: none;
}

.portal-search input::placeholder {
    color: #9ca3af;
}

.portal-search__count {
    font-size: 0.78rem;
    color: var(--primary-dark);
    background: var(--primary-soft);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 600;
}

.portal-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.1rem;
}

.portal-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
    box-shadow: var(--shadow-sm);
}

.portal-stat svg {
    width: 14px;
    height: 14px;
    color: var(--primary);
}

.portal-stat strong {
    color: var(--text);
}

.portal-jump {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.portal-jump__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s ease;
}

.portal-jump__link svg {
    width: 14px;
    height: 14px;
}

.portal-jump__link:hover,
.portal-jump__link.is-active {
    color: var(--primary-dark);
    border-color: rgba(52, 153, 74, 0.35);
    background: var(--primary-soft);
}

.portal-jump__link.is-active {
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ── Categories ── */
.category-block {
    margin-bottom: 2rem;
    scroll-margin-top: 5rem;
}

.category-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.category-block__title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.category-block__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-soft), rgba(13, 148, 136, 0.1));
    color: var(--primary);
}

.category-block__title h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.category-block__title p {
    margin: 0.15rem 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.category-block__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.category-block__empty {
    padding: 1.5rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    margin: 0;
}

/* ── Link tiles ── */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.85rem;
}

.link-tile {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    min-height: 130px;
}

.link-tile:hover {
    transform: translateY(-4px);
    border-color: rgba(52, 153, 74, 0.35);
    box-shadow: var(--shadow);
}

.link-tile__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.link-tile__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
}

.link-tile__arrow {
    color: #d1d5db;
    transition: color 0.2s ease, transform 0.2s ease;
}

.link-tile:hover .link-tile__arrow {
    color: var(--primary);
    transform: translate(2px, -2px);
}

.link-tile h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.link-tile p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.link-tile__meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
}

.empty-state svg {
    width: 42px;
    height: 42px;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.empty-state h2 {
    margin: 0 0 0.5rem;
    color: var(--text);
}

/* ── Footer (matches header) ── */
.portal-footer {
    padding: 0 1.5rem 1rem;
    margin-top: auto;
}

.portal-footer__bar {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1rem;
    background: var(--nav-bg);
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.portal-footer__bar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        #c0392b 0%,
        #ea580c 20%,
        #83b55e 45%,
        #34994a 65%,
        #0d9488 85%,
        #0891b2 100%
    );
}

.portal-footer__text {
    margin: 0;
    text-align: center;
    color: #fff;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.4;
}

.is-hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .portal-navbar__inner {
        padding: 0.75rem 1rem;
        grid-template-columns: auto 1fr auto;
    }

    .portal-navbar__title {
        font-size: 0.9rem;
    }

    .portal-navbar__logo {
        height: 32px;
    }

    .portal-navbar__admin span {
        display: none;
    }

    .portal-main {
        padding: 1.5rem 1rem 1rem;
    }

    .portal-jump {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }

    .portal-jump__link {
        flex-shrink: 0;
    }

    .category-block__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .links-grid {
        grid-template-columns: 1fr;
    }

    .portal-footer__text {
        font-size: 0.7rem;
    }
}

/* ── Login page ── */
.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.login-card {
    width: min(100%, 420px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.login-card__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    margin-bottom: 0.85rem;
}

.login-card__header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-card__header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.login-alert {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.login-alert--error {
    background: rgba(220, 38, 38, 0.1);
    color: #991b1b;
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-field span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.login-field input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-password {
    position: relative;
}

.login-password input {
    padding-right: 2.75rem;
}

.login-password__toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.login-password__toggle:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.login-password__toggle svg {
    width: 18px;
    height: 18px;
}

.login-field input:focus {
    outline: none;
    border-color: rgba(52, 153, 74, 0.5);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.login-field input::placeholder {
    color: #9ca3af;
}

.login-btn {
    margin-top: 0.25rem;
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.login-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .login-main {
        padding: 1.5rem 1rem;
    }

    .login-card {
        padding: 1.5rem;
    }
}
