body, html {
    background-color: #272727;
    color: #b7c2c0;
    font-family: "Ubuntu", sans-serif;
    font-size: 16px;
    height: 100%;
}

a {
    color: #b7c2c0;
}

a:hover {
    color: #ffffff;
}

.container {
    min-height: 80%;
}

.footer {
    height: 40px;
    border-top: 2px solid #4a80a8;
}

/* Navbar */
.navbar {
    border-bottom: 2px solid #4a80a8;
}

.nav-link {
    color: #b7c2c0 !important;
}

.nav-link:hover, .nav-link.active {
    color: #ffffff !important;
    border-bottom: 2px solid #4a80a8;
}

/* Tables */
.table-dark {
    --bs-table-bg: #1e1e1e;
    --bs-table-striped-bg: #2a2a2a;
    --bs-table-hover-bg: #333333;
}

/* Cards */
.card {
    background-color: #1e1e1e;
    border: 1px solid #3d3d3d;
    color: #b7c2c0;
}

.card-header {
    background-color: #1a1a1a;
    border-bottom: 1px solid #4a80a8;
    font-weight: 500;
}

/* Stat counters */
.stat-card {
    border-left: 3px solid #4a80a8;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #8a9a98;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Map */
#map {
    height: 420px;
    border: 1px solid #3d3d3d;
    border-radius: 4px;
}

/* Live feed */
#live-feed-table tbody tr:first-child {
    animation: highlight-new 2s ease-out;
}

@keyframes highlight-new {
    from { background-color: #1a2a3a; }
    to   { background-color: transparent; }
}

/* Direction badges */
.badge-eastbound {
    background-color: #1a4a1a;
    color: #7ec87e;
    border: 1px solid #7ec87e;
}

.badge-westbound {
    background-color: #1a1a4a;
    color: #7e7ec8;
    border: 1px solid #7e7ec8;
}

.badge-unknown {
    background-color: #3d3d3d;
    color: #8a9a98;
}

/* Forms */
.form-control, .form-select {
    background-color: #1e1e1e;
    border: 1px solid #3d3d3d;
    color: #b7c2c0;
}

.form-control:focus, .form-select:focus {
    background-color: #252525;
    border-color: #4a80a8;
    color: #b7c2c0;
    box-shadow: 0 0 0 0.2rem rgba(74, 128, 168, 0.25);
}

/* Buttons */
.btn-ns {
    background-color: #4a80a8;
    border-color: #4a80a8;
    color: #ffffff;
}

.btn-ns:hover {
    background-color: #3a6888;
    border-color: #3a6888;
    color: #ffffff;
}

/* Dropdown */
.dropdown-menu {
    background-color: #1e1e1e;
    border: 1px solid #3d3d3d;
}

.dropdown-item {
    color: #b7c2c0;
}

.dropdown-item:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

/* Protocol badges */
.badge-eot  { background-color: #2a4a6a; color: #fff; }
.badge-hot  { background-color: #1a3a5a; color: #fff; }
.badge-dpu  { background-color: #2a4a2a; color: #fff; }

/* Leaflet popup dark theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background-color: #1e1e1e;
    color: #b7c2c0;
    border: 1px solid #3d3d3d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* Live status indicator */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: default;
    user-select: none;
}

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #555;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}

.live-dot.state-connected   { background-color: #f0a500; }
.live-dot.state-live        { background-color: #5ec85e; }
.live-dot.state-error       { background-color: #dc3545; }

.live-dot.pulse {
    animation: live-pulse 0.7s ease-out;
}

@keyframes live-pulse {
    0%   { transform: scale(1);   box-shadow: 0 0 0 0   rgba(94, 200, 94, 0.7); }
    50%  { transform: scale(1.5); box-shadow: 0 0 0 6px rgba(94, 200, 94, 0);   }
    100% { transform: scale(1);   box-shadow: 0 0 0 0   rgba(94, 200, 94, 0);   }
}

.live-label {
    font-size: 0.78rem;
    color: #8a9a98;
    white-space: nowrap;
}

/* Receiver status badges */
.receiver-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    background-color: #1e2a1e;
    border: 1px solid #3a6a3a;
}

.receiver-badge.receiver-offline {
    background-color: #2a2a2a;
    border-color: #3d3d3d;
    color: #6a7a78;
}

.receiver-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #5ec85e;
    flex-shrink: 0;
}

.receiver-offline .receiver-dot {
    background-color: #555555;
}

.receiver-proto {
    color: #8a9a98;
    font-size: 0.78rem;
}

.map-tooltip {
    background-color: #1e1e1e;
    color: #b7c2c0;
    border: 1px solid #3d3d3d;
    font-family: "Ubuntu", sans-serif;
    font-size: 13px;
}