/* WSPR Globe Styles */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2000; /* Higher than header (1000) to ensure it's always clickable */
    background: #1a1a2e;
    color: #4fc3f7;
    border: 1px solid #333;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    font-size: 1.4em;
    cursor: pointer;
    display: none;  /* Hidden when sidebar is open */
    opacity: 0.9;
    pointer-events: auto;
    touch-action: manipulation; /* Better touch handling on mobile */
}

.sidebar-toggle:hover {
    background: #252540;
    opacity: 1;
}

/* Show toggle when sidebar is collapsed */
.sidebar-toggle.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Left Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    height: 100%;
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #333;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease, min-width 0.3s ease;
}


.sidebar.collapsed {
    transform: translateX(-100%);
    width: 0;
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar.collapsed.accordion-open {
    /* Don't widen if collapsed */
    width: 0;
    min-width: 0;
}

.sidebar:not(.collapsed).accordion-open {
    width: 560px;
    min-width: 560px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.sidebar-header h1 {
    font-size: 1.4em;
    color: #4fc3f7;
    margin: 0;
    border: none;
    padding: 0;
}

.sidebar-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.sidebar-close:hover {
    background: #333;
    color: #fff;
}

.sidebar h1 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #4fc3f7;
    padding-bottom: 10px;
}

.sidebar h2 {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin: 20px 0 10px 0;
}

/* Accordion Styles */
.accordion {
    margin-bottom: 20px;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
    background: #252540;
}

.accordion-header {
    width: 100%;
    padding: 12px 15px;
    background: #252540;
    border: none;
    color: #4fc3f7;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #2a2a50;
}

.accordion-icon {
    font-size: 0.8em;
    transition: transform 0.3s;
    color: #888;
}

.accordion.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    padding: 0 15px;
    transition: max-height 0.5s ease-in-out, padding 0.3s ease-in-out;
}

.accordion.active .accordion-content {
    max-height: 2500px;
    padding: 15px;
    padding-bottom: 20px;
    transition: max-height 0.5s ease-in-out, padding 0.3s ease-in-out;
    overflow: visible;
}

.how-to-content {
    padding: 0;
    color: #e0e0e0;
    font-size: 0.85em;
    line-height: 1.6;
}

.how-to-content h3 {
    color: #4fc3f7;
    font-size: 1em;
    margin: 15px 0 8px 0;
    font-weight: 600;
}

.how-to-content h3:first-child {
    margin-top: 0;
}

.how-to-content p {
    margin-bottom: 12px;
    color: #ccc;
}

.how-to-content ul {
    margin: 8px 0 12px 20px;
    color: #ccc;
}

.how-to-content li {
    margin-bottom: 6px;
}

.how-to-content p:last-child,
.how-to-content ul:last-child {
    margin-bottom: 0;
}

.how-to-content li strong {
    color: #4fc3f7;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85em;
    margin-bottom: 5px;
    color: #aaa;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #252540;
    color: #fff;
    font-size: 0.9em;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #4fc3f7;
}

.form-group input[type="text"]::placeholder {
    color: #666;
}

.help-text {
    font-size: 0.75em;
    color: #666;
    margin-top: 3px;
}

.checkbox-group {
    margin: 10px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
}

.checkbox-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkbox-label.disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    cursor: pointer;
}

#arcOptions.hidden {
    opacity: 0.4;
    pointer-events: none;
}

.time-gradient {
    margin-top: 10px;
}

.gradient-bar {
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(to right, #0066ff, #00ffff, #00ff00, #ffff00, #ff6600, #ff0000);
}

.gradient-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: #888;
    margin-top: 4px;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.95em;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-primary {
    background: #4fc3f7;
    color: #000;
    font-weight: 600;
}

.btn-primary:hover {
    background: #29b6f6;
}

.btn-primary:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

.status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.85em;
    background: #252540;
    min-height: 40px;
}

.status.loading {
    color: #ffd54f;
}

.status.success {
    color: #81c784;
}

.status.error {
    color: #e57373;
}

/* Stats Panel */
.stats-panel {
    margin-top: 15px;
    padding: 12px;
    background: #252540;
    border-radius: 4px;
    border: 1px solid #333;
}

.stats-panel h2 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.85em;
}

.stat-label {
    color: #888;
}

.stat-value {
    color: #4fc3f7;
    font-weight: 500;
}

/* Frequency band legend */
.band-legend {
    margin-top: 20px;
}

.band-legend h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 2px 8px;
    font-size: 0.7em;
    background: #333;
    color: #aaa;
    border: 1px solid #555;
    border-radius: 3px;
    cursor: pointer;
}

.btn-small:hover {
    background: #444;
    color: #fff;
}

