/* Decoder Spots Analytics Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, 'Twemoji Flags', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

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

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

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

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

.control-row:not(:first-child) {
    margin-top: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.control-group label {
    font-size: 0.9em;
    font-weight: 600;
    opacity: 0.9;
}

.control-group input,
.control-group select {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1em;
    transition: all 0.3s ease;
}

/* Ensure dropdown options always have black text on white background */
.control-group select option {
    background: white;
    color: black;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.control-group input::placeholder,
input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.control-group button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: #4CAF50;
    color: white;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.control-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.control-group button:active {
    transform: translateY(0);
}

.control-group button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: background 0.3s ease;
}

.control-group label:hover {
    background: rgba(255, 255, 255, 0.15);
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Data Container */
.data-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

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

/* Analytics Sections */
.analytics-section {
    margin-top: 30px;
}

.analytics-section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

/* Country/Continent Lists */
.country-list,
.continent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Single entity - use full width for better band card layout */
.country-list:has(.entity-card:only-child),
.continent-list:has(.entity-card:only-child) {
    grid-template-columns: 1fr;
}

/* When showing single entity, display bands in a grid */
.entity-card:only-child .bands-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (min-width: 1200px) {
    .entity-card:only-child .bands-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Reset band-info margin when in grid */
.entity-card:only-child .band-info {
    margin-bottom: 0;
}

.entity-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.entity-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.entity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.entity-name {
    font-size: 1.3em;
    font-weight: bold;
    line-height: 1.4; /* prevent Safari Twemoji ascent/descent inflation */
}

.entity-spots {
    font-size: 1.1em;
    color: #4CAF50;
    font-weight: 600;
}

.band-info {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid #2196F3;
    transition: all 0.3s ease;
}

.band-info-best {
    background: rgba(76, 175, 80, 0.15);
    border-left: 4px solid #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.3);
    transform: scale(1.02);
}

.band-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.band-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #2196F3;
}

.band-spots {
    color: #4CAF50;
    font-weight: 600;
}

.band-snr {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 8px;
}

.best-hours,
.active-hours {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
}

.best-hours strong {
    color: #FFC107;
}

.active-hours strong {
    color: #4CAF50;
}

.hour-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.hour-badge {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.hour-badge-best {
    background: rgba(255, 193, 7, 0.5);
    border: 2px solid rgba(255, 193, 7, 1);
    font-weight: 700;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.6);
    transform: scale(1.05);
}

/* Active Now Section */
.active-now-section {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(76, 175, 80, 0.15);
    border-radius: 8px;
    border: 2px solid rgba(76, 175, 80, 0.5);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.active-now-section.active-now-inactive {
    background: rgba(158, 158, 158, 0.15);
    border: 2px solid rgba(158, 158, 158, 0.5);
    box-shadow: 0 0 10px rgba(158, 158, 158, 0.2);
    animation: none;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.5);
    }
}

.active-now-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 1.05em;
}

.active-now-icon {
    font-size: 1.2em;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.active-now-time {
    font-size: 0.9em;
    opacity: 0.8;
    font-weight: normal;
    margin-left: auto;
}

.active-now-bands {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.active-now-band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border-left: 3px solid #4CAF50;
    transition: all 0.3s ease;
}

.active-now-band:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.active-now-band-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #4CAF50;
}

.active-now-band-info {
    font-size: 0.9em;
    opacity: 0.9;
}

.active-now-message {
    font-size: 0.95em;
    opacity: 0.8;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    text-align: center;
}

.next-bands-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.next-band-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    border-left: 3px solid #2196F3;
    transition: all 0.3s ease;
}

.next-band-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(5px);
}

.next-band-name {
    font-weight: bold;
    font-size: 1.05em;
    color: #2196F3;
}

.next-band-time {
    font-size: 0.9em;
    opacity: 0.9;
    color: #FFC107;
}

/* Hourly Chart */
.hourly-chart {
    margin-top: 10px;
    height: 60px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 5px;
}

.hourly-chart.hidden {
    display: none;
}

/* Status */
.status {
    text-align: center;
    padding: 20px;
    font-size: 1.1em;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.status.error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
}

.status.success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.site-footer a:hover {
    color: #66BB6A;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }

    .control-row {
        flex-direction: column;
    }

    .control-group {
        width: 100%;
    }

    .country-list,
    .continent-list {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 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); }
}

/* Datalist styling (limited browser support) */
datalist {
    display: none;
}

input[list]::-webkit-calendar-picker-indicator {
    opacity: 0.6;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    margin: 5% auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 25px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #ffffff;
}

.modal-close {
    color: #ffffff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
    color: #ffffff;
}

.callsign-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.callsign-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.callsign-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.callsign-link {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2em;
    display: block;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.callsign-link:hover {
    color: #66BB6A;
    text-decoration: underline;
}

.callsign-bands {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.band-badge {
    background: rgba(33, 150, 243, 0.3);
    border: 1px solid rgba(33, 150, 243, 0.6);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    color: #ffffff;
}

.clickable-callsigns {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    transition: all 0.3s ease;
}

.clickable-callsigns:hover {
    color: #4CAF50;
    text-decoration-style: solid;
}

/* Scrollbar styling for modal */
.modal-body::-webkit-scrollbar {
    width: 10px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Animation Controls */
.animation-controls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.anim-btn {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.anim-btn:hover {
    background: #1976D2;
    transform: scale(1.05);
}

.anim-btn:active {
    transform: scale(0.95);
}

.anim-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.play-btn {
    background: #4CAF50;
}

.play-btn:hover {
    background: #45a049;
}

.pause-btn {
    background: #FF9800;
}

.pause-btn:hover {
    background: #F57C00;
}

.stop-btn {
    background: #f44336;
}

.stop-btn:hover {
    background: #d32f2f;
}

.hour-slider {
    width: 200px;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.2);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.hour-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hour-slider::-webkit-slider-thumb:hover {
    background: #1976D2;
    transform: scale(1.2);
}

.hour-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.hour-slider::-moz-range-thumb:hover {
    background: #1976D2;
    transform: scale(1.2);
}

.hour-display {
    font-weight: bold;
    color: #333;
    min-width: 80px;
    text-align: center;
    font-size: 14px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: spin 1s ease-in-out infinite;
}

.loading-text {
    margin-top: 20px;
    font-size: 1.2em;
    color: white;
    font-weight: 600;
}

@media (max-width: 768px) {
    .animation-controls {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 8px;
    }

    .hour-slider {
        width: 150px;
    }

    .hour-display {
        min-width: 70px;
        font-size: 12px;
    }

    .anim-btn {
        padding: 6px 10px;
        font-size: 14px;
        min-width: 36px;
        height: 32px;
    }
}