/* main.css */
body {
    margin: 0;
    padding: 0;
    padding-top: 54px;
    background-color: #ffffff;
    color: #000000;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode #main-header {
    background: rgba(20, 20, 20, 0.97);
}

body.dark-mode .info {
    background: rgba(40, 40, 40, 0.9);
    color: #e0e0e0;
}

body.dark-mode .info h4 {
    color: #ccc;
}

body.dark-mode #ws-indicator {
    background: rgba(40, 40, 40, 0.9);
    color: #e0e0e0;
    border: 1px solid #666;
}

body.dark-mode .status-control {
    background: rgba(40, 40, 40, 0.95);
    color: #e0e0e0;
}
body.dark-mode .hf-conditions-panel {
    background: rgba(40, 40, 40, 0.95);
    color: #e0e0e0;
}
body.dark-mode .hf-conditions-meta {
    color: #cfcfcf;
}
body.dark-mode .hf-conditions-table th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
body.dark-mode .hf-conditions-toggle {
    background: rgba(30, 30, 30, 0.9);
    color: #e0e0e0;
    border-color: #66bb6a;
}

body.dark-mode #settings-dropdown {
    background: rgba(40, 40, 40, 0.95);
    color: #e0e0e0;
    border: 1px solid #666;
}

body.dark-mode .grid-label {
    background: rgba(40, 40, 40, 0.8);
    color: #e0e0e0;
}
#map {
    width: 100%;
    height: 100vh;
    position: relative;
}
.info {
    padding: 6px 8px;
    font: 14px/16px Arial, Helvetica, sans-serif;
    background: white;
    background: rgba(255,255,255,0.8);
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-radius: 5px;
}
.info h4 {
    margin: 0 0 5px;
    color: #777;
}
.grid-label {
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    pointer-events: none;
}
.map-watermark {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1200;
    opacity: 0.3;
    transition: opacity 0.2s ease-in-out;
    cursor: pointer;
}
.map-watermark:hover {
    opacity: 1;
}
.map-watermark img {
    display: block;
    width: 140px;
    height: auto;
}
#ws-indicator {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 1000;
    background: rgba(255,255,255,0.9);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 0 8px rgba(0,0,0,0.15);
    border: 1px solid #ccc;
}
#ws-status.connected {
    color: green;
    font-weight: bold;
}
#ws-status.disconnected {
    color: red;
    font-weight: bold;
}
#ws-status.connecting {
    color: orange;
    font-weight: bold;
}
#debug-toggle {
    position: relative;
    z-index: auto;
}
#debug-btn {
    padding: 4px 12px;
    font-size: 14px;
}
#debug-output {
    position: absolute;
    top: 90px;
    right: 20px;
    z-index: 1000;
    background: #1a1a1a;
    color: #00ff00;
    max-width: 1200px;
    max-height: 300px;
    overflow: auto;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 8px rgba(0,0,0,0.15);
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #333;
}
#ws-dot {
    position: absolute;
    top: 130px;
    left: 16px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    z-index: 1001;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    border: 2px solid #fff;
}
#ws-dot.connected {
    background: #00e676;
    box-shadow: 0 0 12px 6px #00e676;
}
#ws-dot.disconnected {
    background: #e53935;
    box-shadow: 0 0 8px 4px #e53935;
}
#ws-dot.connecting {
    background: #ffb300;
    box-shadow: 0 0 8px 4px #ffb300;
}
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 54px;
    background: rgba(30, 34, 44, 0.97);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 0 16px;
    box-sizing: border-box;
}
#site-title {
    font-size: 1.7em;
    font-weight: bold;
    letter-spacing: 2px;
    color: #00e676;
    text-shadow: 0 1px 4px #222;
    margin: 0;
}
#settings-menu {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    margin-right: 4px;
}
#settings-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
}
#settings-btn:hover, #settings-btn:focus {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}
#settings-dropdown {
    position: fixed;
    right: 24px;
    top: 64px;
    z-index: 99999 !important;
}
#settings-dropdown.hidden {
    display: none;
}
#settings-dropdown label {
    font-size: 1em;
    cursor: pointer;
    user-select: none;
}
#settings-dropdown input[type="checkbox"] {
    margin-right: 8px;
}
#settings-btn svg {
    color: #fff;
    fill: none;
    stroke: #fff;
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

