/**
 * NYC Manhattan Reachability Map - Modern Professional Styling
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    overflow: hidden;
}

/* City Name Display */
.city-name {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.city-label {
    font-family: 'Gotham', 'Avenir Next', 'Helvetica Neue', sans-serif;
    font-size: 48px;
    font-weight: 900;
    letter-spacing: 7px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    margin: 0;
    padding: 0;
}

/* Main Container */
.main-container {
    display: flex;
    height: 100vh;
}

/* Map */
#map {
    flex: 1;
    height: 100vh;
    background-color: #f8f9fa;
}

/* NYC Border Glow Effect */
.nyc-border-glow {
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.4));
}

/* Sidebar Panel */
.sidebar-panel {
    width: 320px;
    background: white;
    box-shadow: -2px 0 15px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 999;
    border-left: 1px solid #e0e0e0;
}

.sidebar-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.sidebar-header h2 {
    font-family: 'Gotham', 'Avenir Next', 'Helvetica Neue', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.sidebar-header .subtitle {
    font-family: 'Gotham', 'Avenir Next', 'Helvetica Neue', sans-serif;
    font-size: 12px;
    opacity: 0.8;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Control Cards */
.control-card {
    background: white;
    margin: 0;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.control-card:last-child {
    border-bottom: none;
}

.control-card h3 {
    font-family: 'Gotham', 'Avenir Next', 'Helvetica Neue', sans-serif;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
    display: inline-block;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Travel Mode Buttons */
.travel-mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mode-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.mode-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mode-btn i {
    font-size: 20px;
}

.mode-btn span {
    font-size: 12px;
    font-weight: 600;
}

/* Analysis Buttons */
.analysis-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.analysis-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.analysis-btn:hover {
    background: #e9ecef;
    border-color: #28a745;
    transform: translateY(-2px);
}

.analysis-btn.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.analysis-btn i {
    font-size: 18px;
}

.analysis-btn span {
    font-size: 12px;
    font-weight: 600;
}

/* Range Controls */
.range-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.range-controls label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.range-select {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.range-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

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

.checkbox-container label {
    cursor: pointer;
    font-weight: 500;
    margin: 0;
}

/* Location Controls */
.location-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-family: 'Gotham', 'Avenir Next', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.location-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.location-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.location-input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

.location-input-container {
    position: relative;
}

.location-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.location-dropdown-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.location-dropdown-item:hover {
    background-color: #f8f9fa;
}

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

.location-dropdown-item .location-name {
    font-weight: 600;
    color: #212529;
    margin-bottom: 2px;
}

.location-dropdown-item .location-address {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.3;
}

.input-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.draw-btn:hover {
    background: #17a2b8;
    color: white;
    border-color: #17a2b8;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.draw-btn.active {
    background: #17a2b8;
    color: white;
    border-color: #17a2b8;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.draw-btn.active:hover {
    background: #138496;
    border-color: #138496;
}

.clear-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.search-btn:hover {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.coords-btn:hover {
    background: #fd7e14;
    color: white;
    border-color: #fd7e14;
    box-shadow: 0 4px 15px rgba(253, 126, 20, 0.3);
}

.export-btn:hover {
    background: #28a745;
    color: white;
    border-color: #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.action-btn i {
    font-size: 16px;
}

/* Legend */
.legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.3s ease;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #ddd;
}

.legend-color.walking {
    background-color: #0073d4;
}

.legend-color.cycling {
    background-color: #00ff00;
}

.legend-color.driving {
    background-color: #ff7800;
}

.legend-color.wheelchair {
    background-color: #ff0000;
}

.subway-station-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-align: center;
    border-radius: 4px;
    border: 2px solid #ddd;
    background-color: #f8f9fa;
}

.legend-item span {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

/* Statistics */
.stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stats p:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.stat-value {
    font-weight: 700;
    color: #667eea;
    font-size: 14px;
}

/* Scrollbar Styling */
.sidebar-panel::-webkit-scrollbar {
    width: 6px;
}

.sidebar-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-panel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-panel::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar-panel {
        width: 100%;
        height: 40vh;
        order: 2;
    }
    
    #map {
        height: 60vh;
        order: 1;
    }
    
    .city-tabs {
        flex-wrap: wrap;
        height: auto;
        padding: 10px;
    }
    
    .city-tab {
        margin: 4px;
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* Leaflet Control Positioning */
.leaflet-control-container .leaflet-bottom.leaflet-right {
    margin-bottom: 20px;
    margin-right: 400px;
}

/* Attribution Control - Position properly */
.leaflet-control-attribution {
    position: fixed !important;
    bottom: 10px !important;
    right: 330px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    padding: 2px 5px !important;
    font-size: 11px !important;
    border-radius: 3px !important;
    margin: 0 !important;
}

/* Hide the plugin's built-in UI completely */
.leaflet-control-reachability {
    display: none !important;
}

.reachability-control-hide {
    display: none !important;
}

@media (max-width: 768px) {
    .leaflet-control-container .leaflet-bottom.leaflet-right {
        margin-right: 20px;
    }
    
    .leaflet-control-attribution {
        right: 10px !important;
        bottom: 10px !important;
    }
}

/* Subway Lines and Stations Styling */
.subway-line {
    cursor: default;
    transition: all 0.2s ease;
}

/* Hover effects disabled for subway lines */
/* .subway-line:hover {
    filter: brightness(1.2);
    stroke-width: 4px !important;
} */

.subway-station {
    cursor: pointer;
    transition: all 0.2s ease;
}

.subway-station:hover {
    stroke-width: 3px !important;
    stroke: #333 !important;
    filter: brightness(1.1);
}

/* Greyed out subway stations when inactive */
.subway-station.inactive {
    opacity: 0.3 !important;
    filter: grayscale(100%) !important;
    pointer-events: none !important;
}

.subway-line.inactive {
    opacity: 0.3 !important;
    filter: grayscale(100%) !important;
    pointer-events: none !important;
}

.subway-station.active {
    stroke: #333 !important;
    stroke-width: 3px !important;
    filter: brightness(1.1);
}

/* Wheelchair accessibility icon */
.wheelchair-icon {
    pointer-events: none !important;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    z-index: 1000;
}

/* Ensure wheelchair icons pane doesn't block clicks */
.leaflet-wheelchair-icons-pane {
    pointer-events: none !important;
}

/* Station popup styling following settings panel design */
.leaflet-popup-content-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 0;
    margin: 0;
    min-width: 280px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    z-index: 99999 !important;
}

.leaflet-popup-content {
    margin: 0;
    line-height: 1.5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    color: #333;
    padding: 20px;
}

.leaflet-popup-content h4 {
    margin: 0 0 15px 0;
    font-family: 'Gotham', 'Avenir Next', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
    display: inline-block;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.leaflet-popup-content p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.leaflet-popup-content strong {
    font-weight: 600;
    color: #333;
}

.leaflet-popup-content button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid #667eea;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 15px;
    width: 100%;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.leaflet-popup-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    border-color: #5a6fd8;
}

.leaflet-popup-content button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* Force popup elements above everything */
.leaflet-popup-pane {
    z-index: 99999 !important;
}

.leaflet-popup {
    z-index: 99999 !important;
}

.leaflet-tooltip-pane {
    z-index: 99999 !important;
}

.leaflet-tooltip {
    z-index: 99999 !important;
}

/* Isochrone contour labels styling - like topographic map contours */
.isochrone-label,
.isochrone-contour-label {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.4) !important;
    border-radius: 3px !important;
    padding: 1px 4px !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #222 !important;
    text-align: center !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
    pointer-events: none !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
    letter-spacing: 0.5px !important;
}

.isochrone-contour-label {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(102, 126, 234, 0.6) !important;
    color: #333 !important;
    font-size: 9px !important;
}

.isochrone-label::before,
.isochrone-contour-label::before {
    display: none !important;
}

.leaflet-popup-tip-container {
    width: 40px;
    height: 20px;
    position: absolute;
    left: 50%;
    margin-left: -20px;
    overflow: hidden;
    pointer-events: none;
}

.leaflet-popup-tip {
    width: 17px;
    height: 17px;
    padding: 1px;
    margin: -10px auto 0;
    transform: rotate(45deg);
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-left: none;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
}

.leaflet-popup-close-button {
    background: transparent;
    border: none;
    width: 24px;
    height: 24px;
    font-size: 18px;
    font-weight: 600;
    color: #999;
    right: 8px;
    top: 8px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 4px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.leaflet-popup-close-button:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

/* Animation for smooth transitions */
.sidebar-panel,
.control-card,
.mode-btn,
.analysis-btn,
.action-btn {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
