/**
 * Parish Crime Display Styles
 */

.parish-crime-container {
    max-width: 100%;
    margin: 1.5rem 0;
    font-family: inherit;
}

/* Filters */
.parish-crime-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.parish-crime-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.parish-crime-filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
}

.parish-crime-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    min-width: 150px;
}

.parish-crime-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.parish-crime-button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: #0073aa;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    align-self: flex-end;
}

.parish-crime-button:hover {
    background: #005a87;
}

.parish-crime-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.parish-crime-latest-data {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    align-self: flex-end;
    padding-bottom: 0.5rem;
}

.parish-crime-show-as {
    margin-left: 1rem;
    font-size: 0.9rem;
}

.parish-crime-view-toggle {
    color: #0073aa;
    text-decoration: none;
    padding: 0.1rem 0.3rem;
}

.parish-crime-view-toggle:hover {
    text-decoration: underline;
}

.parish-crime-view-toggle.active {
    font-weight: bold;
    color: #333;
}

/* Summary */
.parish-crime-summary {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #e7f3ff;
    border-left: 4px solid #0073aa;
    border-radius: 0 4px 4px 0;
}

.parish-crime-count {
    font-weight: 700;
    color: #0073aa;
}

/* Loading */
.parish-crime-loading {
    padding: 2rem;
    text-align: center;
    color: #666;
}

.parish-crime-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: parish-crime-spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes parish-crime-spin {
    to { transform: rotate(360deg); }
}

/* Table */
.parish-crime-table-wrapper {
    overflow-x: auto;
}

.parish-crime-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.parish-crime-table th,
.parish-crime-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.parish-crime-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.parish-crime-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.parish-crime-table th.sortable:hover {
    background: #e9ecef;
}

.parish-crime-table th.sortable::after {
    content: ' \2195';
    opacity: 0.3;
}

.parish-crime-table th.sort-asc::after {
    content: ' \2191';
    opacity: 1;
}

.parish-crime-table th.sort-desc::after {
    content: ' \2193';
    opacity: 1;
}

.parish-crime-table tbody tr:hover {
    background: #f8f9fa;
}

.parish-crime-table tbody tr:last-child td {
    border-bottom: none;
}

/* Category badges */
.parish-crime-category {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 3px;
    background: #e9ecef;
    color: #495057;
}

.parish-crime-category-burglary {
    background: #f8d7da;
    color: #721c24;
}

.parish-crime-category-vehicle-crime {
    background: #fff3cd;
    color: #856404;
}

.parish-crime-category-anti-social-behaviour {
    background: #d4edda;
    color: #155724;
}

.parish-crime-category-violent-crime {
    background: #f5c6cb;
    color: #721c24;
}

.parish-crime-category-criminal-damage-arson {
    background: #ffeeba;
    color: #856404;
}

.parish-crime-category-other-theft {
    background: #bee5eb;
    color: #0c5460;
}

.parish-crime-category-public-order {
    background: #d6d8db;
    color: #383d41;
}

/* No results */
.parish-crime-no-results {
    padding: 2rem;
    text-align: center;
    color: #666;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Error */
.parish-crime-error {
    padding: 1rem;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Footer */
.parish-crime-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.parish-crime-attribution {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0;
}

.parish-crime-attribution a {
    color: #0073aa;
}

/* Map containers */
.parish-crime-area-container,
.parish-crime-map-container {
    max-width: 100%;
    margin: 1.5rem 0;
    font-family: inherit;
}

.parish-crime-area-header {
    margin-bottom: 1rem;
}

.parish-crime-area-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: #333;
}

.parish-crime-area-description {
    margin: 0;
    font-size: 0.875rem;
    color: #666;
}

.parish-crime-map {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    z-index: 1;
}

.parish-crime-map-loading {
    padding: 1rem;
    text-align: center;
    color: #666;
}

.parish-crime-map-legend {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #666;
}

.parish-crime-legend-title {
    font-style: italic;
}

/* Cluster markers for multiple crimes */
.parish-crime-cluster {
    background: transparent;
    border: none;
}

.parish-crime-cluster div {
    background: #dc3545;
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.15s;
}

.parish-crime-cluster div:hover {
    transform: scale(1.1);
}

/* Map popups */
.parish-crime-popup {
    min-width: 180px;
    font-size: 0.875rem;
    line-height: 1.4;
}

.parish-crime-popup-count {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #dc3545;
}

.parish-crime-popup hr {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid #eee;
}

.parish-crime-popup-category {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: #333;
}

.parish-crime-popup-location {
    margin: 0.25rem 0;
    color: #666;
    font-style: italic;
}

.parish-crime-popup-item {
    margin: 0.25rem 0;
    color: #333;
}

.parish-crime-popup-item strong {
    color: #666;
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    border-radius: 6px;
}

.leaflet-popup-content {
    margin: 12px 14px;
}

/* Map Key */
.parish-crime-map-key {
    margin: 1.5rem 0;
}

.parish-crime-key-table {
    width: 100%;
    max-width: 400px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.parish-crime-key-table th,
.parish-crime-key-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.parish-crime-key-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.parish-crime-key-table tbody tr:hover {
    background: #f8f9fa;
}

.parish-crime-key-color {
    display: inline-block;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    vertical-align: middle;
}

.parish-crime-key-multiple {
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .parish-crime-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .parish-crime-filter-group {
        width: 100%;
    }

    .parish-crime-select {
        width: 100%;
    }

    .parish-crime-button {
        width: 100%;
    }

    .parish-crime-table thead {
        display: none;
    }

    .parish-crime-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 4px;
    }

    .parish-crime-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid #eee;
    }

    .parish-crime-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
    }

    .parish-crime-table tbody td:last-child {
        border-bottom: none;
    }
}
