@font-face {
    font-family: Inter;
    src: url(../fonts/Inter-VariableFont.ttf);
    font-weight: 400 700;
}

:root {
    --background: #070b1f;
    --text: #eaf0ff;
    --links: #cfd9ff;
    --muted: #aebbe8;
    --faint: #8f9cc9;
    --accent: #7dd3fc;
    --glass: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.14);
    --grad: linear-gradient(135deg, #6366f1, #0ea5e9);
}

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

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { font-size: 14px; }

@media (min-width: 768px) {
    html { font-size: 16px; }
}

body {
    min-height: 100vh;

    font-family: Inter;
    color: var(--text);
    background: var(--background);

    &::before, &::after {
        content: "";
        position: fixed;
        width: 620px;
        height: 620px;
        border-radius: 50%;
        filter: blur(110px);
        opacity: 0.55;
        z-index: -1;
        pointer-events: none;
    }

    &::before {
        background: #6d28d9;
        top: -180px;
        left: -120px;
    }

    &::after {
        background: #0ea5e9;
        bottom: -200px;
        right: -120px;
    }

    section {
        flex: 1;
        width: 100%;
    }
}

header {
    .nav-link, .link-label { color: var(--links); }

    .nav-link, .navbar-brand {
        &:hover { color: var(--faint); }
    }

    .header-bar { row-gap: 0.35rem; }

    .header-nav {
        flex-direction: row;
        margin-right: auto;
    }

    .server-link {
        color: var(--accent);
        background: rgba(125, 211, 252, 0.12);
        padding: 5px 11px;
        border-radius: 999px;
        margin-left: 4px;

        &:hover {
            color: var(--accent);
            background: rgba(125, 211, 252, 0.2);
        }
    }
}

