/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
#header {
    background: #1a1a2e;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    z-index: 1000;
}

#header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

#search-container {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
    position: relative;
}

#address-input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
}

#address-input:focus {
    outline: 2px solid #4a90d9;
}

#search-btn {
    padding: 10px 20px;
    background: #4a90d9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

#search-btn:hover {
    background: #357abd;
}

#search-btn:disabled {
    background: #888;
    cursor: not-allowed;
}

/* Suggestions dropdown */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 60px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}

.suggestions-dropdown.active {
    display: block;
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #333;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f0f7ff;
}

/* Map styles */
#map {
    flex: 1;
    z-index: 1;
    cursor: crosshair;
}

/* Long press indicator */
#map.pressing {
    cursor: wait;
}

/* Hint text */
.map-hint {
    position: absolute;
    bottom: 30px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #666;
    z-index: 1000;
    pointer-events: none;
}

/* Combined Coverage Panel */
#coverage-panel {
    position: absolute;
    top: 80px;
    right: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    width: 180px;
    font-size: 0.7rem;
}

.panel-section {
    padding: 8px 10px;
}

.panel-section + .panel-section {
    border-top: 1px solid #eee;
}

/* Layer Controls */
.layer-controls .carrier-row {
    margin-bottom: 2px;
}

.layer-controls .carrier-row:last-child {
    margin-bottom: 0;
}

.carrier-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
}

.carrier-toggle input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
    cursor: pointer;
}

.att-color { color: #007AFF; }
.verizon-color { color: #CD2026; }
.tmobile-color { color: #E20074; }

/* Coverage status section */
#coverage-status {
    max-height: 280px;
    overflow-y: auto;
}

.coverage-carrier {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.coverage-carrier:last-child {
    margin-bottom: 0;
}

.status-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.status-icon.available {
    background: #34c759;
}

.status-icon.unavailable {
    background: #ff3b30;
}

.status-icon.unknown {
    background: #999;
}

.status-icon.loading {
    background: #f5a623;
    animation: pulse 1s ease-in-out infinite;
}

.status-icon.error {
    background: #ff3b30;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Coverage source info */
.coverage-source {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    color: #888;
}

.coverage-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ff3b30;
}

/* All providers list */
.all-providers {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
}

.all-providers strong {
    display: block;
    margin-bottom: 6px;
    color: #333;
}

.all-providers ul {
    margin: 0;
    padding-left: 18px;
    color: #555;
}

.all-providers li {
    margin-bottom: 4px;
}

.all-providers small {
    color: #888;
}

/* Signal Indicator */
.signal-indicator {
    text-align: center;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.signal-score {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.signal-bars {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin: 6px 0 4px;
}

.signal-bar {
    width: 12px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 1px;
}

.signal-label {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 1px;
}

.signal-desc {
    font-size: 0.6rem;
    color: #888;
}

/* Tower data styles */
.tower-data {
    font-size: 0.65rem;
}

.tower-source {
    color: #999;
    margin-bottom: 6px;
}

.tower-carrier {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
}

.tower-carrier:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tower-carrier.carrier-unselected {
    opacity: 0.4;
}

.tower-carrier .carrier-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tower-carrier .carrier-name {
    font-weight: 600;
    font-size: 0.7rem;
}

.tower-carrier .carrier-score {
    font-size: 0.65rem;
    font-weight: 600;
}

.tower-details {
    display: flex;
    gap: 6px;
    color: #999;
    margin-top: 1px;
}

.tower-count {
    color: #333;
}

.signal-strength {
    font-weight: 500;
}

.tower-tech {
    color: #888;
    font-size: 0.75rem;
}

.tower-distance {
    color: #888;
    font-size: 0.75rem;
}

.tower-error {
    color: #ff3b30;
    font-size: 0.85rem;
}

.no-coverage {
    color: #ff3b30;
}

.api-key-notice {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.5;
}

.api-key-notice code {
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.api-key-notice a {
    color: #4a90d9;
}


.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 0.85rem;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4a90d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Loading overlay */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a90d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading p {
    margin-top: 15px;
    color: #555;
    font-size: 1rem;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Leaflet overrides */
.leaflet-control-layers {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.leaflet-control-layers-toggle {
    width: 36px;
    height: 36px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    #header {
        padding: 10px 15px;
    }

    #header h1 {
        font-size: 1.2rem;
        width: 100%;
    }

    #search-container {
        max-width: 100%;
    }

    #coverage-panel {
        top: auto;
        bottom: 20px;
        right: 10px;
        width: 160px;
    }
}
