/* Country Selection Enhancements */

/* Archive pages with sidebar layout */
.template-parts-agencies-archive .post-sidebar,
.template-parts-escort-post-archive .post-sidebar {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.template-parts-agencies-archive .sidebar-wrapper,
.template-parts-escort-post-archive .sidebar-wrapper {
    position: sticky;
    top: 100px;
}

@media (max-width: 768px) {
    .template-parts-agencies-archive .post-sidebar,
    .template-parts-escort-post-archive .post-sidebar {
        order: 2;
        margin-top: 30px;
    }
    
    .template-parts-agencies-archive .large-9,
    .template-parts-escort-post-archive .large-9 {
        order: 1;
    }
}

/* Country Overview Styling */
.country-overview-container {
    padding: 40px 20px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.country-search-container {
    text-align: center;
    margin-bottom: 50px;
}

.search-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 500px;
}

#country-city-search {
    width: 100%;
    padding: 18px 25px;
    font-size: 18px;
    border: 3px solid #ddd;
    border-radius: 30px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background: white;
}

#country-city-search:focus {
    border-color: #007cba;
    box-shadow: 0 6px 20px rgba(0,123,186,0.2);
    transform: translateY(-2px);
}

#country-city-search::placeholder {
    color: #999;
    font-style: italic;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ddd;
    border-top: none;
    border-radius: 0 0 15px 15px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.search-result-item {
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.search-result-item:hover {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateX(5px);
}

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

.search-result-flag {
    margin-right: 15px;
    flex-shrink: 0;
}

.search-result-flag img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 600;
    color: #333;
    font-size: 16px;
    margin-bottom: 2px;
}

.search-result-parent {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Countries Grid */
.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 30px;
    padding-left:30px;
    padding-right:30px;
}

.country-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.country-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-color: #007cba;
}

.country-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 25px 20px;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.country-flag {
    margin-bottom: 20px;
}

.country-flag-image {
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.country-item:hover .country-flag-image {
    transform: scale(1.1);
}

.country-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #333;
    transition: color 0.3s ease;
}

.country-item:hover .country-name {
    color: #007cba;
}

.country-count {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

/* Enhanced Sidebar Styling */
.country-filter-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.selected-country-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selected-country-flag img {
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.selected-country-name {
    font-weight: 700;
    color: white;
    font-size: 16px;
}

.change-country-button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.change-country-button:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.change-country-button i {
    margin-right: 6px;
}

/* Enhanced Category Accordion */
.enhanced_country_filter .wpb_category_n_menu_accordion_list {
    margin-top: 0;
}

.enhanced_country_filter .wpb_category_n_menu_accordion_list li {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.enhanced_country_filter .wpb_category_n_menu_accordion_list li:hover {
    background-color: #f8f9fa;
}

.enhanced_country_filter .wpb_category_n_menu_accordion_list li a {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: color 0.2s ease;
}

.enhanced_country_filter .wpb_category_n_menu_accordion_list li a:hover {
    color: #007cba;
}

.enhanced_country_filter .ER_category_image {
    margin-right: 10px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .country-overview-container {
        padding: 30px 15px;
        margin: 0 -15px 20px -15px;
        border-radius: 0;
    }
    
    .countries-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .country-link {
        padding: 20px 15px;
    }
    
    .country-flag-image {
        width: 30px !important;
        height: 30px !important;
    }
    
    .country-name {
        font-size: 16px;
    }
    
    .country-count {
        font-size: 13px;
    }
    
    .country-filter-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    .selected-country-info {
        justify-content: center;
    }
    
    #country-city-search {
        font-size: 16px;
        padding: 15px 20px;
    }
    
    .search-result-item {
        padding: 12px 20px;
    }
    
    .search-result-flag img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .countries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .country-name {
        font-size: 14px;
    }
    
    .country-count {
        font-size: 12px;
    }
    
    .search-wrapper {
        max-width: 100%;
    }
}

/* Loading States */
.search-results-dropdown.loading {
    background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"%3E%3Cpath fill="%23999" d="M10 1v2a7 7 0 11-7 7H1a9 9 0 109-9z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px;
    min-height: 50px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.country-item {
    animation: fadeInUp 0.6s ease forwards;
}

.country-item:nth-child(2) { animation-delay: 0.1s; }
.country-item:nth-child(3) { animation-delay: 0.2s; }
.country-item:nth-child(4) { animation-delay: 0.3s; }
.country-item:nth-child(5) { animation-delay: 0.4s; }
.country-item:nth-child(6) { animation-delay: 0.5s; }

/* Focus styles for accessibility */
.country-link:focus,
.change-country-button:focus,
#country-city-search:focus {
    outline: 3px solid #005a87;
    outline-offset: 2px;
}

.search-result-item:focus {
    background-color: #007cba;
    color: white;
    outline: none;
}
