/**
 * ============================================
 * منصة بيت بت - أنماط صفحة البحث عن الأقرب
 * BaytPet Platform - Find Nearest Page Styles
 * ============================================
 */

/* ============================================
   أزرار التبويب (Service Tabs)
   ============================================ */
.service-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.875rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #6b7280;
    background: white;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.service-tab:hover {
    border-color: var(--color-primary, #f97316);
    color: var(--color-primary, #f97316);
    background: #fff7ed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.15);
}

.service-tab.active {
    background: linear-gradient(135deg, var(--color-primary, #f97316), var(--color-primary-dark, #ea580c));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.35);
    transform: translateY(-1px);
}

.service-tab.active i {
    animation: tabIconPulse 0.4s ease;
}

@keyframes tabIconPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ============================================
   شارات نوع الخدمة
   ============================================ */
.service-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.service-badge.badge-hosts {
    background: rgba(59, 130, 246, 0.9);
    color: white;
}

.service-badge.badge-vets {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.service-badge.badge-shops {
    background: rgba(168, 85, 247, 0.9);
    color: white;
}

/* ============================================
   بطاقة النتيجة (Card)
   ============================================ */
.nearest-card {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardFadeIn 0.4s ease forwards;
    opacity: 0;
}

.nearest-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تأخير ظهور البطاقات بالتسلسل */
.nearest-card:nth-child(1) { animation-delay: 0.05s; }
.nearest-card:nth-child(2) { animation-delay: 0.1s; }
.nearest-card:nth-child(3) { animation-delay: 0.15s; }
.nearest-card:nth-child(4) { animation-delay: 0.2s; }
.nearest-card:nth-child(5) { animation-delay: 0.25s; }
.nearest-card:nth-child(6) { animation-delay: 0.3s; }
.nearest-card:nth-child(7) { animation-delay: 0.35s; }
.nearest-card:nth-child(8) { animation-delay: 0.4s; }
.nearest-card:nth-child(9) { animation-delay: 0.45s; }

/* صورة البطاقة الافتراضية */
.nearest-card .card-avatar {
    transition: transform 0.5s ease;
}

.nearest-card:hover .card-avatar {
    transform: scale(1.05);
}

/* ============================================
   مؤشر شارة المسافة
   ============================================ */
.distance-badge {
    transition: all 0.3s ease;
}

.nearest-card:hover .distance-badge {
    background: var(--color-primary, #f97316);
    color: white;
}

.nearest-card:hover .distance-badge i {
    color: white;
}

/* ============================================
   حركة التحميل (Loader)
   ============================================ */
.nearest-loader {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--color-primary, #f97316);
    border-radius: 50%;
    animation: loaderSpin 0.8s ease-in-out infinite;
}

@keyframes loaderSpin {
    to { transform: rotate(360deg); }
}

/* ============================================
   مؤشر نطاق البحث (Range Slider)
   ============================================ */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--color-primary, #f97316), #e5e7eb);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--color-primary, #f97316);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--color-primary, #f97316);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================
   شارات المعلومات الإضافية (Tags)
   ============================================ */
.extra-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.extra-tag.tag-price {
    background: #ecfdf5;
    color: #065f46;
    border-color: #d1fae5;
}

.extra-tag.tag-emergency {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
    animation: emergencyPulse 2s infinite;
}

@keyframes emergencyPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.extra-tag.tag-pets {
    background: #eff6ff;
    color: #1e40af;
    border-color: #dbeafe;
}

.extra-tag.tag-category {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ede9fe;
}

/* ============================================
   النجوم (Rating Stars)
   ============================================ */
.star-filled {
    color: #fbbf24;
}

.star-empty {
    color: #d1d5db;
}

/* ============================================
   استجابة للشاشات الصغيرة (Mobile)
   ============================================ */
@media (max-width: 640px) {
    .service-tab {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    #service-tabs {
        gap: 0.5rem;
    }
    
    .nearest-card .h-48 {
        height: 10rem;
    }
}

/* ============================================
   تأثيرات RTL
   ============================================ */
[dir="rtl"] .card-map-link {
    margin-right: auto;
    margin-left: 0;
}

/* ============================================
   تأثير الظهور للحاوية
   ============================================ */
#results-grid {
    transition: opacity 0.3s ease;
}

#results-grid.loading {
    opacity: 0.4;
    pointer-events: none;
}

/* ============================================
   حد النص (Line Clamp)
   ============================================ */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
