/* =========================================================
   RESET
========================================================= */

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


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

    background: #f5f7fb;

    color: #172033;

    min-height: 100vh;
}


/* =========================================================
   HEADER
========================================================= */

.header {

    background: white;

    border-bottom: 1px solid #e5e7eb;

    padding: 18px 5%;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;
}


.header-left {

    display: flex;

    align-items: center;

    gap: 14px;
}


.logo {

    width: 48px;

    height: 48px;

    border-radius: 14px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #eff6ff;

    font-size: 25px;
}


.header h1 {

    font-size: 21px;

    margin-bottom: 3px;
}


.header p {

    font-size: 13px;

    color: #6b7280;
}


/* =========================================================
   CONNECTION STATUS
========================================================= */

.status {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 8px 14px;

    border-radius: 20px;

    font-size: 13px;

    font-weight: 600;
}


.status.online {

    background: #ecfdf5;

    color: #059669;
}


.status.offline {

    background: #fef2f2;

    color: #dc2626;
}


.status-dot {

    width: 9px;

    height: 9px;

    border-radius: 50%;

    background: currentColor;
}


/* =========================================================
   CONTAINER
========================================================= */

.container {

    width: 90%;

    max-width: 1400px;

    margin: 30px auto 60px;
}


/* =========================================================
   CARDS
========================================================= */

.cards {

    display: grid;

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

    gap: 18px;

    margin-bottom: 22px;
}


.card {

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 16px;

    padding: 20px;

    display: flex;

    align-items: center;

    gap: 14px;

    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.04);
}


.card-icon {

    width: 45px;

    height: 45px;

    background: #f3f4f6;

    border-radius: 12px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 21px;
}


.card-content {

    display: flex;

    flex-direction: column;

    gap: 4px;

    min-width: 0;
}


.card-label {

    font-size: 12px;

    color: #6b7280;
}


.card strong {

    font-size: 17px;
}


/* =========================================================
   BADGE
========================================================= */

.badge {

    margin-left: auto;

    padding: 6px 9px;

    border-radius: 8px;

    font-size: 10px;

    font-weight: 700;

    white-space: nowrap;
}


.badge.online {

    background: #ecfdf5;

    color: #059669;
}


.badge.offline {

    background: #fef2f2;

    color: #dc2626;
}


/* =========================================================
   PANEL
========================================================= */

.panel {

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 18px;

    padding: 22px;

    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.04);
}


.panel-header {

    margin-bottom: 18px;
}


.panel-header h2 {

    font-size: 18px;
}


.panel-header p {

    color: #6b7280;

    font-size: 13px;

    margin-top: 5px;
}


/* =========================================================
   MAP
========================================================= */

.map-panel {

    margin-bottom: 22px;

    padding-bottom: 18px;
}


#map {

    width: 100%;

    height: 500px;

    border-radius: 14px;

    overflow: hidden;
}


/* =========================================================
   INFO GRID
========================================================= */

.info-grid {

    display: grid;

    grid-template-columns:
        1.5fr 1fr;

    gap: 22px;
}


/* =========================================================
   LOCATION
========================================================= */

.location-name {

    background: #f8fafc;

    border: 1px solid #e5e7eb;

    border-radius: 12px;

    padding: 15px;

    display: flex;

    flex-direction: column;

    gap: 6px;

    margin-bottom: 18px;
}


.location-name span {

    font-size: 12px;

    color: #6b7280;
}


.location-name strong {

    font-size: 14px;

    line-height: 1.5;
}


/* =========================================================
   DATA GRID
========================================================= */

.data-grid {

    display: grid;

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

    gap: 14px;
}


.data-item {

    background: #f8fafc;

    border: 1px solid #e5e7eb;

    border-radius: 12px;

    padding: 15px;
}


.data-item span {

    display: block;

    font-size: 12px;

    color: #6b7280;

    margin-bottom: 6px;
}


.data-item strong {

    font-size: 15px;

    word-break: break-word;
}


/* =========================================================
   SOS PANEL
========================================================= */

.sos-panel {

    text-align: center;
}


