/* ServerCheck professional dark UI
   inspired by modern self-hosted monitoring products:
   calmer dark theme, soft borders, subtle accents, less neon.
*/

:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --bg: #060814;
    --bg-soft: #0b1120;
    --surface: #111827;
    --surface-2: #161f2f;
    --surface-3: #1b2432;

    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.2);

    --text: #e2e8f0;
    --text-soft: #a8b4d0;
    --muted: #8b98b6;
    --muted-2: #64748b;

    --primary: #22c55e;
    --primary-strong: #16a34a;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --unknown: #818cf8;

    --radius-lg: 18px;
    --radius-md: 16px;
    --radius-sm: 12px;

    --shadow-soft: 0 12px 24px rgba(0, 0, 0, 0.24);
    --shadow-card: 0 10px 20px rgba(0, 0, 0, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.08), transparent 28rem),
                linear-gradient(180deg, #05060f 0%, #070b15 100%);
    color: var(--text);
    font-family: Inter, "Inter var", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.55;
}

body,
button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
}

a {
    color: inherit;
}

/* app layout */

.app-shell {
    display: grid;
    grid-template-columns: 288px 1fr;
    min-height: 100vh;
    gap: 22px;
    padding: 22px;
}

.sidebar {
    position: sticky;
    top: 22px;
    height: calc(100vh - 44px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(14, 21, 36, 0.96);
    border-radius: var(--radius-md);
}

.brand-panel {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

.brand-panel h1 {
    margin: 0;
    font-size: 1.22rem;
    letter-spacing: -0.02em;
}

.brand-panel p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.nav-panel {
    display: grid;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--muted);
    text-decoration: none;
    background: transparent;
    transition: 0.22s ease;
}

.nav-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.045);
    border-color: var(--border);
}

.nav-link.active {
    color: var(--text);
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.22);
}

/* shared cards */

.status-card,
.profile-card,
.neon-card,
.table-card,
.history-card {
    background: rgba(18, 28, 45, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: var(--radius-md);
    padding: 18px;
}

.status-card {
    display: flex;
    gap: 14px;
    align-items: center;
}

.status-card strong,
.status-card p,
.profile-card p,
.profile-card span {
    margin: 0;
}

.status-card p,
.profile-card span {
    color: var(--muted);
}

.status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--muted-2);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
}

.profile-card {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: auto;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.16);
    color: #f8fafc;
    font-weight: 800;
}

/* main content */

.main-panel {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 4px 2px;
}

.topbar h2 {
    margin: 0;
    font-size: clamp(1.65rem, 2vw, 2.15rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.topbar p {
    margin: 8px 0 0;
    color: var(--muted);
}

.top-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* buttons */

.primary-btn,
.ghost-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    font-family: Inter, "Inter var", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0em;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.primary-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #f8fafc;
    border: 1px solid rgba(34, 197, 94, 0.22);
}

.primary-btn:hover {
    transform: translateY(-1px);
    background: #16a34a;
}

.ghost-btn {
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-soft);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.ghost-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.danger-btn {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

.danger-btn:hover {
    background: rgba(239, 68, 68, 0.18);
}

/* overview */

.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stat-card {
    min-height: 128px;
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.08);
    background: rgba(18, 28, 45, 0.94);
    transition: 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 197, 94, 0.24);
}

.stat-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.stat-card h3 {
    font-size: 2.25rem;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.04em;
}

.stat-card p {
    margin: 12px 0 0;
    color: var(--muted);
}

/* panels and forms */

.panel-section {
    display: grid;
    gap: 18px;
}

.panel-heading {
    display: grid;
    gap: 16px;
    align-items: center;
    grid-template-columns: 1fr auto;
}

.panel-heading h3 {
    margin: 0;
    letter-spacing: -0.02em;
}

.panel-heading p {
    margin: 7px 0 0;
    color: var(--muted);
}

.add-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.add-form input {
    min-width: min(320px, 100%);
    flex: 1;
}

.add-form input,
.filter-input input,
.filter-input select,
.settings-form input,
.settings-form select,
.auth-card input {
    width: 100%;
    padding: 13px 15px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.78);
    color: var(--text);
    outline: none;
    transition: 0.2s ease;
}

.add-form input::placeholder,
.filter-input input::placeholder,
.auth-card input::placeholder {
    color: var(--muted-2);
}

