/* Decoder Spots History Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Twemoji Flags', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
    opacity: 0.9;
}

.controls {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.control-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 15px;
}

.control-group {
    flex: 1;
    min-width: 150px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    opacity: 0.9;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 1em;
}

.control-group button {
    width: 100%;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: #4CAF50;
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.control-group button:hover {
    background: #45a049;
}

.control-group button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.info-box {
    background: rgba(33, 150, 243, 0.2);
    border-left: 4px solid #2196F3;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1.5;
}

.info-box strong {
    color: #64B5F6;
}

.data-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1.4; /* prevent Safari Twemoji ascent/descent inflation */
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
}

.spots-table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.spots-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.spots-table th {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    line-height: 1.4;
}

.spots-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s;
}

.spots-table th.sortable:hover {
    background: rgba(255, 255, 255, 0.15);
}

.spots-table th.sortable .sort-arrows {
    opacity: 0.3;
    font-size: 0.8em;
    margin-left: 5px;
}

.spots-table th.sortable:hover .sort-arrows {
    opacity: 0.6;
}

.spots-table th.sortable.sort-asc .sort-arrows::before {
    content: '▲';
    opacity: 1;
    color: #4CAF50;
}

.spots-table th.sortable.sort-desc .sort-arrows::before {
    content: '▼';
    opacity: 1;
    color: #4CAF50;
}

.spots-table th.sortable.sort-asc .sort-arrows,
.spots-table th.sortable.sort-desc .sort-arrows {
    opacity: 1;
}

.spots-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.4;
}

.spots-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mode-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
}

.mode-ft8 { background: #4CAF50; }
.mode-ft4 { background: #2196F3; }
.mode-ft2 { background: #9C27B0; }
.mode-wspr { background: #FF9800; }

.snr-positive { color: #4CAF50; }
.snr-negative { color: #ef4444; }

.status {
    text-align: center;
    padding: 10px;
    margin-top: 20px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
}

.status.error {
    background: rgba(244, 67, 54, 0.3);
}

.status.success {
    background: rgba(76, 175, 80, 0.3);
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.site-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9em;
    opacity: 0.8;
}

.site-footer a {
    color: #4CAF50;
    text-decoration: none;
    transition: color 0.3s;
}

.site-footer a:hover {
    color: #45a049;
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
}

/* Date Picker Styles */
.date-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.date-picker-overlay.active {
    display: flex;
}

.date-picker {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 350px;
    width: 90%;
}

.date-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.date-picker-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.date-picker-nav {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.date-picker-nav button {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 1.2em;
}

.date-picker-nav button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.date-picker-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.date-picker-month-year {
    flex: 1;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
}

.date-picker-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.date-picker-day-header {
    text-align: center;
    font-weight: bold;
    padding: 8px;
    font-size: 0.9em;
    opacity: 0.7;
}

.date-picker-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.date-picker-day:hover:not(.disabled):not(.empty) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.date-picker-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.2);
}

.date-picker-day.empty {
    background: transparent;
    cursor: default;
}

.date-picker-day.selected {
    background: #4CAF50;
    font-weight: bold;
}

.date-picker-day.available {
    background: rgba(76, 175, 80, 0.3);
}

.date-picker-footer {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.date-picker-footer button {
    padding: 8px 16px;
}

/* Map Section Styles */
.map-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.map-section h2 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

#spots-map {
    height: 600px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.map-legend {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
}

.map-legend h3 {
    margin-bottom: 10px;
    font-size: 1em;
    opacity: 0.9;
}

.band-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.band-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}

.band-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.band-legend-label {
    font-weight: 500;
}

/* Leaflet marker custom styles */
.custom-marker {
    background: transparent !important;
    border: none !important;
}
/* Callsign spot history modal */
.callsign-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.callsign-modal-overlay.active {
    display: flex;
}

.callsign-modal {
    background: rgba(30, 35, 55, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.callsign-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.callsign-modal-header h3 {
    font-size: 1.3em;
    margin: 0;
}

.callsign-modal-subtitle {
    font-size: 0.9em;
    opacity: 0.7;
    margin-top: 4px;
}

.callsign-modal-body {
    padding: 15px 20px;
    overflow-y: auto;
    flex: 1;
}

.callsign-modal-status {
    text-align: center;
    padding: 25px;
    opacity: 0.85;
}

.callsign-modal-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.callsign-modal-pagination select {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
}

.callsign-modal-pagination button {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.callsign-modal-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.callsign-modal-pagination button.active {
    background: rgba(33, 150, 243, 0.8);
    font-weight: bold;
}

.callsign-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.callsign-modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.95em;
}

@media (max-width: 768px) {
    .callsign-modal {
        max-height: 95vh;
    }

    .callsign-modal-body {
        padding: 10px;
    }
}

.callsign-modal-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.callsign-modal-filter {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95em;
}

.callsign-modal-filter label {
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.callsign-modal-filter input[type="text"],
.callsign-modal-filter select {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
}

#callsignModalTable th.modal-sortable {
    cursor: pointer;
    user-select: none;
}

#callsignModalTable th.modal-sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

#callsignModalClose {
    background: transparent;
    border: none;
    color: white;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s ease;
}

#callsignModalClose:hover {
    opacity: 1;
}

/* Modal stat cards: keep all five on a single row */
#callsignModalStats {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

#callsignModalStats .stat-card {
    padding: 10px;
    min-width: 0;
}

#callsignModalStats .stat-value {
    font-size: 1.4em;
    overflow-wrap: anywhere;
}

#callsignModalStats .stat-label {
    font-size: 0.8em;
    overflow-wrap: anywhere;
}

@media (max-width: 700px) {
    #callsignModalStats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* "View decodes" button in map popups (popup body is light, not the page dark) */
.popup-view-decodes {
    flex-shrink: 0;
    padding: 2px 8px;
    background: #2196F3;
    border: none;
    border-radius: 3px;
    color: white;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.6;
    cursor: pointer;
    white-space: nowrap;
}

.popup-view-decodes:hover {
    background: #1976D2;
}
