/* CrowTech Server Control Panel – admin felület */

:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --text: #1b2233;
    --muted: #5d6679;
    --border: #e2e6ee;
    --primary: #4f46e5;
    --sidebar-bg: #111827;
    --sidebar-text: #c7cdda;
    --sidebar-active: #1f2937;
    --ok: #15803d;
    --ok-bg: #dcfce7;
    --error: #b91c1c;
    --error-bg: #fee2e2;
    --pending: #92600a;
    --pending-bg: #fef3c7;
    --radius: 14px;
    --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
    --sidebar-width: 264px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1020;
        --surface: #151b2e;
        --text: #e6e9f2;
        --muted: #9aa3b8;
        --border: #263049;
        --sidebar-bg: #0a0f1d;
        --sidebar-active: #18203a;
        --ok: #4ade80;
        --ok-bg: #12301f;
        --error: #f87171;
        --error-bg: #3a1618;
        --pending: #fbbf24;
        --pending-bg: #33280d;
    }
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
}

img {
    max-width: 100%;
}

.icon {
    flex: none;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 100;
    padding: 8px 14px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
}

.skip-link:focus {
    left: 8px;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Elrendezés */

.app {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    padding: 20px 14px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
}

.app.is-sidebar-open .sidebar {
    transform: none;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    background: rgb(0 0 0 / 50%);
}

.app.is-sidebar-open .sidebar-backdrop {
    display: block;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
}

.sidebar__brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    color: #fff;
}

.sidebar__brand-text small {
    color: var(--sidebar-text);
    font-size: 0.75rem;
}

/* A teljes logó sötét hátterű kép: lekerekített csempén jelenik meg, az arányai megmaradnak. */
.sidebar__logo,
.brand-logo {
    display: block;
    height: auto;
    border-radius: 12px;
    background: #01030f;
}

.sidebar__logo--full {
    display: none;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
}

.sidebar__logo--mark {
    flex: none;
    width: 44px;
    border-radius: 10px;
}