.sos-status {

    padding: 13px;

    border-radius: 12px;

    font-weight: 700;

    margin-bottom: 18px;
}


.sos-status.normal {

    background: #ecfdf5;

    color: #059669;
}


.sos-status.active {

    background: #fef2f2;

    color: #dc2626;

    animation: sosPulse 1s infinite;
}


@keyframes sosPulse {

    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}


.sos-description {

    color: #6b7280;

    font-size: 13px;

    line-height: 1.6;

    margin-bottom: 22px;
}


/* =========================================================
   SOS BUTTON
========================================================= */

.sos-button {

    width: 100%;

    padding: 16px;

    border: none;

    border-radius: 12px;

    background: #dc2626;

    color: white;

    font-size: 15px;

    font-weight: 800;

    cursor: pointer;

    transition: 0.2s;
}


.sos-button:hover {

    transform: translateY(-2px);

    box-shadow:
        0 8px 20px rgba(220, 38, 38, 0.25);
}


.sos-button.active {

    background: #991b1b;

    animation: sosPulse 1s infinite;
}


/* =========================================================
   SOS OVERLAY
========================================================= */

.sos-overlay {

    position: fixed;

    inset: 0;

    z-index: 9999;

    background:
        rgba(127, 29, 29, 0.72);

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    backdrop-filter: blur(5px);
}


.sos-overlay.hidden {

    display: none;
}


/* =========================================================
   SOS MODAL
========================================================= */

.sos-modal {

    width: 100%;

    max-width: 480px;

    background: white;

    border-radius: 22px;

    padding: 30px;

    text-align: center;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.3);

    animation: modalIn 0.25s ease;
}


@keyframes modalIn {

    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}


.sos-warning-icon {

    width: 75px;

    height: 75px;

    margin: 0 auto 18px;

    border-radius: 50%;

    background: #fee2e2;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 38px;

    animation: sosPulse 1s infinite;
}


.sos-modal h2 {

    color: #dc2626;

    font-size: 27px;

    margin-bottom: 10px;
}


.sos-alert-text {

    color: #6b7280;

    font-size: 14px;

    line-height: 1.6;

    margin-bottom: 20px;
}


/* =========================================================
   SOS LOCATION
========================================================= */

.sos-location-box {

    background: #f8fafc;

    border: 1px solid #e5e7eb;

    border-radius: 12px;

    padding: 15px;

    text-align: left;

    margin-bottom: 20px;
}


.sos-location-box span {

    display: block;

    font-size: 12px;

    color: #6b7280;

    margin-bottom: 6px;
}


.sos-location-box strong {

    font-size: 13px;

    word-break: break-word;

    line-height: 1.5;
}


/* =========================================================
   SOS ACTIONS
========================================================= */

.sos-actions {

    display: flex;

    flex-direction: column;

    gap: 10px;
}


.reset-sos-button {

    width: 100%;

    padding: 15px;

    border: none;

    border-radius: 11px;

    background: #16a34a;

    color: white;

    font-size: 15px;

    font-weight: 800;

    cursor: pointer;

    transition: 0.2s;
}


.reset-sos-button:hover {

    transform: translateY(-2px);

    box-shadow:
        0 8px 18px rgba(22, 163, 74, 0.25);
}


.close-alert-button {

    width: 100%;

    padding: 12px;

    border: 1px solid #d1d5db;

    border-radius: 11px;

    background: white;

    color: #374151;

    cursor: pointer;

    font-weight: 600;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1000px) {

    .cards {

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

    .info-grid {

        grid-template-columns: 1fr;
    }
}


@media (max-width: 600px) {

    .header {

        padding: 15px 4%;
    }

    .header h1 {

        font-size: 17px;
    }

    .header p {

        display: none;
    }

    .container {

        width: 94%;

        margin-top: 20px;
    }

    .cards {

        grid-template-columns: 1fr;
    }

    #map {

        height: 400px;
    }

    .data-grid {

        grid-template-columns: 1fr;
    }

    .panel {

        padding: 17px;
    }

    .sos-modal {

        padding: 24px;
    }
}