/**
 * SWA Filter Styles
 */

/* Container Layouts */
.swa-filter-container {
    display: flex;
    gap: 30px;
    max-width: 100%;
    overflow: hidden;
}

.swa-filter-sidebar {
    flex-direction: row;
}

/* RTL Layout - Filter on Right Side for Arabic */
[dir="rtl"] .swa-filter-sidebar,
html[lang="ar"] .swa-filter-sidebar,
body.rtl .swa-filter-sidebar,
.rtl .swa-filter-sidebar {
    flex-direction: row-reverse;
}

/* Ensure form is on right side for Arabic - alternative approach */
.swa-filter-sidebar .swa-filter-form {
    order: 0;
}

[dir="rtl"] .swa-filter-sidebar .swa-filter-form,
html[lang="ar"] .swa-filter-sidebar .swa-filter-form,
body.rtl .swa-filter-sidebar .swa-filter-form,
.rtl .swa-filter-sidebar .swa-filter-form {
    order: 1;
}

[dir="rtl"] .swa-filter-sidebar .swa-results-container,
html[lang="ar"] .swa-filter-sidebar .swa-results-container,
body.rtl .swa-filter-sidebar .swa-results-container,
.rtl .swa-filter-sidebar .swa-results-container {
    order: 0;
}

.swa-filter-horizontal {
    flex-direction: column;
}

.swa-filter-sidebar .swa-filter-form {
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 10px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.swa-filter-sidebar .swa-filter-form::-webkit-scrollbar {
    width: 6px;
}

.swa-filter-sidebar .swa-filter-form::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.swa-filter-sidebar .swa-results-container {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.swa-filter-horizontal .swa-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.swa-filter-horizontal .swa-filter-section {
    flex: 1;
    min-width: 200px;
}

/* Filter Form */
.swa-filter-form {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.swa-filter-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #eee;
}

.swa-filter-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.swa-filter-section h4 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

/* Search Box */
.swa-search-box {
    position: relative;
}

.swa-search-box input {
    width: 100%;
    padding: 12px 45px 12px 16px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.swa-search-box input:focus {
    border-color: #16a085;
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.1);
}

.swa-search-box button {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #16a085;
    cursor: pointer;
    padding: 0;
}

/* RTL */
[dir="rtl"] .swa-search-box input {
    padding: 12px 16px 12px 45px;
}

[dir="rtl"] .swa-search-box button {
    left: auto;
    right: 12px;
}

/* Search Dropdown */
.swa-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.swa-search-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.swa-search-item:hover {
    background: #f8f9fa;
}

.swa-search-item:last-child {
    border-bottom: none;
}

.swa-search-title {
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.swa-search-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
}

.swa-search-price {
    color: #16a085;
    font-weight: 600;
}

.swa-search-empty {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* Filter Options */
.swa-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.swa-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.swa-filter-option:hover {
    background: #f8f9fa;
}

.swa-filter-option input {
    margin: 0;
}

.swa-filter-option .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #16a085;
}

.swa-flag {
    width: 24px;
    height: auto;
    border-radius: 2px;
}

.swa-option-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.swa-option-count {
    font-size: 12px;
    color: #999;
}

/* Price Range */
.swa-price-range {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.swa-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.swa-range-inputs input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.swa-range-inputs span {
    color: #999;
}

.swa-price-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.swa-price-presets button {
    padding: 6px 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.swa-price-presets button:hover {
    background: #16a085;
    color: #fff;
}

/* Filter Actions */
.swa-filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.swa-filter-actions .swa-btn {
    flex: 1;
}

/* Active Filters */
.swa-active-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.swa-active-label {
    font-weight: 600;
    color: #666;
}

.swa-filter-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.swa-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e8f5f1;
    color: #16a085;
    border-radius: 20px;
    font-size: 13px;
}

.swa-tag-remove {
    background: none;
    border: none;
    color: #16a085;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.swa-tag-remove:hover {
    opacity: 1;
}

/* Results Container */
.swa-results-container {
    flex: 1;
}

.swa-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.swa-results-count {
    font-size: 14px;
    color: #666;
}

/* Visa Grid */
.swa-visa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Visa Card */
.swa-visa-card {
    background: #fff;
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.swa-visa-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0;
}

.swa-visa-card__flag {
    padding: 0;
    margin: 0;
}

.swa-visa-card__flag img {
    display: block;
    padding: 0;
    margin: 0;
}

.swa-visa-card__content {
    padding: 24px;
}

.swa-visa-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.swa-visa-card.swa-featured {
    border: 2px solid #d18829;
}

.swa-featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #d18829;
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

[dir="rtl"] .swa-featured-badge {
    left: auto;
    right: 12px;
}

.swa-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.swa-card-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.swa-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e396c 0%, #2a4a7a 100%);
    color: #fff;
}

.swa-card-placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
}

.swa-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
}

