/**
 * Enhanced Location List Styles
 * Version: 1.0.0
 * Date: 2025-12-16
 * 
 * Features:
 * - Search/filter box
 * - Sticky A-Z navigation
 * - Alphabetical grouping with letter headers
 * - Multi-column layout (responsive)
 * - Enhanced link styling
 * - Mobile optimization
 */

/* ===========================
   Search Box Styling
   =========================== */

.location-list-controls {
    margin: 30px 0 20px;
}

.location-search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.location-search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    font-size: 16px;
    line-height: 1.5;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-family: inherit;
}

.location-search-input:focus {
    border-color: #0073aa;
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.1);
}

.location-search-input::placeholder {
    color: #999;
}

.clear-search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #999;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.clear-search-btn:hover {
    background: #666;
    transform: translateY(-50%) scale(1.1);
}

/* ===========================
   A-Z Navigation Styling
   =========================== */

.az-navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 20px 15px;
    margin: 20px 0;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 100;
    transition: all 0.3s ease;
}

.az-navigation-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.az-letter {
    min-width: 36px;
    height: 36px;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.az-letter-active {
    border-color: #0073aa;
    color: #0073aa;
}

.az-letter-active:hover {
    background: #0073aa;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.az-letter-inactive {
    border-color: #e5e5e5;
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.az-letter-clicked {
    background: #0073aa;
    color: white;
    transform: scale(0.95);
}

/* ===========================
   Location List Container
   =========================== */

.location-list-article {
    margin: 30px 0;
}

.location-list-container {
    margin-top: 20px;
}

/* ===========================
   Letter Section Headers
   =========================== */

.letter-section {
    margin-bottom: 40px;
}

.letter-header {
    font-size: 32px;
    font-weight: 700;
    color: #0073aa;
    margin: 0 0 20px 0;
    padding: 10px 0 10px 15px;
    border-left: 5px solid #0073aa;
    background: linear-gradient(to right, rgba(0, 115, 170, 0.05), transparent);
    scroll-margin-top: 100px; /* Offset for sticky navigation */
}

/* ===========================
   Location List (Multi-Column)
   =========================== */

.location-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px 20px;
}

.location-item {
    margin: 0;
    padding: 0;
    display: block; /* Override default list-item display for proper grid layout */
}

.location-link {
    display: block;
    padding: 12px 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #0073aa;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
}

.location-link:hover {
    background: #f0f7fa;
    border-color: #0073aa;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.15);
}

.location-link:active {
    transform: translateX(3px) scale(0.98);
}

/* ===========================
   No Results Message
   =========================== */

.no-results-message {
    text-align: center;
    padding: 40px 20px;
    background: #fff9e6;
    border: 2px solid #ffcc00;
    border-radius: 8px;
    margin: 20px 0;
}

.no-results-message p {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* ===========================
   Screen Reader Only (Accessibility)
   =========================== */

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

/* ===========================
   Responsive Design
   =========================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .location-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 10px 15px;
    }
    
    .letter-header {
        font-size: 28px;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
    /* Search Box */
    .location-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 45px 12px 15px;
    }
    
    .clear-search-btn {
        width: 24px;
        height: 24px;
        font-size: 16px;
        right: 12px;
    }
    
    /* A-Z Navigation */
    .az-navigation {
        padding: 15px 10px;
        gap: 6px;
    }
    
    .az-letter {
        min-width: 32px;
        height: 32px;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    /* Single Column on Mobile */
    .location-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .letter-header {
        font-size: 24px;
        padding: 8px 0 8px 12px;
        margin-bottom: 15px;
    }
    
    .location-link {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .location-link:hover {
        transform: translateX(3px);
    }
    
    /* Sticky Navigation Adjustments */
    .az-navigation-sticky {
        padding: 12px 10px;
    }
    
    .letter-header {
        scroll-margin-top: 80px; /* Smaller offset for mobile */
    }
}

/* Extra Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .location-list-controls {
        margin: 20px 0 15px;
    }
    
    .az-navigation {
        gap: 4px;
    }
    
    .az-letter {
        min-width: 28px;
        height: 28px;
        padding: 4px 6px;
        font-size: 12px;
    }
    
    .letter-header {
        font-size: 20px;
    }
    
    .location-link {
        font-size: 13px;
        padding: 8px 10px;
    }
}

/* ===========================
   Print Styles
   =========================== */

@media print {
    .location-list-controls,
    .az-navigation,
    .no-results-message {
        display: none;
    }
    
    .location-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .location-link {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .letter-section {
        page-break-inside: avoid;
    }
}

/* ===========================
   Dark Mode Support (Optional)
   =========================== */

@media (prefers-color-scheme: dark) {
    .location-search-input {
        background: #efefef;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .location-search-input:focus {
        border-color: #4a9eff;
    }
    
    .az-navigation {
        background: #efefef;
    }
    
    .az-letter {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .az-letter-active {
        border-color: #4a9eff;
        color: #4a9eff;
    }
    
    .az-letter-active:hover {
        background: #4a9eff;
        color: white;
    }
    
    .location-link {
        background: #efefef;
        color: #4a9eff;
        border-color: #444;
    }
    
    .location-link:hover {
        background: #1a3a4a;
        border-color: #4a9eff;
    }
    
    .letter-header {
        color: #4a9eff;
        background: linear-gradient(to right, rgba(74, 158, 255, 0.1), transparent);
        border-left-color: #4a9eff;
    }
}

/* ===========================
   Animation Classes
   =========================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.location-item {
    animation: fadeIn 0.3s ease forwards;
}

/* Stagger animation for letter sections */
.letter-section:nth-child(1) { animation-delay: 0s; }
.letter-section:nth-child(2) { animation-delay: 0.05s; }
.letter-section:nth-child(3) { animation-delay: 0.1s; }
.letter-section:nth-child(4) { animation-delay: 0.15s; }
.letter-section:nth-child(5) { animation-delay: 0.2s; }

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .location-link {
        border-width: 2px;
    }
    
    .az-letter {
        border-width: 3px;
    }
}

/* 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;
    }
}

/* ===========================
   Location Overview Page Styles
   =========================== */

.location-overview-section {
    margin-top: 20px;
}

.overview-letter-section {
    margin-bottom: 40px;
}

.overview-location-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px 15px;
}

.overview-location-list .location-item {
    margin: 0;
    padding: 0;
    display: block;
}

/* Override button styles for overview page to match enhancement styling */
.overview-location-list .location-link.locationb {
    display: block;
    padding: 12px 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #0073aa !important;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
    text-align: left;
}

.overview-location-list .location-link.locationb:hover {
    background: #f0f7fa !important;
    border-color: #0073aa !important;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.15);
}

.overview-location-list .location-link.locationb:active {
    transform: translateX(3px) scale(0.98);
}

/* Responsive adjustments for overview page */
@media (max-width: 1024px) {
    .overview-location-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 767px) {
    .overview-location-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .overview-location-list {
        gap: 8px;
    }
    
    .overview-location-list .location-link.locationb {
        font-size: 14px;
        padding: 10px 12px;
    }
}
