/* ============================================================
   NDM VIEWER
   Base Viewer Styling
   ============================================================ */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

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

header {
    height: 64px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: #ffffff;
    border-bottom: 1px solid #d9dee3;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1000;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 250px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}
.brand b {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 7px;
    background: #1f2933;
    color: #ffffff;
    font-size: 15px;
    letter-spacing: 0.5px;
}

.brand span {
    font-size: 14px;
    line-height: 18px;
    font-weight: 600;
    color: #263238;
}

.brand small {
    font-size: 11px;
    font-weight: 400;
    color: #6b7280;
}

#projectName {
    flex: 1;
    text-align: center;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

header button {
    border: 1px solid #cbd5df;
    background: #ffffff;
    color: #374151;
    border-radius: 5px;
    padding: 8px 13px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

header button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */

main {
    display: flex;
    width: 100%;
    height: calc(100vh - 64px);
}

/* ============================================================
   SIDEBAR
   ============================================================ */

aside {
    width: 315px;
    min-width: 315px;
    height: 100%;
    overflow-y: auto;
    background: #ffffff;
    border-right: 1px solid #d9dee3;
    padding: 16px;
    position: relative;
    z-index: 900;
}

.label {
    margin-top: 4px;
    margin-bottom: 9px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #7b8794;
}

.label:not(:first-child) {
    margin-top: 18px;
}

/* ============================================================
   NETWORK STATISTICS
   ============================================================ */

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
}

.stats > div {
    min-height: 55px;
    padding: 9px 10px;
    border: 1px solid #e1e6eb;
    border-radius: 5px;
    background: #fafbfc;
    font-size: 10px;
    color: #697586;
    font-weight: 600;
}

.stats strong {
    display: block;
    margin-top: 5px;
    font-size: 17px;
    line-height: 17px;
    color: #263238;
}

/* ============================================================
   SEARCH
   ============================================================ */

#search {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cfd6dd;
    border-radius: 5px;
    outline: none;
    background: #ffffff;
    color: #263238;
    font-size: 12px;
}

#search:focus {
    border-color: #8b98a5;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.10);
}

#search::placeholder {
    color: #9aa5b1;
}

/* ============================================================
   OBJECT LIST
   ============================================================ */

#objects {
    margin-top: 8px;
}

.object-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 34px;
    padding: 7px 8px;
    margin-bottom: 3px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: #374151;
    background: #ffffff;
}

.object-item:hover {
    background: #f4f6f8;
    border-color: #e1e6eb;
}

.object-item .object-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 8px;
}

.object-item .object-type {
    flex-shrink: 0;
    font-size: 9px;
    color: #8a96a3;
    text-transform: uppercase;
}

.object-item.empty {
    cursor: default;
    color: #9aa5b1;
    font-style: italic;
}

.object-item.empty:hover {
    background: #ffffff;
    border-color: transparent;
}

/* ============================================================
   CABLE SUMMARY
   ============================================================ */

aside p {
    margin: 7px 0;
    padding: 0;
    font-size: 11px;
    color: #697586;
}

aside p b {
    float: right;
    color: #263238;
    font-size: 11px;
}

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

#map {
    flex: 1;
    min-width: 0;
    height: 100%;
    position: relative;
    background: #dfe5e8;
}

#map .leaflet-container {
    width: 100%;
    height: 100%;
}

/* ============================================================
   VIEW ONLY BADGE
   ============================================================ */

.badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 800;
    padding: 7px 11px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
    color: #4b5563;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    pointer-events: none;
}

/* ============================================================
   LOADING
   ============================================================ */

#loading {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    padding: 12px 17px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #d8dee4;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    color: #4b5563;
    font-size: 12px;
}

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

.info {
    position: absolute;
    top: 58px;
    right: 15px;
    width: 335px;
    max-height: calc(100% - 75px);
    overflow-y: auto;
    z-index: 900;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #d5dbe1;
    border-radius: 6px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

.info.hidden {
    display: none;
}

#infoBody {
    padding: 15px;
}

#close {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 25px;
    height: 25px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #6b7280;
    font-size: 21px;
    line-height: 25px;
    cursor: pointer;
    z-index: 2;
}

#close:hover {
    background: #f1f3f5;
    color: #263238;
}

/* ============================================================
   INFO CONTENT
   ============================================================ */

.info-title {
    padding-right: 30px;
    margin-bottom: 13px;
    font-size: 15px;
    font-weight: 700;
    color: #263238;
}

.info-subtitle {
    margin-top: -8px;
    margin-bottom: 13px;
    font-size: 10px;
    color: #7b8794;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 7px 0;
    border-bottom: 1px solid #edf0f2;
    font-size: 11px;
}

.info-row:last-child {
    border-bottom: 0;
}

.info-row .key {
    color: #7b8794;
}

.info-row .value {
    color: #263238;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

/* ============================================================
   CABLE INFO
   ============================================================ */

.cable-section {
    margin-top: 12px;
}

.cable-section-title {
    margin-bottom: 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #7b8794;
    text-transform: uppercase;
}

/* ============================================================
   LEAFLET OVERRIDES
   ============================================================ */

.leaflet-control-zoom {
    border: 0 !important;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.20) !important;
}

.leaflet-control-zoom a {
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    font-size: 16px !important;
    color: #374151 !important;
    background: #ffffff !important;
}

.leaflet-control-zoom a:hover {
    background: #f3f4f6 !important;
}

.leaflet-control-attribution {
    font-size: 9px !important;
    background: rgba(255, 255, 255, 0.82) !important;
}

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

.leaflet-popup-content-wrapper {
    border-radius: 5px;
}

.leaflet-popup-content {
    margin: 12px 14px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    color: #263238;
}

.popup-title {
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 700;
}

.popup-type {
    margin-bottom: 7px;
    font-size: 9px;
    color: #7b8794;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   MAP MARKER LABELS
   ============================================================ */

.marker-label {
    white-space: nowrap;
    padding: 2px 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.90);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    color: #263238;
    font-size: 9px;
    line-height: 12px;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */

aside::-webkit-scrollbar,
.info::-webkit-scrollbar {
    width: 7px;
}

aside::-webkit-scrollbar-track,
.info::-webkit-scrollbar-track {
    background: transparent;
}

aside::-webkit-scrollbar-thumb,
.info::-webkit-scrollbar-thumb {
    background: #cbd2d9;
    border-radius: 4px;
}

aside::-webkit-scrollbar-thumb:hover,
.info::-webkit-scrollbar-thumb:hover {
    background: #aeb7c1;
}

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

@media (max-width: 900px) {

    aside {
        width: 260px;
        min-width: 260px;
    }

    .info {
        width: 300px;
    }

    #projectName {
        display: none;
    }
}

@media (max-width: 650px) {

    aside {
        width: 220px;
        min-width: 220px;
        padding: 10px;
    }

    .brand {
        min-width: auto;
    }

    .brand span {
        display: none;
    }

    .info {
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }
}
