* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    padding: 0;

    min-height: 100%;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #0f1117;
    color: #f1f3f5;
}


body {
    min-height: 100vh;
}


.hidden {
    display: none !important;
}


.page {
    min-height: 100vh;
}


/*
 * LOGIN
 */

#login-page {
    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;
}


.login-card {
    width: 100%;
    max-width: 390px;

    padding: 34px;

    border: 1px solid #252a34;

    border-radius: 16px;

    background: #151821;

    box-shadow:
        0 20px 60px rgba(
            0,
            0,
            0,
            0.35
        );
}


.login-logo {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;

    margin-bottom: 20px;

    border-radius: 12px;

    background: #242a35;

    color: #ffffff;

    font-size: 15px;
    font-weight: 700;
}


.login-card h1 {
    margin: 0;

    font-size: 25px;
}


.login-description {
    margin: 7px 0 28px;

    color: #8b93a1;

    font-size: 14px;
}


.form-group {
    margin-bottom: 17px;
}


.form-group label {
    display: block;

    margin-bottom: 7px;

    color: #b5bcc7;

    font-size: 13px;
}


.form-group input {
    width: 100%;

    height: 44px;

    padding: 0 13px;

    border: 1px solid #303642;

    border-radius: 9px;

    outline: none;

    background: #0f1117;

    color: #ffffff;

    font-size: 14px;

    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}


.form-group input:focus {
    border-color: #596273;

    box-shadow:
        0 0 0 3px rgba(
            100,
            110,
            130,
            0.12
        );
}


#login-button {
    width: 100%;

    height: 44px;

    margin-top: 6px;

    border: 0;

    border-radius: 9px;

    background: #f1f3f5;

    color: #111318;

    cursor: pointer;

    font-size: 14px;
    font-weight: 600;
}


#login-button:hover {
    background: #ffffff;
}


#login-button:disabled {
    opacity: 0.55;

    cursor: not-allowed;
}


.login-error {
    margin-top: 14px;

    padding: 10px 12px;

    border: 1px solid #4a2930;

    border-radius: 8px;

    background: #27191d;

    color: #ef9ba8;

    font-size: 13px;
}


/*
 * DASHBOARD
 */

.app {
    width: 100%;
    min-height: 100vh;
}


.header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 24px 32px;

    border-bottom: 1px solid #252a34;

    background: #151821;
}


.header h1 {
    margin: 0;

    font-size: 24px;
    font-weight: 700;
}


.header p {
    margin: 5px 0 0;

    color: #8b93a1;

    font-size: 14px;
}


.header-right {
    display: flex;

    align-items: center;

    gap: 20px;
}


.connection {
    display: flex;

    align-items: center;

    gap: 9px;

    color: #aab1bd;

    font-size: 14px;
}


.dot {
    width: 9px;
    height: 9px;

    border-radius: 50%;
}


.dot.online {
    background: #3ddc84;

    box-shadow:
        0 0 10px rgba(
            61,
            220,
            132,
            0.5
        );
}


.dot.offline {
    background: #737b88;
}


.logout-button {
    height: 34px;

    padding: 0 13px;

    border: 1px solid #303642;

    border-radius: 8px;

    background: #1b1f28;

    color: #c4cad3;

    cursor: pointer;

    font-size: 13px;
}


.logout-button:hover {
    background: #242a35;
}


.content {
    width: 100%;

    max-width: 1200px;

    margin: 0 auto;

    padding: 32px;
}


.stats {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                200px,
                1fr
            )
        );

    gap: 14px;

    margin-bottom: 18px;
}


.stat-card {
    padding: 20px;

    border: 1px solid #252a34;

    border-radius: 14px;

    background: #151821;
}


.stat-label {
    display: block;

    margin-bottom: 8px;

    color: #8b93a1;

    font-size: 13px;
}


.stat-value {
    font-size: 28px;
}


.card {
    overflow: hidden;

    border: 1px solid #252a34;

    border-radius: 14px;

    background: #151821;
}


.card-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 22px 24px;

    border-bottom: 1px solid #252a34;
}


.card-header h2 {
    margin: 0;

    font-size: 18px;
}


.card-header p {
    margin: 5px 0 0;

    color: #8b93a1;

    font-size: 13px;
}


.clients {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                340px,
                1fr
            )
        );

    gap: 12px;

    padding: 16px;
}


.client-card {
    padding: 18px;

    border: 1px solid #282e39;

    border-radius: 12px;

    background: #11141b;
}


.client-top {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 18px;
}


