/**
 * Location Tracker Map and Table Styles
 * Enhanced and Standardized
 */

/* ====================================
   MAP STYLES
   ==================================== */

/* Map Container */
.location-tracker-map-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.location-tracker-map-container > div {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Custom Marker */
.lt-marker {
    background: transparent;
    border: none;
}

.lt-marker-inner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #2D7FF9;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.lt-marker:hover .lt-marker-inner {
    transform: scale(1.2);
}

/* Highlighted Marker Animation */
.lt-marker-highlight {
    animation: markerPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(45, 127, 249, 0.7), 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

@keyframes markerPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(45, 127, 249, 0.7);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 0 10px rgba(45, 127, 249, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(45, 127, 249, 0);
    }
}

/* Enhanced Search Control */
.lt-search-control {
    margin: 10px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.lt-search-wrapper {
    position: relative;
    min-width: 320px;
}

.lt-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.lt-search-input-wrapper input {
    width: 100%;
    padding: 12px 45px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.lt-search-input-wrapper input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lt-search-icon {
    position: absolute;
    left: 12px;
    font-size: 16px;
    pointer-events: none;
}

.lt-clear-search {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
}

.lt-clear-search:hover {
    background: #e0e0e0;
    color: #333;
}

/* Search Results Dropdown */
.lt-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.lt-search-result-list {
    padding: 8px 0;
}

.lt-search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.lt-search-result-item:last-child {
    border-bottom: none;
}

.lt-search-result-item:hover {
    background-color: #f8f9fa;
}

.lt-search-result-item.lt-result-selected {
    background-color: #e8eaff;
    border-left: 3px solid #667eea;
}

.lt-result-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 14px;
}

.lt-result-title mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 2px 4px;
    border-radius: 3px;
}

.lt-result-meta {
    font-size: 12px;
    color: #666;
}

.lt-result-meta mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 1px 3px;
    border-radius: 2px;
}

.lt-result-lga,
.lt-result-ward,
.lt-result-sector {
    display: inline-block;
    margin-right: 8px;
}

.lt-no-search-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.lt-more-results {
    padding: 12px 16px;
    text-align: center;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    background: #f8f9fa;
    border-top: 1px solid #e8e8e8;
}

/* Search Stats */
.lt-search-stats {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    text-align: center;
}

.lt-result-count {
    font-weight: 600;
    color: #667eea;
}

/* Filter Control */
.lt-filter-control {
    margin: 10px;
    margin-top: 70px;
}

.lt-filter-toggle {
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lt-filter-toggle:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.lt-filter-badge {
    display: inline-block;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #667eea;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.lt-filter-panel {
    margin-top: 8px;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 250px;
}

.lt-filter-section {
    margin-bottom: 12px;
}

.lt-filter-section label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.lt-filter-section select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
    cursor: pointer;
}

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