.add-form input:focus,
.filter-input input:focus,
.filter-input select:focus,
.settings-form input:focus,
.settings-form select:focus,
.auth-card input:focus {
    border-color: rgba(34, 197, 94, 0.35);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: var(--radius-md);
}

.filter-input {
    display: grid;
    gap: 8px;
}

.filter-input label,
.settings-form label,
.checkbox-label {
    color: var(--text-soft);
    font-size: 0.9rem;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label input {
    width: auto;
    height: auto;
    margin: 0;
}

/* alerts */

.alert {
    border-radius: 16px;
    padding: 14px 16px;
    font-weight: 700;
    border: 1px solid transparent;
}

.alert.success {
    background: rgba(34, 197, 94, 0.11);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.2);
}

.alert.error {
    background: rgba(239, 68, 68, 0.11);
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.2);
}

/* tables */

.table-card {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: var(--radius-md);
    background: rgba(18, 28, 45, 0.96);
}

.table-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
    margin-bottom: 14px;
}

.table-header h4 {
    margin: 0;
    letter-spacing: -0.02em;
}

.table-header span {
    color: var(--muted);
}

.responsive-table {
    overflow-x: auto;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th,
td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

th {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.02);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.75rem;
    font-weight: 700;
}

tr {
    transition: background 0.18s ease;
}

tbody tr:hover,
tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

tr:last-child td {
    border-bottom: none;
}

/* badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.76rem;
    border: 1px solid transparent;
}

.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.badge.online {
    background: rgba(34, 197, 94, 0.11);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.22);
}

.badge.offline {
    background: rgba(239, 68, 68, 0.11);
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.22);
}

.badge.unknown {
    background: rgba(129, 140, 248, 0.11);
    color: #c7d2fe;
    border-color: rgba(129, 140, 248, 0.22);
}

/* history and settings */

.history-card {
    display: grid;
    gap: 16px;
}

.history-card h3,
.settings-card h3 {
    margin: 0;
    letter-spacing: -0.02em;
}

.history-grid,
.settings-grid {
    display: grid;
    gap: 14px;
}

.history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-grid div,
.settings-grid .setting-item {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    padding: 18px;
}

.history-grid span {
    display: block;
    color: var(--muted);
    margin-bottom: 7px;
}

.history-grid strong {
    display: block;
    font-size: 1.08rem;
}

.settings-grid .setting-item h4 {
    margin: 0 0 8px;
}

.settings-grid .setting-item p {
    margin: 0;
    color: var(--muted);
}

.settings-card {
    display: grid;
    gap: 16px;
}

/* auth pages */

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(180deg, #06070f 0%, #09101d 100%);
}

.auth-shell {
    width: min(520px, 100%);
}

.auth-card {
    padding: 36px 32px;
    text-align: center;
    border-radius: var(--radius-md);
    background: rgba(18, 28, 45, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4vw, 2.55rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
}

.auth-card p {
    margin: 0 0 28px;
    color: var(--muted);
}

.auth-card label {
    display: block;
    margin: 18px 0 8px;
    text-align: left;
    color: var(--text-soft);
}

.auth-card .primary-btn {
    margin-top: 18px;
}

.auth-meta {
    margin-top: 22px;
    color: var(--muted);
}

.auth-meta a {
    color: #22c55e;
    text-decoration: none;
    font-weight: 800;
}

.auth-meta a:hover {
    color: #16a34a;
}

/* back button */

.back-homme,
.back-home {
    position: fixed;
    top: 22px;
    left: 22px;
    z-index: 9999;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 42px;
    padding: 10px 15px;
    border-radius: 999px;

    background: rgba(15, 23, 38, 0.88);
    color: #cbd5e1;
    text-decoration: none;

    font-size: 0.9rem;
    font-weight: 800;

    border: 1px solid rgba(148, 163, 184, 0.12);
    transition: 0.18s ease;
}

.back-homme:hover,
.back-home:hover {
    color: var(--text);
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.22);
    transform: translateY(-1px);
}

/* responsive */

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        gap: 18px;
        padding: 14px;
    }

    .overview-grid,
    .history-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 34px 24px;
    }

    .back-homme,
    .back-home {
        top: 14px;
        left: 14px;
    }
}