.client-name {
    overflow: hidden;

    color: #ffffff;

    font-size: 15px;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.client-status {
    display: flex;

    align-items: center;

    gap: 6px;

    color: #72dfa0;

    font-size: 12px;
}


.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #3ddc84;
}


.client-info {
    display: grid;

    gap: 10px;
}


.info-row {
    display: flex;

    justify-content: space-between;

    gap: 20px;

    font-size: 13px;
}


.info-label {
    color: #737d8b;
}


.info-value {
    max-width: 65%;

    overflow: hidden;

    color: #cdd2da;

    text-align: right;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/*
 * BUTTONS
 */

.client-actions {
    display: grid;

    grid-template-columns: 1fr;

    gap: 8px;

    margin-top: 18px;

    padding-top: 16px;

    border-top: 1px solid #252a34;
}


.screenshot-button,
.history-button,
.camera-button,
.camera-history-button {
    width: 100%;

    height: 38px;

    border: 1px solid #303642;

    border-radius: 8px;

    background: #1b1f28;

    color: #dce1e8;

    cursor: pointer;

    font-size: 13px;
    font-weight: 500;

    transition:
        background 0.15s,
        border-color 0.15s;
}


.screenshot-button:hover,
.history-button:hover,
.camera-button:hover,
.camera-history-button:hover {
    background: #242a35;

    border-color: #3b4350;
}


.screenshot-button:disabled,
.history-button:disabled,
.camera-button:disabled,
.camera-history-button:disabled {
    opacity: 0.5;

    cursor: wait;
}


/*
 * SCREENSHOT PREVIEW
 */

.screenshot-preview {
    margin-top: 18px;

    padding-top: 16px;

    border-top: 1px solid #252a34;
}


.preview-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 10px;

    color: #b8c0cc;

    font-size: 12px;
}


.preview-time {
    color: #707a89;

    white-space: nowrap;
}


.screenshot-link {
    display: block;

    width: 100%;

    overflow: hidden;

    border: 1px solid #303642;

    border-radius: 8px;

    background: #0a0c10;
}


.screenshot-image {
    display: block;

    width: 100%;
    height: auto;

    max-height: 400px;

    object-fit: contain;

    cursor: zoom-in;
}


.screenshot-link:hover
.screenshot-image {
    opacity: 0.9;
}


.empty {
    grid-column: 1 / -1;

    padding: 50px 20px;

    text-align: center;

    color: #747d8b;

    font-size: 14px;
}


/*
 * HISTORY BLOCK
 */

.history-block {
    margin-top: 18px;

    padding-top: 16px;

    border-top: 1px solid #252a34;
}


.history-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(
                160px,
                1fr
            )
        );

    gap: 12px;

    margin-top: 15px;
}


.history-item {
    overflow: hidden;

    border: 1px solid #303642;

    border-radius: 10px;

    background: #0f1117;

    text-decoration: none;

    color: white;
}


.history-item img {
    width: 100%;

    height: 120px;

    object-fit: cover;

    display: block;
}


.history-info {
    display: flex;

    flex-direction: column;

    gap: 4px;

    padding: 10px;

    font-size: 12px;
}


.history-info span {
    color: #dce1e8;
}


.history-info small {
    color: #7d8796;
}


/*
 * CAMERA HISTORY
 */

.camera-history {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(
                220px,
                1fr
            )
        );

    gap: 14px;

    margin-top: 18px;

    padding-top: 16px;

    border-top: 1px solid #252a34;
}


.camera-history .history-item {
    overflow: hidden;

    border: 1px solid #303642;

    border-radius: 10px;

    background: #0f1117;
}


.camera-history .history-image-link {
    display: block;
}


.camera-history .history-image {
    display: block;

    width: 100%;

    aspect-ratio: 16 / 9;

    object-fit: cover;
}


.camera-history .history-info {
    padding: 10px 12px;
}


.camera-history .history-filename {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 13px;

    color: #dce1e8;
}


.camera-history .history-meta {
    margin-top: 5px;

    opacity: 0.6;

    font-size: 12px;

    color: #7d8796;
}


.camera-history .history-loading,
.camera-history .history-empty,
.camera-history .history-error {
    padding: 15px;

    opacity: 0.7;

    color: #7d8796;
}


@media (
    max-width: 700px
) {

    .header {
        align-items: flex-start;

        gap: 20px;

        padding: 20px;
    }


    .header-right {
        flex-direction: column;

        align-items: flex-end;

        gap: 10px;
    }


    .content {
        padding: 20px;
    }


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

}
