/**
 * Planning Maps Plugin Styles
 * 
 * @package PlanningMaps
 * @since 1.0.0
 */

/* Map Container Styles */
.planning-map-container {
    position: relative;
    width: 100%;
    height: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #f9f9f9;
}

.planning-map-container.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Map Loading State */
.planning-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f9f9f9;
    color: #666;
    font-size: 16px;
}

.planning-map-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Map Error State */
.planning-map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #fcf0f1;
    color: #d63638;
    font-size: 16px;
    text-align: center;
    padding: 20px;
}

/* Map Controls */
.planning-map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.planning-map-control {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.planning-map-control:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.planning-map-control.active {
    background: #0073aa;
    color: white;
    border-color: #005a87;
}

/* Layer Control Panel */
.planning-layers-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 15px;
    max-width: 250px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    display: none;
}

.planning-layers-panel.active {
    display: block;
}

.planning-layers-panel h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.planning-layer-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.planning-layer-item input[type="checkbox"] {
    margin-right: 8px;
}

.planning-layer-item label {
    flex: 1;
    cursor: pointer;
    color: #23282d;
}

.planning-layer-color {
    width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 2px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Info Panel */
.planning-info-panel {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 15px;
    max-width: 300px;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    display: none;
}

.planning-info-panel.active {
    display: block;
}

.planning-info-panel h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
}

.planning-info-content {
    font-size: 13px;
    line-height: 1.4;
    color: #555;
}

.planning-info-content dt {
    font-weight: 600;
    margin-top: 8px;
    margin-bottom: 2px;
    color: #23282d;
}

.planning-info-content dd {
    margin: 0 0 5px 0;
}

/* Popup Styles */
.leaflet-popup-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 13px;
    line-height: 1.4;
}

.leaflet-popup-content h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
}

.leaflet-popup-content dl {
    margin: 0;
}

.leaflet-popup-content dt {
    font-weight: 600;
    margin-top: 5px;
    margin-bottom: 2px;
    color: #23282d;
}

.leaflet-popup-content dd {
    margin: 0 0 3px 0;
    color: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .planning-map-container {
        height: 300px;
    }

    .planning-map-controls {
        top: 5px;
        right: 5px;
    }

    .planning-layers-panel {
        top: 5px;
        left: 5px;
        max-width: 200px;
        max-height: 200px;
    }

    .planning-info-panel {
        bottom: 5px;
        left: 5px;
        max-width: 250px;
    }

    .planning-map-control {
        padding: 6px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .planning-map-container {
        height: 250px;
    }

    .planning-layers-panel {
        max-width: 180px;
        max-height: 150px;
        padding: 10px;
    }

    .planning-info-panel {
        max-width: 200px;
        padding: 10px;
    }
}

/* Print Styles */
@media print {

    .planning-map-controls,
    .planning-layers-panel,
    .planning-info-panel {
        display: none !important;
    }

    .planning-map-container {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .planning-map-container {
        border: 2px solid #000;
    }

    .planning-map-control {
        background: #fff;
        border: 2px solid #000;
        color: #000;
    }

    .planning-map-control:hover {
        background: #000;
        color: #fff;
    }

    .planning-layers-panel,
    .planning-info-panel {
        background: #fff;
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .planning-map-loading::before {
        animation: none;
    }

    .planning-map-control {
        transition: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .planning-map-container {
        background: #1e1e1e;
        border-color: #444;
    }

    .planning-map-loading {
        background: #1e1e1e;
        color: #ccc;
    }

    .planning-map-error {
        background: #2d1b1b;
        color: #ff6b6b;
    }

    .planning-map-control {
        background: rgba(30, 30, 30, 0.9);
        border-color: #555;
        color: #ccc;
    }

    .planning-map-control:hover {
        background: rgba(30, 30, 30, 1);
        color: #fff;
    }

    .planning-map-control.active {
        background: #0073aa;
        border-color: #005a87;
    }

    .planning-layers-panel,
    .planning-info-panel {
        background: rgba(30, 30, 30, 0.95);
        border-color: #555;
        color: #ccc;
    }

    .planning-layers-panel h4,
    .planning-info-panel h4 {
        color: #fff;
        border-bottom-color: #555;
    }

    .planning-layer-item label {
        color: #ccc;
    }

    .planning-info-content {
        color: #aaa;
    }

    .planning-info-content dt {
        color: #fff;
    }
}

/* Custom Leaflet Overrides */
.planning-map-container .leaflet-control-zoom {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.planning-map-container .leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #ccc;
    color: #333;
    font-weight: 600;
}

.planning-map-container .leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 1);
    color: #0073aa;
}

.planning-map-container .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8);
    font-size: 11px;
}

