/* public/styles.css */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #1f2937;
    font-family: system-ui, sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

/* LOGIN */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: #f4f6f8;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    background: #fff;
    border-radius: 16px;
    box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
    margin: 0 0 1.5rem;
}

.login-card label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
}

.login-card input {
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.75rem;
    border:
            1px solid #d1d5db;
    border-radius: 10px;
}

.login-card button {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.85rem;
    border: 0;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.login-card button:hover {
    opacity: 0.92;
}

/* DASHBOARD */

.dashboard-page {
    min-height: 100vh;
    padding: 1rem;
}

.dashboard-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-header h1,
.dashboard-header p {
    margin: 0;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.header-actions button {
    width: auto;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.mobile-nav {
    display: none;
}

.client-card,
.panel {
    background: #fff;
    border-radius: 16px;
    padding: 1rem;
    box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.07);
}

.client-card {
    min-width: 120px;
    display: grid;
    place-items: center;
    text-align: center;
}

.client-card strong {
    font-size: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1rem;
}

.charts-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.chart-panel {
    overflow: hidden;
}

.websocket-panel {
    grid-column: 1 / 2;
}

.clients-panel {
    grid-column: 2 / 3;
}

.table-panel {
    grid-column: 1 / -1;
}

.panel h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header a {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.85rem;
}

.chart-large {
    width: 100%;
    height: 300px;
}

.chart-small {
    width: 100%;
    height: 82px;
    margin-top: 0.35rem;
}

.ws-log {
    width: 100%;
    min-height: 260px;
    max-height: 360px;
    resize: vertical;
    overflow: auto;
    padding: 1rem;
    border: 0;
    border-radius: 10px;
    background: #111827;
    color: #e5e7eb;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
    font-family:
            ui-monospace,
            SFMono-Regular,
            Menlo,
            Monaco,
            Consolas,
            monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message-form {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.message-form input {
    width: 100%;
    padding: 0.75rem;
    border:
            1px solid #d1d5db;
    border-radius: 10px;
}

.message-form button {
    width: auto;
    min-width: 120px;
    border: 0;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.client-list {
    display: grid;
    gap: 0.6rem;
}

.client-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem;
    border:
            1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    font-size: 0.9rem;
}

.client-item strong,
.client-item small {
    display: block;
}

.client-item small {
    color: #6b7280;
    margin-top: 0.15rem;
}

.client-dot {
    width: 13px;
    height: 13px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.client-dot-0 {
    background: #22c55e;
}

.client-dot-1 {
    background: #3b82f6;
}

.client-dot-2 {
    background: #f97316;
}

.client-dot-3 {
    background: #a855f7;
}

.client-dot-4 {
    background: #ef4444;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 0.75rem;
    border-bottom:
            1px solid #e5e7eb;
    text-align: left;
}

th {
    background: #f9fafb;
    font-weight: 700;
}

@media (max-width: 900px) {
    .dashboard-page {
        padding-bottom: 5rem;
    }

    .dashboard-header {
        grid-template-columns: 1fr;
    }

    .header-actions {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .header-actions button {
        width: 100%;
        padding: 0.55rem 0.45rem;
        font-size: 0.78rem;
    }

    .mobile-nav {
        position: sticky;
        top: 0;
        z-index: 10;

        display: grid;
        grid-template-columns: repeat(4, 1fr);

        gap: 0.5rem;

        padding: 0.5rem 0;

        margin-bottom: 1rem;

        background: #f4f6f8;
    }

    .mobile-nav a {
        display: grid;
        place-items: center;

        min-height: 42px;

        padding: 0.5rem;

        background: #fff;

        border-radius: 12px;

        color: #111827;

        text-decoration: none;

        font-weight: 700;

        font-size: 0.85rem;

        box-shadow:
                0 6px 18px rgba(0, 0, 0, 0.06);
    }

    .dashboard-grid,
    .charts-section {
        grid-template-columns: 1fr;
    }

    .websocket-panel,
    .clients-panel,
    .table-panel {
        grid-column: auto;
    }

    .chart-large {
        height: 240px;
    }

    .chart-small {
        height: 68px;
    }

    .ws-log {
        min-height: 180px;
    }

    .message-form {
        flex-direction: column;
    }

    .message-form button {
        width: 100%;
    }
}