.lt-filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.lt-filter-apply,
.lt-filter-clear {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lt-filter-apply {
    background: #667eea;
    color: white;
}

.lt-filter-apply:hover {
    background: #5568d3;
}

.lt-filter-clear {
    background: #f0f0f0;
    color: #666;
}

.lt-filter-clear:hover {
    background: #e0e0e0;
}

/* Popup Styles */
.location-tracker-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.location-tracker-popup .leaflet-popup-content {
    margin: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.lt-popup {
    min-width: 250px;
}

.lt-pop-img {
    margin: -15px -15px 15px -15px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.lt-pop-img img {
    width: 100%;
    height: auto;
    display: block;
}

.lt-pop-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    line-height: 1.4;
}

.lt-pop-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

.lt-row {
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
    line-height: 1.4;
}

.lt-row strong {
    color: #2c3e50;
    font-weight: 600;
}

/* Marker Clustering */
.marker-cluster-small {
    background-color: rgba(102, 126, 234, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(102, 126, 234, 0.8);
}

.marker-cluster-medium {
    background-color: rgba(241, 128, 23, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(241, 128, 23, 0.8);
}

.marker-cluster-large {
    background-color: rgba(231, 76, 60, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(231, 76, 60, 0.8);
}

.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster span {
    line-height: 30px;
}

/* Layer Control */
.leaflet-control-layers {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Zoom Control */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.leaflet-control-zoom a {
    border-radius: 0 !important;
}

.leaflet-control-zoom a:first-child {
    border-radius: 4px 4px 0 0 !important;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 4px 4px !important;
}

/* Reset Button */
.lt-reset {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    font-size: 18px;
    background: #fff;
    border-radius: 4px;
}

.lt-reset:hover {
    background-color: #f0f0f0 !important;
}

/* Scrollbar Styling for Search Results */
.lt-search-results::-webkit-scrollbar {
    width: 6px;
}

.lt-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

.lt-search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 8px;
}

.lt-search-results::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ====================================
   PROJECT TABLE STYLES
   ==================================== */

/* Table Wrapper */
.location-tracker-project-table-wrapper {
    max-width: 100%;
    margin: 20px 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Table Header */
.lt-table-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.lt-table-header h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
}

/* Filters */
.lt-table-filters {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.lt-table-filters input,
.lt-table-filters select {
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transition: all 0.3s ease;
}

.lt-table-filters input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.lt-table-filters input:focus,
.lt-table-filters select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.lt-table-filters select {
    cursor: pointer;
}

.lt-table-filters select option {
    background: #2c3e50;
    color: #ffffff;
}

/* Table Container */
.lt-table-container {
    overflow-x: auto;
    padding: 0;
}

/* Table */
.lt-projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.lt-projects-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e8e8e8;
}

.lt-projects-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lt-projects-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.lt-projects-table tbody tr:hover {
    background-color: #f8f9fa;
}

.lt-projects-table td {
    padding: 15px 20px;
    color: #555;
}

.lt-project-title {
    font-weight: 500;
    color: #2c3e50;
}

.lt-project-cost {
    font-weight: 600;
    color: #27ae60;
}

/* Status Badges */
.lt-status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lt-status-completed {
    background: #d4edda;
    color: #155724;
}

.lt-status-in-progress {
    background: #d1ecf1;
    color: #0c5460;
}

.lt-status-pending {
    background: #fff3cd;
    color: #856404;
}

.lt-status-not-started {
    background: #f8d7da;
    color: #721c24;
}

.lt-status-abandoned {
    background: #f5c6cb;
    color: #721c24;
}

.lt-status-on-hold {
    background: #e2e3e5;
    color: #383d41;
}

/* Action Link */
.lt-action-link {
    display: inline-block;
    padding: 6px 14px;
    background: #667eea;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.lt-action-link:hover {
    background: #5568d3;
}

/* Pagination */
.lt-table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #f8f9fa;
    border-top: 1px solid #e8e8e8;
}

.lt-pagination-buttons {
    display: flex;
    gap: 10px;
}

.lt-pagination-buttons button {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lt-pagination-buttons button:hover:not(:disabled) {
    background: #667eea;
    color: #ffffff;
    border-color: #667eea;
}

.lt-pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#lt-table-page-info {
    font-size: 14px;
    color: #666;
}

/* Loading State */
.lt-loading {
    text-align: center;
    padding: 60px 20px !important;
}

.lt-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* No Results */
.lt-no-results {
    text-align: center;
    padding: 60px 20px !important;
    color: #666;
    font-size: 15px;
}

/* Error State */
.lt-error {
    text-align: center;
    padding: 60px 20px !important;
    color: #e74c3c;
    background: #fff5f5;
    font-size: 15px;
}

.lt-lga-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media screen and (max-width: 768px) {
    /* Map */
    .location-tracker-map-container > div {
        height: 400px;
    }
    
    .lt-search-control input {
        width: 200px !important;
    }
    
    /* Table */
    .lt-table-header {
        padding: 15px 20px;
    }
    
    .lt-table-header h2 {
        font-size: 20px;
    }
    
    .lt-table-filters {
        grid-template-columns: 1fr;
    }
    
    .lt-table-container {
        overflow-x: scroll;
    }
    
    .lt-projects-table {
        min-width: 800px;
    }
    
    .lt-projects-table th,
    .lt-projects-table td {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .lt-table-pagination {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    #lt-table-page-info {
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    /* Map */
    .location-tracker-map-container > div {
        height: 350px;
    }
    
    .lt-search-control input {
        width: 180px !important;
        font-size: 13px;
    }
    
    /* Table */
    .lt-table-header h2 {
        font-size: 18px;
    }
    
    .lt-table-filters input,
    .lt-table-filters select {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* ====================================
   PRINT STYLES
   ==================================== */

@media print {
    .lt-table-filters,
    .lt-table-pagination,
    .lt-action-link,
    .leaflet-control-zoom,
    .leaflet-control-layers,
    .lt-reset,
    .lt-search-control {
        display: none !important;
    }
    
    .location-tracker-project-table-wrapper,
    .location-tracker-map-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .lt-projects-table th,
    .lt-projects-table td {
        padding: 8px 10px;
        font-size: 11px;
    }
}