/* ========================================
   MOBILE APP-STYLE SEARCH MODALS
   ======================================== */

/* === MODAL BASE STYLING === */
.search-modal-content {
    border-radius: 20px;
    border: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

/* Modal Header */
.search-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.btn-modal-back,
.btn-modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-modal-back:hover,
.btn-modal-close:hover {
    background: #e5e7eb;
    color: #1a1a1a;
    transform: scale(1.05);
}

.search-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    flex: 1;
}

/* === PROGRESS INDICATOR === */
.search-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
    transition: all 0.4s ease;
    opacity: 1;
}

.progress-step[style*="display: none"] {
    opacity: 0;
    transform: scale(0.8);
}

.progress-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 2;
}

.progress-step.active .progress-circle {
    background: linear-gradient(135deg, #58cfef 0%, #4db8d8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(88, 207, 239, 0.4);
}

.progress-step.completed .progress-circle {
    background: #10b981;
    color: #ffffff;
}

.progress-step span {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.progress-step.active span {
    color: #58cfef;
    font-weight: 700;
}

.progress-line {
    height: 2px;
    background: #e5e7eb;
    flex: 1;
    margin: 0 8px;
    align-self: flex-start;
    margin-top: 17px;
    transition: all 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.progress-line[style*="display: none"] {
    opacity: 0;
}

.progress-step.completed ~ .progress-line {
    background: #10b981;
}

/* === MODAL BODY === */
.search-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.search-step {
    display: none;
}

.search-step.active {
    display: block;
}

.step-subtitle {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 20px;
    text-align: center;
}

/* === SEARCH BOX === */
.modal-search-box {
    position: relative;
    margin-bottom: 20px;
}

.modal-search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 16px;
}

[dir="rtl"] .modal-search-box i {
    left: auto;
    right: 16px;
}

.modal-search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #ffffff;
}

[dir="rtl"] .modal-search-input {
    padding: 14px 48px 14px 16px;
}

.modal-search-input:focus {
    outline: none;
    border-color: #58cfef;
    box-shadow: 0 0 0 3px rgba(88, 207, 239, 0.1);
}

/* === SELECTED ITEMS CHIPS === */
.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 16px;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(88, 207, 239, 0.1) 0%, rgba(88, 207, 239, 0.05) 100%);
    border: 1px solid rgba(88, 207, 239, 0.3);
    border-radius: 20px;
    font-size: 13px;
    color: #1a1a1a;
    font-weight: 500;
}

.selected-chip button {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(88, 207, 239, 0.2);
    color: #58cfef;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 10px;
}

.selected-chip button:hover {
    background: #58cfef;
    color: #ffffff;
}

/* === CATEGORIES LIST === */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-header:hover {
    background: #f8f9fa;
}

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

.category-chevron {
    color: #9ca3af;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.category-item.expanded .category-chevron {
    transform: rotate(90deg);
}

[dir="rtl"] .category-item.expanded .category-chevron {
    transform: rotate(-90deg);
}

.category-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.category-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-selected {
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.category-count {
    font-size: 12px;
    color: #6c757d;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 12px;
}

.category-majors {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-top: 1px solid #f3f4f6;
}

.category-item.expanded .category-majors {
    max-height: 2000px;
}

.major-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
    pointer-events: auto !important;
    user-select: none;
}

.major-item * {
    pointer-events: none;
}

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

.major-item:hover {
    background: #f8f9fa;
}

.major-name {
    font-size: 14px;
    color: #4b5563;
    flex: 1;
}

.major-check {
    color: transparent;
    font-size: 16px;
    transition: all 0.2s ease;
}

.major-item.selected {
    background: rgba(88, 207, 239, 0.05);
}

.major-item.selected .major-name {
    color: #58cfef;
    font-weight: 600;
}

.major-item.selected .major-check {
    color: #58cfef;
}

/* === DEGREE OPTIONS === */
.degree-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.degree-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

[dir="rtl"] .degree-option {
    text-align: right;
}

.degree-option:hover {
    border-color: #58cfef;
    background: rgba(88, 207, 239, 0.02);
    transform: translateX(4px);
}

[dir="rtl"] .degree-option:hover {
    transform: translateX(-4px);
}

.degree-option.selected {
    border-color: #58cfef;
    background: rgba(88, 207, 239, 0.05);
}

.degree-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(88, 207, 239, 0.1) 0%, rgba(88, 207, 239, 0.05) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.degree-option.selected .degree-icon {
    background: linear-gradient(135deg, #58cfef 0%, #4db8d8 100%);
}

.degree-icon i {
    font-size: 22px;
    color: #58cfef;
}

.degree-option.selected .degree-icon i {
    color: #ffffff;
}

.degree-option span {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    flex: 1;
}

.degree-arrow {
    color: #9ca3af;
    font-size: 14px;
    transition: all 0.3s ease;
}

.degree-option:hover .degree-arrow {
    color: #58cfef;
    transform: translateX(4px);
}

[dir="rtl"] .degree-option:hover .degree-arrow {
    transform: translateX(-4px);
}

/* === COUNTRIES LIST === */
.countries-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.country-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
}