/* Status control styling */
.status-control {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    margin: 0 auto;
    margin-top: 12px;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    z-index: 1100;
    min-width: 340px;
    max-width: 90vw;
}
.status-control table {
    width: 100%;
}
.status-station-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.status-grid-inline {
    font-size: 12px;
}
.hf-conditions-toggle {
    margin-left: auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(240,240,240,0.95));
    color: var(--text-main, #222);
    border: 1px solid var(--accent, #4caf50);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    height: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}
.hf-conditions-toggle:hover {
    filter: brightness(0.95);
}
.hf-conditions-toggle-vertical {
    height: auto;
    min-height: 88px;
    padding: 10px 8px;
    min-width: 34px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    margin-left: 6px;
}
.mobile-status-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 10px;
}

.status-right-stack {
    vertical-align: top;
}
.status-right-stack > div {
    display: block;
    margin-bottom: 4px;
}
.status-hf-cell {
    vertical-align: middle;
    padding-left: 8px;
}
.status-hf-cell .hf-conditions-toggle-vertical {
    height: auto;
    min-height: 0;
    align-self: center;
}
.status-grid-label {
    font-weight: bold;
    color: var(--text-main, #222);
}
.status-grid-value {
    color: var(--accent, #4caf50);
}
.hf-conditions-panel {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 10px;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.96);
    color: #222;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    padding: 10px;
    opacity: 0;
    transform: translateX(-6px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.hf-conditions-panel.open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.hf-conditions-panel.closed {
    opacity: 0;
    transform: translateX(-6px);
    pointer-events: none;
}
.hf-conditions-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hf-conditions-title {
    font-size: 12px;
    font-weight: bold;
}
.hf-conditions-meta {
    font-size: 11px;
    color: #444;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hf-conditions-timestamp {
    opacity: 0.7;
}
.hf-conditions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.hf-conditions-table th,
.hf-conditions-table td {
    text-align: left;
    padding: 3px 4px;
}
.hf-conditions-table th {
    font-weight: bold;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
.hf-condition-good {
    color: #1b5e20;
    font-weight: bold;
}
.hf-condition-fair {
    color: #ef6c00;
    font-weight: bold;
}
.hf-condition-poor {
    color: #b71c1c;
    font-weight: bold;
}
.hf-condition-unknown {
    color: #6d6d6d;
    font-weight: bold;
}
.hf-conditions-empty {
    font-size: 11px;
    opacity: 0.8;
}

body.mobile-device .hf-conditions-panel,
body:not(.mobile-device) .mobile-status-grid .hf-conditions-panel {
    position: static;
    margin-left: 0;
    transform: none;
    opacity: 1;
    box-shadow: none;
    padding: 6px 0 0 0;
}
body.mobile-device .hf-conditions-panel.closed {
    display: none;
}
body.mobile-device .hf-conditions-toggle {
    margin-left: 0;
}
.status-ws-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.ws-dot-inside {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    background: #ffb300;
    transition: background 0.2s, box-shadow 0.2s;
}
.ws-dot-inside.connected {
    background: #00e676;
    animation: pulse-green 1.2s infinite;
}
.ws-dot-inside.disconnected {
    background: #e53935;
    animation: pulse-red 1.2s infinite;
}
.ws-dot-inside.connecting {
    background: #ffb300;
    animation: pulse 1.2s infinite;
}
.ws-dot-label {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}
#ws-dot { display: none !important; }

.status-table table {
    border-collapse: collapse;
    font-size: 13px;
    font-family: Arial, sans-serif;
}

.status-table td {
    padding: 4px 8px;
    border: none;
}

.status-table td:first-child,
.status-table td:nth-child(3) {
    font-weight: bold;
    color: #333;
}

.status-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid #ccc;
    margin-left: 5px;
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
    box-sizing: border-box;
    margin-right: 8px;
}

.status-light.blue.status-light-on {
    background-color: #2196F3;
    color: #fff;
    animation: pulse 1.2s infinite;
}

.status-light.blue.status-light-off {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-light.red.status-light-on {
    background-color: #f44336;
    color: #fff;
    animation: pulse-red 1.2s infinite;
}

.status-light.red.status-light-off {
    background-color: #ffebee;
    color: #c62828;
}

.status-light.decoding {
    background-color: #a259e6;
    color: #fff;
}
.status-light.status-light-decoding-on.decoding {
    animation: pulse-decoding 1.2s infinite;
    background-color: #a259e6;
    color: #fff;
}
.status-light.status-light-decoding-off.decoding {
    background-color: #ede7f6;
    color: #a259e6;
}
.legend-user {
    background: #cfe2ff;
    border-color: #0d47a1;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(33,150,243, 0.7), 0 1px 4px rgba(0,0,0,0.15);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(33,150,243, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(33,150,243, 0);
    }
}
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(244,67,54, 0.7), 0 1px 4px rgba(0,0,0,0.15);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(244,67,54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244,67,54, 0);
    }
}
@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(0,230,118, 0.7), 0 1px 4px rgba(0,0,0,0.15);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(0,230,118, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0,230,118, 0);
    }
}
@keyframes pulse-decoding {
    0% {
        box-shadow: 0 0 0 0 rgba(162,89,230, 0.7), 0 1px 4px rgba(0,0,0,0.15);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(162,89,230, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(162,89,230, 0);
    }
}

/* Ensure Leaflet controls on the left are visible and not forced to the right */
.leaflet-top.leaflet-left {
    z-index: 1100;
}

.active-grids-control {
    z-index: 1100 !important;
    max-height: 75vh;
    overflow-y: auto;
}

/* Force all Leaflet controls and the grid table to a lower z-index */
.leaflet-control,
.leaflet-top,
.leaflet-bottom,
.active-grids-control {
    z-index: 1100 !important;
}

/* Settings dropdown always on top */
#settings-dropdown {
    z-index: 99999 !important;
    position: fixed !important;
}

