/**
 * Country Filter Styles
 * Styling for the country filter dropdown on planners and suppliers archives
 */

.country-filter-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e9ecef;
    padding: 25px 0;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.country-filter-container:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    /*background: linear-gradient(90deg, #50697B 0%, #8195A4 50%, #50697B 100%);*/
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: -200% 0; }
}

.country-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.country-filter-label {
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    white-space: nowrap;
    font-size: 16px;
}

.country-filter-select {
    min-width: 250px;
    max-width: 400px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    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='%2350697B' stroke-width='2.5' 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 14px center;
    background-size: 20px;
    padding-right: 45px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.country-filter-select:focus {
    outline: none;
    border-color: #50697B;
    box-shadow: 0 2px 8px rgba(80, 105, 123, 0.15), 0 0 0 3px rgba(80, 105, 123, 0.1);
    transform: translateY(-1px);
}

.country-filter-select:hover {
    border-color: #50697B;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Enhanced dropdown options styling */
.country-filter-select optgroup {
    font-weight: 700;
    color: #2c3e50;
    font-style: normal;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 8px 12px;
    margin: 4px 0;
    border-bottom: 1px solid #dee2e6;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.country-filter-select option {
    font-weight: 400;
    color: #495057;
    padding: 10px 16px;
    background: #fff;
    border: none;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.country-filter-select option:hover {
    background: linear-gradient(135deg, #50697B 0%, #8195A4 100%);
    color: #EFF5FA;
}

.country-filter-select option:checked,
.country-filter-select option:focus {
    background: linear-gradient(135deg, #50697B 0%, #8195A4 100%);
    color: #EFF5FA;
    font-weight: 500;
}

/* Style for option groups in different browsers */
.country-filter-select optgroup option {
    padding-left: 24px;
    font-size: 15px;
    position: relative;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.country-filter-select optgroup option:before {
    content: "📍";
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.7;
}

.country-filter-select optgroup option:hover,
.country-filter-select optgroup option:focus {
    border-left-color: #50697B;
    padding-left: 28px;
}

.country-filter-select optgroup option:hover:before,
.country-filter-select optgroup option:focus:before,
.country-filter-select optgroup option:checked:before {
    opacity: 1;
}

/* Add subtle count styling */
.country-filter-select option {
    position: relative;
}

/* Style the "All Countries" option differently */
.country-filter-select option[value="all"] {
    font-weight: 600;
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding: 12px 16px;
}

.country-filter-select option[value="all"]:hover,
.country-filter-select option[value="all"]:focus {
    background: linear-gradient(135deg, #50697B 0%, #8195A4 100%);
    color: #EFF5FA;
}

.country-filter-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Loading state for grid */
.venue-grid.loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
    position: relative;
}

.venue-grid.loading:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    z-index: 10;
}

/* Enhanced loading spinner */
.country-filter-loading {
    background: rgba(80, 105, 123, 0.1);
    border: 1px solid rgba(80, 105, 123, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Error message styling */
.country-filter-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    margin: 20px 0;
}

.country-filter-error p {
    margin: 0;
}

/* Enhanced dropdown animation */
.country-filter-select:focus {
    animation: dropdownFocus 0.3s ease-out;
}

@keyframes dropdownFocus {
    0% {
        transform: translateY(-1px) scale(0.98);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: translateY(-1px) scale(1);
        box-shadow: 0 2px 8px rgba(80, 105, 123, 0.15), 0 0 0 3px rgba(80, 105, 123, 0.1);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .country-filter-container {
        padding: 20px 0;
        margin-bottom: 25px;
    }

    .country-filter-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .country-filter-label {
        text-align: center;
        font-size: 15px;
    }

    .country-filter-select {
        min-width: 100%;
        max-width: 100%;
        padding: 14px 16px;
        padding-right: 45px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .country-filter-container {
        padding: 15px 0;
        margin-bottom: 20px;
    }

    .country-filter-select {
        font-size: 14px;
        padding: 8px 12px;
        padding-right: 35px;
        background-size: 14px;
        background-position: right 10px center;
    }

    .country-filter-label {
        font-size: 14px;
    }
}

/* Integration with existing theme styles */
.country-filter-container .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .country-filter-container {
        background: #2c3e50;
        border-bottom-color: #34495e;
    }

    .country-filter-label {
        color: #ecf0f1;
    }

    .country-filter-select {
        background: #34495e;
        color: #ecf0f1;
        border-color: #4a5f7a;
    }

    .country-filter-select:focus {
        border-color: #8195A4;
        box-shadow: 0 0 0 2px rgba(129, 149, 164, 0.2);
    }

    .country-filter-select optgroup {
        color: #bdc3c7;
    }

    .country-filter-select option {
        color: #ecf0f1;
        background: #34495e;
    }
}

/* Accessibility improvements */
.country-filter-select:focus-visible {
    outline: 2px solid #50697B;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .country-filter-select {
        border-width: 3px;
    }

    .country-filter-select:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px #fff, 0 0 0 6px #000;
    }
}
