/* Custom styles for Lancaster Shops Directory - SEO Optimized */

/* Performance optimizations */
html {
    scroll-behavior: smooth;
}

/* Ensure consistent spacing and typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* Accessibility improvements */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Skip to main content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--bs-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 9999;
}

.skip-link:focus {
    top: 6px;
}

/* Header styling */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Card enhancements */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Table enhancements */
.table td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
}

.description-cell {
    max-width: 300px;
    word-wrap: break-word;
}

/* Badge styling */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
}

.badge i {
    font-size: 0.7rem;
}

/* Search input enhancements */
.input-group .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Filter section styling */
.form-check-label {
    font-weight: 500;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Phone number links */
a[href^="tel:"] {
    color: var(--bs-success) !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

a[href^="tel:"]:hover {
    color: var(--bs-success) !important;
    text-decoration: underline;
}

/* Results count styling */
#resultsCount {
    font-weight: 500;
    font-size: 0.9rem;
}

/* No results message */
#noResults {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Responsive table improvements */
@media (max-width: 991.98px) {
    .table-responsive {
        border: none;
    }
    
    /* Hide table on mobile, show cards */
    .d-none.d-lg-block {
        display: none !important;
    }
}

/* Mobile card improvements */
.shop-card {
    border-left: 4px solid var(--bs-primary);
}

.shop-card .card-header {
    background-color: rgba(13, 110, 253, 0.1);
    border-bottom: 1px solid rgba(13, 110, 253, 0.2);
}

/* Filter controls mobile optimization */
@media (max-width: 575.98px) {
    .form-check {
        margin-bottom: 0.75rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    #resetFilters {
        margin-top: 1rem;
    }
}

/* Loading and transition effects */
.shop-row, .shop-card {
    transition: all 0.3s ease;
}

.shop-row:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Enhanced focus states for accessibility */
.form-check-input:focus,
.btn:focus,
.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* Print styles */
@media print {
    .navbar,
    .card-header,
    #noResults,
    .btn {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .table {
        border: 1px solid #000;
    }
    
    .table th,
    .table td {
        border: 1px solid #000;
        padding: 0.5rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--bs-border-color);
    }
    
    .badge {
        border: 1px solid currentColor;
    }
}

/* Filter Panel Enhancements */
#filterPanel {
    transition: all 0.3s ease;
    transform-origin: top;
}

#filterPanel[style*="display: none"] {
    opacity: 0;
    transform: scaleY(0.95);
}

#filterPanel[style*="display: block"] {
    opacity: 1;
    transform: scaleY(1);
}

#toggleFilters {
    transition: all 0.2s ease;
    position: relative;
}

#toggleFilters.active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#toggleFilters .badge {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Filter Category Headers */
#filterPanel .h6 {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

/* Enhanced Filter Checkboxes */
#filterPanel .form-check {
    padding-left: 0;
    margin-bottom: 0.5rem;
}

#filterPanel .form-check-input {
    margin-right: 0.75rem;
    transform: scale(1.1);
}

#filterPanel .form-check-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    transition: color 0.2s ease;
}

#filterPanel .form-check-label:hover {
    color: var(--bs-primary);
}

#filterPanel .form-check-input:checked + .form-check-label {
    color: var(--bs-primary);
    font-weight: 600;
}

/* Results Badge Animation */
#resultsCount {
    transition: all 0.3s ease;
    min-width: 80px;
    justify-content: center;
}

/* Search Bar Enhancements */
.input-group .form-control {
    border-right: none;
}

.input-group .input-group-text {
    border-right: none;
    background-color: transparent;
}

.input-group .btn-outline-secondary {
    border-left: none;
    background-color: transparent;
}

/* Mobile Filter Optimizations */
@media (max-width: 991.98px) {
    #toggleFilters {
        width: auto;
        flex-shrink: 0;
    }
    
    #resultsCount {
        font-size: 0.8rem;
        min-width: 60px;
    }
    
    .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
}

@media (max-width: 575.98px) {
    #filterPanel .col-lg-3 {
        margin-bottom: 1.5rem;
    }
    
    #toggleFilters .badge {
        display: none;
    }
    
    #toggleFilters {
        font-size: 0.875rem;
    }
}

/* Smooth Filter State Transitions */
.shop-row[style*="display: none"],
.shop-card[style*="display: none"] {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.shop-row:not([style*="display: none"]),
.shop-card:not([style*="display: none"]) {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.2s ease;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    #filterPanel,
    #toggleFilters,
    .shop-row,
    .shop-card {
        transition: none !important;
        animation: none !important;
    }
}
