* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: #f4f8fc;
    background:
        radial-gradient(circle at 15% 0%, #142b42 0%, transparent 30%),
        radial-gradient(circle at 90% 20%, #10283b 0%, transparent 25%),
        #071019;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;

    background-image:
        linear-gradient(rgba(0, 210, 255, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 255, .025) 1px, transparent 1px);

    background-size: 35px 35px;
}

header {
    height: 90px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 0 5%;

    background: rgba(7, 16, 25, .92);

    border-bottom:
        1px solid rgba(109, 157, 194, .15);

    backdrop-filter: blur(15px);
}

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

.logo {
    width: 45px;
    height: 45px;

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

    border-radius: 12px;

    color: #031017;
    background: #00d2ff;

    font-size: 24px;
    font-weight: 900;

    box-shadow:
        0 0 25px rgba(0, 210, 255, .25);
}

.brand h1 {
    margin: 0;
    font-size: 25px;
}

.brand p {
    margin: 3px 0 0;
    color: #718aa0;
    font-size: 13px;
}

button,
.add-camera {
    border: 0;
    cursor: pointer;

    border-radius: 9px;

    transition:
        transform .15s,
        opacity .15s,
        border .15s;
}

button:hover {
    transform: translateY(-1px);
}

.add-camera {
    padding: 12px 18px;

    background: #00d2ff;
    color: #041017;

    font-weight: 800;
}

main {
    width: 92%;
    max-width: 1500px;
    margin: auto;
    padding: 38px 0 70px;
}

.dashboard-title h2 {
    margin: 0;
    font-size: 25px;
}

.dashboard-title p {
    margin: 5px 0 28px;
    color: #71889c;
}

.camera-grid {
    display: grid;

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

    gap: 25px;
}

.camera-card {
    position: relative;
    overflow: hidden;

    background:
        linear-gradient(
            145deg,
            rgba(17, 31, 45, .97),
            rgba(10, 21, 32, .98)
        );

    border:
        1px solid rgba(106, 151, 186, .18);

    border-radius: 18px;

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

.camera-card::before {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    top: 0;

    height: 2px;

    background:
        linear-gradient(
            90deg,
            transparent,
            #00d2ff,
            transparent
        );
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 20px;
}

.camera-header h2 {
    margin: 0 0 4px;
    font-size: 19px;
}

.camera-id {
    color: #607a91;
    font-size: 10px;
}

.status {
    display: flex;
    align-items: center;
    gap: 7px;

    padding: 7px 10px;

    border-radius: 20px;

    font-size: 10px;
    font-weight: 800;
}

.status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.online {
    color: #4ae5a1;
    background: rgba(38, 218, 137, .08);
}

.online span {
    background: #4ae5a1;
    box-shadow: 0 0 10px #4ae5a1;
}

.offline {
    color: #ff6876;
    background: rgba(255, 72, 90, .08);
}

.offline span {
    background: #ff6876;
}

.camera-view {
    position: relative;

    width: 100%;
    aspect-ratio: 16 / 9;

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

    background: #020509;
}

.camera-view img {
    width: 100%;
    height: 100%;

    object-fit: contain;
}

.no-video {
    color: #536b80;
}

.camera-info {
    display: grid;
    grid-template-columns: 1fr 1fr;

    padding: 14px 20px;

    border-bottom:
        1px solid rgba(111, 151, 180, .1);
}

.camera-info div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.camera-info small,
.controls-title {
    color: #607a91;
    font-size: 9px;
    letter-spacing: 1.2px;
}

.camera-info strong {
    font-size: 12px;
}

.controls-title {
    padding:
        18px 20px 9px;
}

.controls {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 8px;

    padding: 0 20px 20px;
}

.control {
    padding: 11px 5px;

    background: #122435;
    color: #d6e4ef;

    border:
        1px solid rgba(104, 148, 183, .15);

    font-size: 11px;
}

.timelapse {
    margin: 0 20px 20px;
    padding: 17px;

    background:
        rgba(3, 12, 20, .65);

    border:
        1px solid rgba(0, 210, 255, .12);

    border-radius: 12px;
}

.timelapse-title {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 15px;
}

.timelapse-title div:first-child {
    display: flex;
    flex-direction: column;
}

.timelapse-title strong {
    font-size: 14px;
}

.timelapse-title small {
    margin-top: 3px;
    color: #607a91;
    font-size: 10px;
}

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

    border-radius: 50%;

    background: #314252;
}

.record-dot.active {
    background: #ff4d61;

    box-shadow:
        0 0 10px #ff4d61;
}

.timelapse-settings {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 10px;
}

.timelapse-settings label {
    color: #839aae;
    font-size: 11px;
}

.timelapse-settings select {
    padding: 8px 10px;

    border:
        1px solid #263e52;

    border-radius: 7px;

    color: white;
    background: #102130;
}

.timelapse-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.start,
.stop {
    padding: 10px;
    font-weight: 700;
}

.start {
    background: #00d2ff;
    color: #041017;
}

.stop {
    background: #281923;
    color: #ff6978;

    border:
        1px solid rgba(255, 78, 98, .2);
}

.timelapse-status {
    margin-top: 12px;

    color: #70889c;

    font-size: 11px;
    text-align: center;
}

.download {
    display: block;

    margin-top: 12px;
    padding: 10px;

    border:
        1px solid rgba(74, 229, 161, .25);

    border-radius: 8px;

    color: #4ae5a1;
    background:
        rgba(74, 229, 161, .07);

    font-size: 12px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.hidden {
    display: none;
}

.empty {
    padding: 70px 25px;

    text-align: center;

    border:
        1px dashed #294358;

    border-radius: 17px;

    background:
        rgba(11, 25, 37, .5);
}

.empty-icon {
    color: #00d2ff;
    font-size: 55px;
}

.empty p {
    color: #71889c;
}

.empty button {
    padding: 12px 18px;
    background: #00d2ff;
}

.modal {
    display: none;

    position: fixed;
    inset: 0;

    z-index: 50;

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

    padding: 20px;

    background:
        rgba(0, 5, 10, .82);

    backdrop-filter: blur(9px);
}

.modal-content {
    width: 100%;
    max-width: 420px;

    position: relative;

    padding: 28px;

    background: #0d1c29;

    border:
        1px solid #263f53;

    border-radius: 15px;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content p {
    color: #7891a5;
}

.modal-content label {
    display: block;

    margin: 15px 0 6px;

    color: #9bb0c0;

    font-size: 12px;
}

.modal-content input {
    width: 100%;

    padding: 12px;

    color: white;
    background: #07121c;

    border:
        1px solid #284156;

    border-radius: 8px;
}

.pair-button {
    width: 100%;

    margin-top: 20px;
    padding: 12px;

    background: #00d2ff;

    font-weight: 800;
}

.close {
    position: absolute;

    top: 10px;
    right: 10px;

    padding: 7px 10px;

    color: #8197aa;
    background: transparent;

    font-size: 25px;
}

#pairMessage {
    margin-top: 12px;
    text-align: center;
}

.toast {
    position: fixed;

    left: 50%;
    bottom: 30px;

    z-index: 100;

    transform:
        translateX(-50%) translateY(100px);

    padding: 12px 18px;

    border:
        1px solid #284052;

    border-radius: 9px;

    color: white;
    background: #112332;

    opacity: 0;

    transition: .3s;
}

.toast.show {
    transform:
        translateX(-50%) translateY(0);

    opacity: 1;
}

@media (max-width: 650px) {

    header {
        height: auto;

        padding: 18px;

        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    main {
        width: 94%;
    }

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

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

    .camera-header {
        align-items: flex-start;
    }
}
