/* Component styles */

/* Parcel type toggle */
.parcel-toggle {
    display: inline-flex;
    background: rgba(243, 244, 246, 0.5); /* 50% opacity gray-100 */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    padding: 3px;
    flex-shrink: 0;
    height: 36px; /* Reduced from 44px */
    pointer-events: auto;
    position: relative;
    z-index: 10;
    width: fit-content;
}

@media (max-width: 767px) {
    .parcel-toggle {
        height: 32px;
        padding: 2px;
    }
}

.parcel-toggle-option {
    padding: 4px 12px; /* Reduced from var(--spacing-sm) var(--spacing-lg) */
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    background: rgba(255, 255, 255, 0.3); /* Semi-transparent background for non-selected */
    border: none;
    font-size: 13px; /* Reduced from 14px */
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

@media (max-width: 767px) {
    .parcel-toggle-option {
        padding: 3px 10px;
        font-size: 12px;
    }
}

.parcel-toggle-option:hover:not(.disabled) {
    background: rgba(34, 119, 181, 0.2);
}

.parcel-toggle-option.active {
    background: var(--primary-color); /* Full opacity for selected tab */
    color: white;
    box-shadow: var(--shadow-sm);
}

.parcel-toggle-option.disabled {
    color: var(--gray-400);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Search box */
.search-container {
    display: flex;
    background-color: rgba(255, 255, 255, 0.5) !important; /* 50% opacity by default */
    background: rgba(255, 255, 255, 0.5) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    flex: 1 1 auto;
    height: 36px; /* Reduced from 44px */
    min-width: 150px; /* Reduced from 200px */
    max-width: 100%;
    pointer-events: auto;
    position: relative;
    z-index: 10;
    transition: background-color var(--transition-fast), background var(--transition-fast);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Full opacity when focused/active */
.search-container:focus-within,
.search-container.active {
    background-color: rgba(255, 255, 255, 1) !important;
    background: rgba(255, 255, 255, 1) !important;
}

@media (max-width: 767px) {
    .search-container {
        height: 32px;
        min-width: 120px;
    }
}

.search-input {
    flex: 1;
    padding: 6px 12px; /* Reduced from var(--spacing-sm) var(--spacing-lg) */
    border: none;
    font-size: 13px; /* Reduced from 14px */
    outline: none;
    min-width: 80px; /* Reduced from 100px */
    pointer-events: auto;
    background: transparent; /* Make input transparent to show container background */
}

@media (max-width: 767px) {
    .search-input {
        padding: 4px 8px;
        font-size: 12px;
        min-width: 60px;
    }
}

.search-button {
    padding: 6px 12px; /* Reduced from var(--spacing-sm) var(--spacing-lg) */
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background-color var(--transition-fast);
    flex-shrink: 0;
    pointer-events: auto;
}

.search-button:hover {
    background: var(--primary-hover);
}

/* Mobile search button */
@media (max-width: 767px) {
    .search-container {
        flex: 1;
    }
    
    .search-button {
        width: 32px; /* Reduced from 44px */
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
    }
    
    .search-button-text {
        display: none;
    }
    
    .search-button::before {
        content: "🔍";
        font-size: 14px; /* Reduced from 18px */
    }
}

/* Legend checkboxes */
.legend-item {
    display: flex;
    align-items: center;
    padding: 4px 0; /* Reduced from var(--spacing-sm) 0 */
    cursor: pointer;
    gap: 6px; /* Reduced from var(--spacing-sm) */
    pointer-events: auto;
}

@media (max-width: 767px) {
    .legend-item {
        padding: 3px 0;
        gap: 4px;
    }
}

.legend-item:hover .legend-color {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(34, 119, 181, 0.2);
}

.legend-checkbox {
    display: none; /* Hide the checkbox, we'll use the color circle instead */
}

.legend-color {
    width: 16px; /* Slightly larger for better clicking */
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--gray-300);
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

/* Gray out when unchecked */
.legend-item.unchecked .legend-color {
    background-color: var(--gray-400) !important;
    opacity: 0.5;
}

.legend-item.unchecked .legend-label {
    color: var(--gray-500);
    text-decoration: line-through;
}

.legend-label {
    flex: 1;
    font-size: 13px; /* Reduced from 14px */
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px; /* Reduced from var(--spacing-sm) */
}

@media (max-width: 767px) {
    .legend-label {
        font-size: 12px;
    }
}

.legend-count {
    font-size: 11px; /* Reduced from 12px */
    color: var(--gray-500);
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .legend-count {
        font-size: 10px;
    }
}

/* Map markers */
.map-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.map-marker:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: var(--z-loading);
    gap: var(--spacing-lg);
}

.spinner {
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 14px;
    color: var(--gray-600);
}

/* Filter items */
.filter-group {
    margin-bottom: 12px; /* Reduced from var(--spacing-xl) */
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

@media (max-width: 767px) {
    .filter-group {
        margin-bottom: 8px;
    }
}

.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    gap: 8px;
}

.filter-group-header:hover {
    background: var(--gray-100);
}

/* Style the toggle button */
.filter-group-header .group-toggle {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.filter-group-header .group-toggle:hover {
    color: var(--gray-700);
}

@media (max-width: 767px) {
    .filter-group-header {
        padding: 4px 8px;
    }
}

.filter-group-header h5 {
    margin: 0;
    font-size: 13px; /* Reduced from 14px */
    font-weight: 600;
    color: var(--gray-700);
    flex: 1;
}

@media (max-width: 767px) {
    .filter-group-header h5 {
        font-size: 12px;
    }
}

.filter-group-content {
    padding: 10px; /* Reduced from var(--spacing-md) */
}

@media (max-width: 767px) {
    .filter-group-content {
        padding: 6px;
    }
}

/* Use a different class name to avoid conflicts with panel collapse */
.filter-group-content.filter-collapsed {
    display: none;
}

.filter-item {
    margin-bottom: 8px; /* Reduced from var(--spacing-md) */
}

@media (max-width: 767px) {
    .filter-item {
        margin-bottom: 6px;
    }
}

.filter-item label {
    display: block;
    font-size: 12px; /* Reduced from 13px */
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}

@media (max-width: 767px) {
    .filter-item label {
        font-size: 11px;
    }
}

/* Form inputs */
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 13px;
    transition: all var(--transition-fast);
    background: white;
    color: var(--gray-700);
}

@media (max-width: 767px) {
    .form-input {
        padding: 6px 10px;
        font-size: 12px;
    }
}

.form-input:hover {
    border-color: var(--gray-300);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 119, 181, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
    cursor: pointer;
}

.form-select:hover {
    border-color: var(--primary-color);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 119, 181, 0.1);
}

/* Buttons */
.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-block {
    width: 100%;
}