.band-filter {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.band-checkbox {
    display: flex;
    align-items: center;
    font-size: 0.8em;
    cursor: pointer;
}

.band-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    cursor: pointer;
}

.band-checkbox .band-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    margin-right: 6px;
}

.band-item {
    display: flex;
    align-items: center;
    font-size: 0.8em;
    margin: 4px 0;
}

.band-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    margin-right: 8px;
}

/* Globe Container */
#globeContainer {
    flex: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.globe-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
}

.time-window-display {
    color: #fff;
    font-size: 12px;
    font-family: monospace;
    white-space: nowrap;
    display: none;
    pointer-events: none;
}

.time-window-display.visible {
    display: block;
}

/* Spot Details Popup */
.spot-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a2e;
    border: 1px solid #4fc3f7;
    border-radius: 8px;
    padding: 20px;
    min-width: 280px;
    max-width: 400px;
    z-index: 300;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
}

.spot-popup.visible {
    display: block;
}

.popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.popup-close:hover {
    background: #333;
    color: #fff;
}

.popup-content h3 {
    color: #4fc3f7;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.popup-content .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #252540;
}

.popup-content .detail-row:last-child {
    border-bottom: none;
}

.popup-content .detail-label {
    color: #888;
    font-size: 0.9em;
}

.popup-content .detail-value {
    color: #fff;
    font-weight: 500;
}

.popup-content .detail-value.highlight {
    color: #4fc3f7;
}

.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
}

.popup-overlay.visible {
    display: block;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;  /* Always show on mobile */
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    /* On mobile, allow sidebar to widen but cap at screen width */
    .sidebar.accordion-open {
        width: min(560px, 90vw);
        min-width: min(560px, 90vw);
    }
    
    #globeContainer {
        width: 100%;
    }
    
    .globe-info {
        bottom: 10px;
        left: 10px;
        right: 10px;
        text-align: center;
    }
    
    /* Larger touch targets on mobile */
    .form-group input[type="text"],
    .form-group select {
        padding: 12px;
        font-size: 16px;  /* Prevents iOS zoom on focus */
    }
    
    .btn {
        padding: 14px;
        font-size: 1em;
    }
    
    .checkbox-label {
        padding: 8px 0;
    }
    
    .checkbox-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    
    .band-checkbox {
        padding: 6px 0;
    }
    
    .band-checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
}

/* Time-lapse Controls */
.timelapse-controls {
    margin-top: 15px;
    padding: 12px;
    background: #252540;
    border-radius: 4px;
    border: 1px solid #333;
}

.timelapse-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-secondary {
    flex: 1;
    padding: 8px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #444;
}

.btn-secondary:disabled {
    background: #222;
    color: #666;
    cursor: not-allowed;
}

.timelapse-time {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 8px;
    background: #1a1a2e;
    border-radius: 4px;
    font-size: 0.9em;
}

.timelapse-time-label {
    color: #888;
}

.timelapse-time-value {
    color: #4fc3f7;
    font-weight: 600;
    font-family: monospace;
}

.timelapse-progress {
    margin-top: 10px;
}

.timelapse-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
}

.timelapse-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4fc3f7;
    cursor: pointer;
}

.timelapse-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4fc3f7;
    cursor: pointer;
    border: none;
}

.timelapse-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Small phones */
@media (max-width: 400px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
    }
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    border-bottom: 1px solid #333;
    padding: 8px 20px;
    z-index: 1000;
    font-size: 0.75em;
    height: 50px;
    display: flex;
    align-items: center;
    transition: left 0.3s ease;
}

.header-content {
    width: 100%;
    max-width: 100%;
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Footer */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid #333;
    padding: 8px 20px;
    z-index: 1000;
    font-size: 0.75em;
    color: #888;
    text-align: center;
    height: 50px;
    display: flex;
    align-items: center;
    transition: left 0.3s ease;
}

.footer-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    margin: 0;
}

.footer-content a {
    color: #4fc3f7;
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

/* Adjust globe container to account for header and footer */
#globeContainer {
    padding-top: 50px;
    padding-bottom: 50px;
}

@media (max-width: 768px) {
    .site-header {
        padding: 6px 10px;
        font-size: 0.7em;
        height: 45px;
    }
    
    /* Ensure header doesn't block button clicks on mobile when sidebar is collapsed */
    body.sidebar-collapsed .site-header {
        left: 70px !important;
    }
    
    .site-footer {
        padding: 6px 10px;
        font-size: 0.7em;
        height: 45px;
    }
    
    #globeContainer {
        padding-top: 45px;
        padding-bottom: 45px;
    }
    
    /* Ensure hamburger button is always on top and clickable on mobile */
    .sidebar-toggle {
        z-index: 3000 !important;
        pointer-events: auto !important;
    }
}