.swa-country-flag {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.swa-card-country {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.swa-card-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    padding: 0 16px;
}

.swa-card-title a {
    color: #1a1a2e;
    text-decoration: none;
    transition: color 0.2s;
}

.swa-card-title a:hover {
    color: #16a085;
}

.swa-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding: 0 16px;
}

.swa-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.swa-meta-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #d18829;
}

.swa-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-top: 1px solid #eee;
}

.swa-card-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.swa-price-amount {
    font-size: 24px;
    font-weight: 700;
    color: #d18829;
}

.swa-price-currency {
    font-size: 14px;
    color: #666;
}

/* Buttons */
.swa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.swa-btn-primary {
    background: linear-gradient(135deg, #16a085, #1abc9c);
    color: #fff;
}

.swa-btn-primary:hover {
    background: linear-gradient(135deg, #138d75, #17a589);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 160, 133, 0.4);
}

/* Visa Card CTA Button Color */
.swa-visa-card .swa-btn-primary,
.swa-visa-card__action.swa-btn-primary,
.swa-card-footer .swa-btn-primary {
    background-color: #1e396c;
    background: #1e396c;
    border-color: #1e396c;
    color: #fff;
}

.swa-visa-card .swa-btn-primary:hover,
.swa-visa-card__action.swa-btn-primary:hover,
.swa-card-footer .swa-btn-primary:hover {
    background-color: #152a4f;
    background: #152a4f;
    border-color: #152a4f;
    color: #fff;
}



.swa-btn-outline:hover {
    background: var(--swa-primary);
    color: #fff;
}

.swa-btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* Loading */
.swa-loading {
    position: relative;
    min-height: 200px;
}

.swa-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
}

.swa-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #16a085;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No Results */
.swa-no-results {
    text-align: center;
    padding: 60px 20px;
}

.swa-no-results .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #ddd;
    margin-bottom: 16px;
}

.swa-no-results p {
    color: #666;
    margin-bottom: 20px;
}

/* Pagination */
.swa-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.swa-page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.swa-page-btn:hover {
    border-color: #d18829;
    color: #d18829;
}

.swa-page-btn.active {
    background: #d18829;
    border-color: #d18829;
    color: #fff;
}

/* Error */
.swa-error {
    text-align: center;
    padding: 40px;
    color: #e74c3c;
}

.swa-error .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
}

/* Quick Search */
.swa-quick-search {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.swa-quick-search form {
    display: flex;
    gap: 0;
}

.swa-quick-search input {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid #e5e5e5;
    border-right: none;
    border-radius: 12px 0 0 12px;
    font-size: 16px;
}

[dir="rtl"] .swa-quick-search input {
    border-right: 2px solid #e5e5e5;
    border-left: none;
    border-radius: 0 12px 12px 0;
}

.swa-quick-search button {
    padding: 16px 32px;
    background: #d18829;
    color: #fff;
    border: none;
    border-radius: 0 12px 12px 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

[dir="rtl"] .swa-quick-search button {
    border-radius: 12px 0 0 12px;
}

.swa-quick-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
}

/* Filter Options Styling */
.swa-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.swa-filter-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #444;
}

.swa-filter-options label:hover {
    background: #e8f4f8;
}

.swa-filter-options input[type="checkbox"],
.swa-filter-options input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #16a085;
    flex-shrink: 0;
}

.swa-filter-options input[type="checkbox"]:checked + span,
.swa-filter-options input[type="radio"]:checked + span {
    color: #16a085;
    font-weight: 500;
}

/* Country Options with Flags */
.swa-country-options label {
    justify-content: flex-start;
}

.swa-country-options .swa-country-flag {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Price Range */
.swa-price-range {
    padding: 8px 0;
}

.swa-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.swa-range-inputs input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    min-width: 0;
}

.swa-range-inputs input:focus {
    border-color: #16a085;
    outline: none;
}

.swa-range-inputs span {
    color: #999;
}

.swa-price-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.swa-price-presets button {
    padding: 6px 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.swa-price-presets button:hover,
.swa-price-presets button.active {
    background: #16a085;
    color: #fff;
}

/* Select Dropdown */
.swa-filter-section select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

[dir="ltr"] .swa-filter-section select {
    background-position: right 12px center;
    padding-left: 16px;
    padding-right: 36px;
}

.swa-filter-section select:focus {
    border-color: #16a085;
    outline: none;
}

/* Filter Actions */
.swa-filter-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid #eee;
}