/* Utility Classes */
.planning-hidden {
    display: none !important;
}

.planning-visible {
    display: block !important;
}

.planning-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animation Classes */
.planning-fade-in {
    animation: planningFadeIn 0.3s ease-in-out;
}

.planning-fade-out {
    animation: planningFadeOut 0.3s ease-in-out;
}

@keyframes planningFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes planningFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Focus Styles for Accessibility */
.planning-map-control:focus,
.planning-layer-item input:focus,
.planning-layer-item label:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Loading Skeleton */
.planning-map-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: planningShimmer 1.5s infinite;
}

@keyframes planningShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Category Display Styles */
.planning-map-category {
    display: inline-block;
    background: #f0f0f0;
    color: #333;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 5px;
    border: 1px solid #ddd;
}

.planning-map-category.category-primary {
    background: #0073aa;
    color: #fff;
    border-color: #005a87;
}

.planning-map-category.category-secondary {
    background: #6c757d;
    color: #fff;
    border-color: #545b62;
}

.planning-map-category.category-success {
    background: #28a745;
    color: #fff;
    border-color: #1e7e34;
}

.planning-map-category.category-warning {
    background: #ffc107;
    color: #212529;
    border-color: #d39e00;
}

.planning-map-category.category-info {
    background: #17a2b8;
    color: #fff;
    border-color: #117a8b;
}

.planning-map-meta {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.planning-map-meta .meta-item {
    margin-right: 15px;
    display: inline-block;
}

.planning-map-meta .meta-label {
    font-weight: 600;
    margin-right: 5px;
}

/* Maps List Styles */
.planning-maps-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.planning-maps-list-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.planning-maps-list-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.planning-maps-list-item h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
}

.planning-maps-list-item .map-description {
    margin: 10px 0;
    color: #555;
    line-height: 1.5;
}

/* Dark mode for category styles */
@media (prefers-color-scheme: dark) {
    .planning-map-category {
        background: #444;
        color: #ccc;
        border-color: #666;
    }

    .planning-maps-list-item {
        background: #1e1e1e;
        border-color: #444;
        color: #ccc;
    }

    .planning-maps-list-item h3 {
        color: #fff;
    }

    .planning-map-meta {
        color: #aaa;
    }
}

/* Global Map Search Styles */
.planning-maps-search-container {
    position: relative;
    max-width: 600px;
    margin: 20px auto;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.planning-maps-search-container .search-input-wrapper {
    display: flex;
    position: relative;
    background: #fff;
    border-radius: 50px;
    padding: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.planning-maps-search-container .search-input-wrapper:focus-within {
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.15);
    border-color: #0073aa;
}

.planning-maps-search-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 10px 20px !important;
    font-size: 16px !important;
    color: #333;
    outline: none !important;
    box-shadow: none !important;
}

.planning-maps-search-submit {
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 10px 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.planning-maps-search-submit:hover {
    background: #005a87;
}

.search-loading {
    position: absolute;
    right: 120px;
    top: 50%;
    transform: translateY(-50%);
}

.planning-results-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
}

.planning-maps-search-results {
    padding: 10px 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
}

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

.search-result-item:hover {
    background: #f9f9f9;
}

.result-icon {
    font-size: 20px;
    margin-right: 15px;
    background: #eef7fd;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #0073aa;
}

.result-content {
    flex: 1;
}

.result-title {
    font-weight: 600;
    font-size: 15px;
    color: #23282d;
    margin-bottom: 2px;
}

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

.no-results-found {
    padding: 30px;
    text-align: center;
    color: #999;
}

/* Animations */
@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.planning-results-overlay {
    animation: fadeInSlideUp 0.3s ease-out;
}

/* Dark Mode for Search */
@media (prefers-color-scheme: dark) {
    .planning-maps-search-container .search-input-wrapper {
        background: #2a2a2a;
        border-color: #444;
    }

    .planning-maps-search-input {
        color: #eee;
    }

    .planning-results-overlay {
        background: #2a2a2a;
        border-color: #444;
    }

    .search-result-item {
        border-bottom-color: #3a3a3a;
    }

    .search-result-item:hover {
        background: #333;
    }

    .result-title {
        color: #eee;
    }

    .result-icon {
        background: #3a3a3a;
    }
}