.sidebar__footer {
    margin-top: auto;
    padding: 12px 8px 0;
    font-size: 0.75rem;
    opacity: 0.7;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav__label {
    margin: 16px 8px 6px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.6;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}

a.nav__link:hover,
.nav__link.is-active {
    background: var(--sidebar-active);
    color: #fff;
}

.nav__link.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar__title {
    margin: 0;
    margin-right: auto;
    font-size: 1.15rem;
    font-weight: 600;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.env-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

.footer {
    padding: 16px 20px;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

.section-title {
    margin: 0 0 14px;
    font-size: 1.05rem;
}

/* Kártyák */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
}

.card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

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

.card__label {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.card__value {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    min-height: 26px;
}

.card__description {
    color: var(--muted);
    font-size: 0.85rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.pill::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentcolor;
}

.pill--ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.pill--error {
    background: var(--error-bg);
    color: var(--error);
}

.pill--pending {
    background: var(--pending-bg);
    color: var(--pending);
}

.panel {
    margin-top: 24px;
    padding: 18px;
}

.info-list {
    display: grid;
    margin: 0;
}

.info-list__row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.info-list__row:last-child {
    border-bottom: 0;
}

.info-list dt {
    color: var(--muted);
}

.info-list dd {
    margin: 0;
    font-weight: 500;
    text-align: right;
    overflow-wrap: anywhere;
}

/* Hibaoldalak */

.error-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.error-page__logo {
    display: block;
    height: auto;
    margin: 0 auto 16px;
    border-radius: 18px;
}

.error-page {
    width: 100%;
    max-width: 640px;
    padding: 36px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.error-page__code {
    margin: 12px 0 0;
    color: var(--primary);
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
}

.error-page__title {
    margin: 8px 0;
    font-size: 1.5rem;
}

.error-page__text {
    margin: 0 0 20px;
    color: var(--muted);
}

.error-page__meta {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 0.85rem;
}

.button {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.button:hover {
    filter: brightness(1.1);
}

.debug {
    margin: 0 0 20px;
    padding: 14px;
    border: 1px dashed var(--error);
    border-radius: 10px;
    text-align: left;
    font-size: 0.85rem;
}

.debug__title {
    margin: 0 0 8px;
    color: var(--error);
    font-size: 0.95rem;
}

.debug__location {
    color: var(--muted);
    font-family: var(--mono);
    overflow-wrap: anywhere;
}

.debug__trace {
    max-height: 280px;
    margin: 0;
    padding: 10px;
    overflow: auto;
    background: var(--bg);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 0.78rem;
}

/* Hitelesítés, űrlapok */

button.button {
    border: 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.button--block {
    width: 100%;
    text-align: center;
}

.button--ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
}

.button--ghost:hover {
    background: var(--bg);
    filter: none;
}

.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card__brand {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-card__brand .brand-logo {
    width: 100%;
    max-width: 300px;
}

.auth-card__brand strong {
    display: block;
}

.auth-card__brand small {
    color: var(--muted);
}

.auth-card__title {
    margin: 0 0 4px;
    font-size: 1.4rem;
}

.auth-card__lead {
    margin: 0 0 20px;
    color: var(--muted);
}

.form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 6px;
}

.field__label {
    font-size: 0.9rem;
    font-weight: 600;
}

.field__hint {
    color: var(--muted);
    font-size: 0.8rem;
}

.input,
.input-group .input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.input:focus-visible,
.button:focus-visible,
.icon-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.input-group {
    position: relative;
}

.input-group .input {
    padding-right: 48px;
}

.input-group__toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.alert {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
}

.alert--error {
    background: var(--error-bg);
    color: var(--error);
}

.alert--success {
    background: var(--ok-bg);
    color: var(--ok);
}

.alert--info {
    background: var(--pending-bg);
    color: var(--pending);
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}

.panel {
    max-width: 560px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu__info {
    display: none;
    line-height: 1.25;
    text-align: right;
}

.user-menu__info strong {
    display: block;
    font-size: 0.9rem;
}

.user-menu__info small {
    color: var(--muted);
    font-size: 0.78rem;
}

.user-menu__form {
    margin: 0;
}

.user-menu__logout-text {
    display: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (min-width: 640px) {
    .user-menu__info,
    .user-menu__logout-text {
        display: block;
    }
}

/* Adminisztrációs modulok: listák, szűrők, táblázatok, jogosultságok */

.panel--narrow {
    max-width: 720px;
}

.panel--wide {
    max-width: none;
}

.panel__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel__header .section-title {
    margin: 0;
}

.panel__header .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.muted {
    color: var(--muted);
    font-weight: 400;
}

.filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 16px 0;
}

.filters__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.filters__actions .button {
    display: inline-flex;
    align-items: center;
}

.form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.button--danger {
    background: var(--error);
    color: #fff;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.sort-link {
    color: inherit;
    text-decoration: none;
}

.sort-link:hover {
    color: var(--primary);
}

.table__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.link--danger {
    color: var(--error);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge--success {
    background: var(--ok-bg);
    color: var(--ok);
}

.badge--danger {
    background: var(--error-bg);
    color: var(--error);
}

.empty-state {
    margin: 24px 0;
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.pagination__info {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.pagination__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination__link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.85rem;
    text-decoration: none;
}

.pagination__link:hover,
.pagination__link.is-current {
    border-color: var(--primary);
    color: var(--primary);
}

.permission-groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.permission-group {
    margin: 0;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.permission-group legend {
    padding: 0 6px;
    font-weight: 600;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
}

.check.is-disabled {
    opacity: 0.55;
}

.check small {
    display: block;
    color: var(--muted);
}

.details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px 16px;
    margin: 0;
}

.details dt {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.plain-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 719px) {
    .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .table tr {
        display: block;
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }

    .table td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 4px;
        border: 0;
        text-align: right;
    }

    .table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 600;
        text-align: left;
    }
}

@media (min-width: 720px) {
    .filters {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        align-items: end;
    }

    .permission-groups {
        grid-template-columns: repeat(2, 1fr);
    }

    .details {
        grid-template-columns: 220px 1fr;
    }

    .details dt {
        margin-top: 0;
    }
}

/* Weboldalak (6. szakasz) */
.badge--pending {
    background: var(--pending-bg);
    color: var(--pending);
}

/* Értesítések (11. szakasz) */
.bell {
    position: relative;
    text-decoration: none;
}

.bell__count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--error);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.notice-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.notice {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: baseline;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.notice.is-unread .notice__title {
    font-weight: 700;
}

.notice__title {
    flex: 1 1 260px;
}

.notice__meta {
    color: var(--muted);
    font-size: 0.8rem;
}

textarea.input {
    min-height: 96px;
    resize: vertical;
    font-family: inherit;
}

.code-preview {
    margin: 12px 0 20px;
    padding: 16px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
}

/* Asztali nézet */

@media (min-width: 960px) {
    .sidebar {
        transform: none;
    }

    .sidebar__logo--full {
        display: block;
    }

    .sidebar__logo--mark,
    .sidebar__brand-text--compact {
        display: none;
    }

    .sidebar__brand {
        justify-content: center;
    }

    .sidebar-backdrop,
    .app.is-sidebar-open .sidebar-backdrop {
        display: none;
    }

    .main {
        margin-left: var(--sidebar-width);
    }

    .icon-button {
        display: none;
    }

    .content {
        padding: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
}

/* Konfigurációkezelés (9. szakasz) */
.page-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.75rem 0 1rem;
    border-bottom: 1px solid var(--border, #d9dee7);
}

.tabs__item {
    padding: 0.5rem 0.9rem;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    color: inherit;
}

.tabs__item.is-active {
    border-bottom-color: var(--primary, #2563eb);
    font-weight: 600;
}

.diff span {
    display: block;
    white-space: pre-wrap;
}

.diff__add {
    background: rgba(22, 163, 74, 0.18);
}

.diff__del {
    background: rgba(220, 38, 38, 0.18);
}