.country-item:hover {
    border-color: #58cfef;
    background: rgba(88, 207, 239, 0.02);
}

.country-item.selected {
    border-color: #58cfef;
    background: rgba(88, 207, 239, 0.05);
}

.country-flag {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    pointer-events: none;
}

.country-flag i {
    font-size: 20px;
    color: #58cfef;
    pointer-events: none;
}

.country-flag img {
    pointer-events: none;
}

.country-info {
    flex: 1;
    pointer-events: none;
}

.country-name,
.country-count {
    pointer-events: none;
}

.country-check {
    pointer-events: none;
}

.country-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.country-count {
    font-size: 12px;
    color: #6c757d;
}

.country-check {
    color: transparent;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.country-item.selected .country-check {
    color: #58cfef;
}

/* Ensure country item is always clickable */
.country-item * {
    pointer-events: none;
}

.country-item {
    pointer-events: auto !important;
}

/* All Countries Item - Special styling with green color */
.country-item.all-countries-item {
    border: 2px solid #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.03) 100%);
    font-weight: 600;
    margin-bottom: 16px;
}

.country-item.all-countries-item:hover {
    border-color: #059669;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.06) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.country-item.all-countries-item.selected {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.10) 100%);
}

.country-item.all-countries-item .country-name {
    color: #059669;
    font-weight: 700;
}

.country-item.all-countries-item .country-check {
    color: transparent;
}

.country-item.all-countries-item.selected .country-check {
    color: #10b981;
}

/* Gradient Globe Icon - Green for All Countries */
.gradient-globe {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    pointer-events: none;
}

.gradient-globe i {
    font-size: 20px;
    color: #ffffff !important;
    pointer-events: none;
}

/* === MODAL FOOTER === */
.search-modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.btn-modal-secondary,
.btn-modal-primary {
    flex: 1;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-modal-secondary {
    background: #f3f4f6;
    color: #6c757d;
}

.btn-modal-secondary:hover {
    background: #e5e7eb;
    color: #1a1a1a;
}

.btn-modal-primary {
    background: linear-gradient(135deg, #58cfef 0%, #4db8d8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(88, 207, 239, 0.3);
}

.btn-modal-primary:hover {
    box-shadow: 0 6px 20px rgba(88, 207, 239, 0.4);
    transform: translateY(-2px);
}

.btn-modal-primary:active {
    transform: translateY(0);
}

/* === LOADING STATE === */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 991px) {
    .search-modal-content {
        border-radius: 0;
    }

    .search-progress {
        padding: 16px;
    }

    .progress-step span {
        font-size: 11px;
    }

    .progress-circle {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .progress-line {
        margin-top: 15px;
    }
}

@media (max-width: 576px) {
    .search-modal-header {
        padding: 16px;
    }

    .search-modal-title {
        font-size: 16px;
    }

    .btn-modal-back,
    .btn-modal-close {
        width: 36px;
        height: 36px;
    }

    .search-modal-body {
        padding: 16px;
    }

    .search-progress {
        padding: 12px 16px;
    }

    .progress-step span {
        font-size: 8px;
    }

    .progress-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .progress-line {
        margin: 0 4px;
        margin-top: 13px;
    }

    .modal-search-input {
        padding: 12px 16px 12px 44px;
        font-size: 14px;
    }

    [dir="rtl"] .modal-search-input {
        padding: 12px 44px 12px 16px;
    }

    .category-header {
        padding: 14px;
    }

    .category-name {
        font-size: 14px;
    }

    .degree-option {
        padding: 14px;
    }

    .degree-icon {
        width: 42px;
        height: 42px;
    }

    .degree-icon i {
        font-size: 20px;
    }

    .degree-option span {
        font-size: 15px;
    }

    .country-item {
        padding: 12px;
    }

    .country-flag {
        width: 36px;
        height: 36px;
    }

    .country-name {
        font-size: 14px;
    }

    .search-modal-footer {
        padding: 16px;
        gap: 10px;
    }

    .btn-modal-secondary,
    .btn-modal-primary {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* === LOCKED COUNTRY (Cannot be changed on country-specific pages) === */
.country-item.locked {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.03) 100%);
    border-color: #10b981;
    cursor: default;
}

.country-item.locked:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.03) 100%);
    border-color: #10b981;
    transform: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.country-item.locked .country-name {
    color: #10b981;
    font-weight: 600;
}

.country-item.locked .country-check {
    color: #10b981;
}

[dir="rtl"] .country-item.locked .country-name i.fa-lock {
    margin-left: 0;
    margin-right: 6px;
}
