/**
 * Location Manager Frontend CSS
 * Styles for the frontend map interface and filtering system
 */

/* Main Container */
.location-manager-frontend {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Filter Section */
.filters {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: end;
    position: relative;
}

.filters::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #056839;
    border-radius: 8px 8px 0 0;
}

/* Filter Groups */
.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select {
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #495057;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="m0 1 2 2 2-2z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

.filter-group select:focus {
    outline: none;
    border-color: #056839;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
    background-color: #fff;
}

.filter-group select:hover {
    border-color: #056839;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 10px;
    align-items: end;
}

.button {
    background: #056839;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
    height: 44px;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.button.secondary {
    background: #6c757d;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.button.secondary:hover {
    background: #5a6268;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* Map Container */
#location-map {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    min-height: 400px;
}

/* List Container for Birth Locations */
.location-list-container {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background: #fff;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    display: none; /* Hidden by default */
}

.birth-locations-list {
    padding: 20px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #056839;
}

.list-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
}

.list-count {
    background: #056839;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.active-filters {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #bbdefb;
    margin-bottom: 8px;
}

.district-group {
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.district-header {
    background: linear-gradient(135deg, #056839 0%, #044d2a 100%);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.places-list {
    padding: 15px 20px;
}

.place-item {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.place-item:last-child {
    border-bottom: none;
}

.place-item:hover {
    background-color: rgba(5, 104, 57, 0.05);
    border-radius: 4px;
    margin: 0 -10px;
    padding: 12px 10px;
}

.place-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    /* Removed margin-bottom since we're not showing coordinates anymore */
}

.no-locations-message {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 18px;
    font-style: italic;
}

/* Custom Marker Styles */
.custom-div-icon {
    background: transparent;
    border: none;
}

.custom-marker {
    position: relative;
    animation: markerDrop 0.6s ease-out;
}

@keyframes markerDrop {
    0% {
        transform: translateY(-100px) rotate(-45deg);
        opacity: 0;
    }
    60% {
        transform: translateY(10px) rotate(-45deg);
        opacity: 1;
    }
    100% {
        transform: translateY(0) rotate(-45deg);
        opacity: 1;
    }
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e5e9;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: 300px !important;
}

.leaflet-popup-close-button {
    width: 24px !important;
    height: 24px !important;
    font-size: 18px !important;
    padding: 4px !important;
    margin: 6px !important;
    border-radius: 50% !important;
    color: #495057 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.leaflet-popup-close-button:hover {
    background: #fff !important;
    color: #2c3e50 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

.leaflet-popup-tip-container {
    margin-top: -1px;
}

.leaflet-popup-tip {
    background: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.location-popup {
    padding: 16px;
    background: #fff;
}

.popup-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #056839;
    padding-bottom: 8px;
}

.popup-details p {
    margin: 8px 0;
    font-size: 14px;
    color: #495057;
}

.popup-details strong {
    color: #2c3e50;
    font-weight: 600;
}

.type-badge {
    background: #056839;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-date {
    font-style: italic;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
    padding-top: 8px;
    margin-top: 12px;
}

/* Popup Actions */
.popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.copy-coords-btn,
.open-maps-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex: 1;
}

.copy-coords-btn:hover {
    background: #218838;
}

.open-maps-btn {
    background: #17a2b8;
}

.open-maps-btn:hover {
    background: #138496;
}

/* Notifications */
.location-notification {
    position: relative;
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.location-notification-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.location-notification-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.location-notification-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.location-notification-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.notification-message {
    flex: 1;
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    margin-left: 15px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.2s ease;
}

.notification-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* Loading States */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

.loading-spinner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    color: #495057;
}

.loading-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #056839;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Count Display */
.location-count,
.filter-count {
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
    margin-bottom: 10px;
    text-align: right;
}

/* Responsive Design */
@media (max-width: 768px) {
    .location-manager-frontend {
        margin: 10px 0;
    }
    
    .filters {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }
    
    .filter-group {
        min-width: auto;
        width: 100%;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .button {
        flex: 1;
        min-width: auto;
    }
    
    #location-map {
        height: 350px !important;
        min-height: 350px;
    }

    .location-list-container {
        height: 350px !important;
        min-height: 350px;
        max-height: 350px;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .list-header h3 {
        font-size: 20px;
    }

    .district-header {
        padding: 12px 15px;
        font-size: 14px;
    }

    .places-list {
        padding: 10px 15px;
    }

    .place-item {
        padding: 10px 0;
    }

    .place-name {
        font-size: 15px;
    }
    
    .location-popup {
        min-width: 200px;
        max-width: 250px;
        padding: 15px;
    }
    
    .popup-title {
        font-size: 16px;
    }
    
    .popup-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .copy-coords-btn,
    .open-maps-btn {
        width: 100%;
    }
    
    .leaflet-popup-content {
        width: 250px !important;
    }
    
    .leaflet-popup-close-button {
        width: 20px !important;
        height: 20px !important;
        font-size: 16px !important;
        margin: 4px !important;
    }
}

@media (max-width: 480px) {
    .filters {
        padding: 10px;
    }
    
    .filter-group select {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .button {
        padding: 8px 15px;
        font-size: 13px;
        height: 40px;
    }
    
    #location-map {
        height: 300px !important;
        min-height: 300px;
    }

    .location-list-container {
        height: 300px !important;
        min-height: 300px;
        max-height: 300px;
    }

    .birth-locations-list {
        padding: 15px;
    }

    .list-header h3 {
        font-size: 18px;
    }

    .list-count {
        font-size: 12px;
        padding: 4px 8px;
    }

    .district-header {
        padding: 10px 12px;
        font-size: 13px;
    }

    .places-list {
        padding: 8px 12px;
    }

    .place-name {
        font-size: 14px;
    }

    .place-coordinates {
        font-size: 12px;
    }
    
    .location-popup {
        min-width: 180px;
        max-width: 220px;
        padding: 12px;
    }
    
    .popup-title {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .popup-details p {
        font-size: 13px;
        margin: 6px 0;
    }
    
    .leaflet-popup-content {
        width: 200px !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .location-manager-frontend {
        color: #e9ecef;
    }
    
    .filters {
        background: linear-gradient(135deg, #343a40 0%, #495057 100%);
        border-color: #495057;
    }
    
    .filter-group label {
        color: #f8f9fa;
    }
    
    .filter-group select {
        background: #495057;
        color: #f8f9fa;
        border-color: #6c757d;
    }
    
    .filter-group select:focus {
        border-color: #056839;
        background: #495057;
    }
    
    #location-map {
        border-color: #495057;
    }
    
    .leaflet-popup-content-wrapper,
    .leaflet-popup-tip {
        background: #343a40;
        border-color: #495057;
    }
    
    .leaflet-popup-close-button {
        background: rgba(52, 58, 64, 0.9) !important;
        border-color: #495057 !important;
        color: #f8f9fa !important;
    }
    
    .leaflet-popup-close-button:hover {
        background: #495057 !important;
        color: #fff !important;
    }
    
    .location-popup {
        background: #343a40;
    }
    
    .popup-title {
        color: #f8f9fa;
    }
    
    .popup-details strong {
        color: #f8f9fa;
    }
    
    .popup-details p {
        color: #dee2e6;
    }

    .location-list-container {
        background: #343a40;
        border-color: #495057;
    }

    .birth-locations-list {
        color: #f8f9fa;
    }

    .list-header h3 {
        color: #f8f9fa;
    }

    .district-group {
        background: #495057;
        border-color: #6c757d;
    }

    .place-item {
        border-bottom-color: #6c757d;
    }

    .place-item:hover {
        background-color: rgba(5, 104, 57, 0.2);
    }

    .place-name {
        color: #f8f9fa;
    }

    .no-locations-message {
        color: #dee2e6;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .filters {
        border: 3px solid #000;
    }
    
    .filter-group select {
        border: 2px solid #000;
    }
    
    .button {
        border: 2px solid #000;
    }
    
    #location-map {
        border: 3px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .custom-marker {
        animation: none;
    }
    
    .location-notification {
        animation: none;
    }
    
    .loading-spinner::before {
        animation: none;
    }
    
    * {
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    .filters {
        display: none;
    }
    
    .location-notification {
        display: none;
    }
    
    #location-map {
        height: 400px !important;
        border: 1px solid #000;
    }
    
    .location-manager-frontend {
        margin: 0;
    }
}