.swa-filter-actions .swa-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
}

.swa-btn-primary {
    background: #d18829;
    color: #fff;
}

.swa-btn-primary:hover {
    background: #d18829;
    transform: translateY(-1px);
}

/* Visa Card CTA Button Color - Filter Actions Section */
.swa-visa-card .swa-btn-primary,
.swa-visa-card__action.swa-btn-primary,
.swa-card-footer .swa-btn-primary {
    background-color: #1e396c !important;
    background: #1e396c !important;
    border-color: #1e396c !important;
    color: #fff !important;
}

.swa-visa-card .swa-btn-primary:hover,
.swa-visa-card__action.swa-btn-primary:hover,
.swa-card-footer .swa-btn-primary:hover {
    background-color: #152a4f !important;
    background: #152a4f !important;
    border-color: #152a4f !important;
    color: #fff !important;
}

.swa-btn-outline {
    background: var(--swa-primary);
    color: var(--swa-white);
    border: 2px solid var(--swa-primary) !important;
}

.swa-btn-outline:hover {
    border-color: var(--swa-primary) !important;
    color: var(--swa-primary);
}

/* Active Filters */
.swa-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: right;
    justify-content: flex-end;
}

/* RTL Active Filters */
[dir="rtl"] .swa-active-filters,
section[dir="rtl"] .swa-active-filters,
html[lang="ar"] .swa-active-filters {
    flex-direction: row-reverse;
    text-align: right;
    justify-content: flex-start;
}

.swa-active-label {
    font-weight: 600;
    color: #333;
}

[dir="rtl"] .swa-active-label,
section[dir="rtl"] .swa-active-label,
html[lang="ar"] .swa-active-label {
    margin-left: 12px;
    margin-right: 0;
}

[dir="ltr"] .swa-active-label {
    margin-left: 0;
    margin-right: 12px;
}

.swa-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
}

[dir="rtl"] .swa-filter-tags,
section[dir="rtl"] .swa-filter-tags,
html[lang="ar"] .swa-filter-tags {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.swa-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #16a085;
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
}

.swa-filter-tag button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    opacity: 0.8;
}

.swa-filter-tag button:hover {
    opacity: 1;
}

/* Section-level RTL Support */
section[dir="rtl"] .swa-filter-sidebar,
.swa-filter-section[dir="rtl"] .swa-filter-sidebar {
    flex-direction: row-reverse;
}

section[dir="rtl"] .swa-filter-sidebar .swa-filter-form,
.swa-filter-section[dir="rtl"] .swa-filter-sidebar .swa-filter-form {
    order: 1;
}

section[dir="rtl"] .swa-filter-sidebar .swa-results-container,
.swa-filter-section[dir="rtl"] .swa-filter-sidebar .swa-results-container {
    order: 0;
}

/* Ensure text alignment is RTL in filter form */
section[dir="rtl"] .swa-filter-form,
.swa-filter-section[dir="rtl"] .swa-filter-form,
[dir="rtl"] .swa-filter-form {
    text-align: right;
}

section[dir="rtl"] .swa-filter-form h4,
.swa-filter-section[dir="rtl"] .swa-filter-form h4,
[dir="rtl"] .swa-filter-form h4 {
    text-align: right;
}

section[dir="rtl"] .swa-filter-option,
.swa-filter-section[dir="rtl"] .swa-filter-option,
[dir="rtl"] .swa-filter-option {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

section[dir="rtl"] .swa-range-inputs,
.swa-filter-section[dir="rtl"] .swa-range-inputs,
[dir="rtl"] .swa-range-inputs {
    flex-direction: row-reverse;
}

/* Responsive */
@media (max-width: 992px) {
    .swa-filter-sidebar {
        flex-direction: column !important;
    }

    .swa-filter-sidebar .swa-filter-form {
        width: 100%;
        min-width: 100%;
        position: static;
        max-height: none;
        margin-bottom: 24px;
    }

    .swa-visa-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 576px) {
    .swa-filter-form {
        padding: 16px;
    }

    .swa-filter-actions {
        flex-direction: column;
    }

    .swa-visa-grid {
        grid-template-columns: 1fr;
    }

    .swa-quick-search form {
        flex-direction: column;
    }

    .swa-quick-search input {
        border-right: 2px solid #e5e5e5;
        border-radius: 12px;
        margin-bottom: 10px;
    }

    .swa-quick-search button {
        border-radius: 12px;
        justify-content: center;
    }
}