footer {
    .author, .admin-button {
        color: #90e0ef;
        transition: color 0.3s ease;

        &:hover { color: #00b4d8; }
    }
}

main {
    flex: 1;
    padding: 40px 20px 56px;
}

.auth-layout { gap: 2rem; }

@media (max-width: 991.98px) {
    .auth-layout { flex-direction: column; }
}

.main-form, 
.login-form, 
.unreachable-notice,
.card-container,
.confirm {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    padding: 32px;

    .warning-primary { color: var(--err); }
    .warning-secondary { color: var(--faint); }

    .hint {
        font-size: 0.78rem;
        color: var(--faint);
    }

    .input-field {
        label { color: var(--muted); }

        input {
            width: 100%;
            font: inherit;
            color: #fff;
            padding: 12px 14px;
            outline: none;
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.16);
            border-radius: 12px;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

    }

    .submit-button button {
        font: inherit;
        font-weight: 600;
        cursor: pointer;
        border: 0;
        border-radius: 12px;
        padding: 12px 22px;
        transition: transform 0.1s, filter 0.2s;

        width: 100%;
        color: #fff;
        background: var(--grad);
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;

        &:hover { filter: brightness(1.12); }
    }

    .form-control {
        background: transparent;
        border: none;
        border-bottom: 2px solid rgba(255, 255, 255, 0.6);
        border-radius: 0;
        color: white;

        &:focus {
            border-bottom-color: white;
            box-shadow: none;
        }

        &::placeholder { color: rgba(255, 255, 255, 0.4); }
    }

    table {
        code { color: var(--accent); }
    }
}

.confirm { min-width: 320px; }

.top-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 24px;
    width: 100%;
    align-items: stretch;

    > .card-container {
        min-width: 0;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card-body { min-width: 0; }

    h5 { overflow-wrap: anywhere; }

    .top-stat-hostname {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    img { flex-shrink: 0; }
}

@media (max-width: 1199.98px) {
    .top-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
    .top-stats { grid-template-columns: minmax(0, 1fr); }
}

.table-transparent {
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
}

.table-transparent tbody td {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.cookie-list { height: 150px; }

.whitelist-name {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.whitelist-head {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

@media (max-width: 767.98px) {
    .card-container { padding: 1.25rem; }

    .whitelist-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;

        h2 { margin-bottom: 0; }

        form {
            flex-wrap: wrap;
            justify-content: flex-start;
            margin-bottom: 0;
        }

        small {
            flex: 1 1 100%;
            text-align: center;
        }
    }

    .admin-logout,
    .whitelist-toolbar .btn-sm {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem 1rem;
        font-size: 1rem;
        align-content: center;
    }

    .whitelist-table,
    .cookie-table {
        thead { display: none; }

        &,
        tbody,
        tr,
        td {
            display: block;
            width: 100%;
        }

        tr {
            padding: 0.85rem 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);

            &:last-child { border-bottom: 0; }
        }

        td {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 1rem;
            padding: 0.3rem 0;
            border: 0;
            text-align: right;
            overflow-wrap: anywhere;

            &::before {
                content: attr(data-label);
                flex: 0 0 auto;
                color: var(--faint);
                font-size: 0.78rem;
                font-weight: 600;
                letter-spacing: 0.04em;
                text-transform: uppercase;
                text-align: left;
            }

            code { overflow-wrap: anywhere; }
        }

        .table-actions {
            padding-top: 0.7rem;

            &::before { display: none; }

            form, .btn { width: 100%; }
        }
    }

    .table .btn-sm {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem 0.9rem;
        font-size: 1rem;
    }

    .copy-cookie {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        svg {
            width: 20px;
            height: 20px;
        }
    }

    .cookie-list {
        height: auto;
        max-height: 300px;
    }
}

@media (max-width: 767.98px) {
    header {
        .navbar-brand { font-size: 1.75rem; }

        .header-nav .nav-link { font-size: 1.25rem; }

        .header-server-link { flex: 1 0 100%; }

        .server-link { font-size: 1.25rem; }
    }

    .main-form, .login-form {
        margin: 2rem 1.5rem;

        .form-label { font-size: 1.5rem; }

        .form-control {
            font-size: 1.25rem;
            padding: 0.75rem 0.5rem;
        }

        .btn {
            font-size: 1.5rem;
            padding: 0.75rem 2.5rem;
        }
    }

    .login-form h1 { font-size: 2.5rem; }
}

.copy-cookie {
    &:hover {
        background-color: rgba(255, 255, 255, 0.6);
        color: #000;
    }

    svg { vertical-align: text-top; }
}

.chart-container {
    display: flex;
    gap: 0.75rem;
    height: 240px;
    margin-top: 1.5rem;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 1.6rem;
    min-width: 2ch;
    font-size: 0.75rem;
    color: var(--faint);
}

.chart {
    display: flex;
    flex: 1;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.chart-bar-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    height: 100%;
}

.chart-bar-area {
    display: flex;
    flex: 1;
    align-items: flex-end;
    justify-content: center;
    min-height: 0;
}

.chart-bar {
    width: 100%;
    max-width: 48px;
    height: 0;
    min-height: 2px;
    border-radius: 8px 8px 2px 2px;
    background: var(--grad);
    box-shadow: 0 0 18px rgba(14, 165, 233, 0.35);
    transition: height 0.4s ease;
}

.chart-label {
    margin-top: 0.45rem;
    height: 1.15rem;
    font-size: 0.72rem;
    color: var(--faint);
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .chart-container { height: 200px; }
}

.rcon-output {
    height: 280px;
    overflow-y: auto;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    font-family: "Cascadia Mono", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    cursor: text;

    &:focus-within { border-color: rgba(125, 211, 252, 0.35); }
}

.rcon-line {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.rcon-echo { color: var(--accent); }

.rcon-hint { color: var(--faint); }

.rcon-error { color: #fca5a5; }

.rcon-form {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}

.rcon-prompt {
    color: var(--accent);
    font-weight: 600;
    user-select: none;
}

.rcon-input {
    flex: 1;
    min-width: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 0;
    outline: none;
    caret-color: var(--accent);

    &:disabled { opacity: 0.6; }

    &::placeholder { color: rgba(255, 255, 255, 0.35); }
}

@media (max-width: 767.98px) {
    .rcon-output {
        height: 260px;
        padding: 1rem;
        font-size: 16px;
        line-height: 1.5;
    }

    .rcon-form {
        min-height: 44px;
        align-items: center;
    }

    .rcon-input {
        min-height: 44px;
        padding: 0.5rem 0;
    }

    #rcon-clear {
        min-width: 44px;
        min-height: 44px;
    }
}