.status-dot-large {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(145deg, #e6e6e6 0%, #bdbdbd 100%);
    opacity: 0.5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18), 0 1px 1px #fff inset, 0 0 0 2px #fff inset;
    border: 2px solid #fff;
    transition: opacity 0.2s, box-shadow 0.2s;
    letter-spacing: 1px;
    /* 3D effect */
    background-blend-mode: multiply;
}
.status-dot-large.rx,
.status-dot-large.tx,
.status-dot-large.dec {
    width: 28px;
    height: 28px;
    font-size: 12px;
}
.status-dot-large.rx {
    background: radial-gradient(circle at 30% 30%, #2196f3 70%, #1565c0 100%);
    box-shadow: 0 2px 8px #2196f3, 0 1px 1px #fff inset, 0 0 0 2px #fff inset;
}
.status-dot-large.tx {
    background: radial-gradient(circle at 30% 30%, #e53935 70%, #b71c1c 100%);
    box-shadow: 0 2px 8px #e53935, 0 1px 1px #fff inset, 0 0 0 2px #fff inset;
}
.status-dot-large.dec {
    background: radial-gradient(circle at 30% 30%, #a259e6 70%, #5e35b1 100%);
    box-shadow: 0 2px 8px #a259e6, 0 1px 1px #fff inset, 0 0 0 2px #fff inset;
}
.status-dot-large.active {
    opacity: 1;
    box-shadow: 0 0 12px 4px currentColor, 0 2px 8px rgba(0,0,0,0.18), 0 1px 1px #fff inset, 0 0 0 2px #fff inset;
} 