:root {
    --bs-primary-custom: #2563eb;
    --bs-dark-custom: #111827;
    --bs-orange-custom: #f97316;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-dark: #111827;
    --color-orange: #f97316;
    --color-orange-hover: #ea580c;
    --color-text: #111827;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-bg-soft: #f8f9fa;
    --color-surface: #ffffff;
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 10px 24px rgba(0, 0, 0, 0.08);
    --radius-sm: 12px;
    --radius-md: 14px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    /* تغطية الـ safe area للهواتف */
}

img {
    max-width: 100%;
    height: auto;
}

a,
button,
.page-link,
.nav-item,
.hero-btn,
.hero-btn-outline,
.reaction-btn,
.share-icon {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* =========================
   Utility colors
========================= */
.text-primary-custom {
    color: var(--color-primary) !important;
}

.bg-primary-custom {
    background-color: var(--color-primary) !important;
}

.btn-primary-custom {
    background-color: var(--color-primary) !important;
    color: #fff !important;
    border: none;
}

.btn-primary-custom:hover {
    background-color: var(--color-primary-hover) !important;
}

.text-dark-custom {
    color: var(--color-dark) !important;
}

.bg-dark-custom {
    background-color: var(--color-dark) !important;
}

.btn-dark-custom {
    background-color: var(--color-dark) !important;
    color: #fff !important;
    border: none;
}

.text-orange-custom {
    color: var(--color-orange) !important;
}

.bg-orange-custom {
    background-color: var(--color-orange) !important;
}

.btn-orange-custom {
    background-color: var(--color-orange) !important;
    color: #fff !important;
    border: none;
}

.btn-orange-custom:hover {
    background-color: var(--color-orange-hover) !important;
}

.badge-primary-custom {
    background: var(--color-primary);
    color: #fff;
}

.badge-dark-custom {
    background: var(--color-dark);
    color: #fff;
}

.badge-orange-custom {
    background: var(--color-orange);
    color: #fff;
}

/* =========================
   Sticky breadcrumb
========================= */
.sticky-breadcrumb {
    position: sticky;
    top: 25px;
    z-index: 1020;
    padding: 1px 0;
    background: transparent !important;
    backdrop-filter: none !important;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.breadcrumb::-webkit-scrollbar {
    display: none;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
}

.breadcrumb-item a,
.breadcrumb-item.active {
    padding: 6px 12px;
    border-radius: 20px;
    background: #f3f4f6;
    margin-inline-end: 6px;
    color: #333;
    text-decoration: none;
    transition: 0.2s ease;
}

.breadcrumb-item.active {
    background: var(--color-orange);
    color: #fff;
}

.breadcrumb-item a:active {
    transform: scale(0.96);
}

/* =========================
   Pagination
========================= */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    direction: rtl;
}

.pagination .page-link {
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 14px;
    min-width: 42px;
    text-align: center;
    transition: all 0.2s ease;
}

.pagination .page-link:active {
    transform: scale(0.95);
}

.pagination .page-item.active .page-link {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    font-weight: 700;
}

.pagination .page-item:first-child .page-link {
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.pagination .page-item:last-child .page-link {
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}


/* =========================
   Bottom Navigation (Updated)
========================= */

.bottom-nav {
    position: fixed;
    inset-inline: 0;
    /* بدلاً من left/right */
    bottom: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: space-between;
    /* توزيع العناصر */
    gap: 4px;
    /* فراغ بين العناصر الجانبية */

    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    /* تضمين safe area */
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    /* تأثير الضبابية */
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.06);
    /* ظل علوي */
}

.bottom-nav .nav-item {
    position: relative;
    flex: 1;
    /* يأخذ حصة متساوية */
    min-width: 0;
    /* يسمح بالتقليم إذا لزم الأمر */

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 8px 4px;
    /* تقليل الحشو قليلاً */
    border-radius: 16px;
    /* زوايا أكثر نعومة */

    text-decoration: none;
    color: var(--color-muted);
    /* لون خافت عند عدم التنشيط */
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;

    transition: transform 0.15s ease, color 0.2s ease, background 0.2s ease;
    /* تحسين التحول */
}

.bottom-nav .nav-item i {
    font-size: 20px;
    /* حجم أيقونة مناسب */
    line-height: 1;
    margin-bottom: 4px;
}

.bottom-nav .nav-item span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* يمنع النص من الانتقال إلى سطر جديد */
}

.bottom-nav .nav-item:hover {
    color: var(--color-primary);
    /* تغيير اللون عند التحويم */
}

.bottom-nav .nav-item:active {
    transform: scale(0.94);
    /* تأثير ضغط */
}

.bottom-nav .nav-item.active {
    color: var(--color-primary);
    /* لون النشاط */
    background: rgba(37, 99, 235, 0.08);
    /* خلفية خفيفة */
}

/* زر الإضافة المركزي (TikTok style) */
.bottom-nav .nav-add {
    flex: 0 0 auto;
    /* لا يتوسع أو يتقلص */
    width: 60px;
    height: 60px;
    margin-top: -22px;
    /* يبرز خارج الشريط */

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-orange), var(--color-orange-hover));
    /* تدرج لون */
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(249, 115, 22, 0.34);
    /* ظل قوي */
    z-index: 2;
    /* يظهر فوق العناصر الأخرى */
}

.bottom-nav .nav-add i {
    font-size: 26px;
    /* أيقونة أكبر */
    margin: 0;
    /* بدون هامش */
}

.bottom-nav .nav-add span {
    font-size: 9px;
    /* حجم خط صغير */
    margin-top: 2px;
    /* مسافة صغيرة من الأيقونة */
}

.bottom-nav .nav-add:active {
    transform: scale(0.92);
    /* تأثير ضغط للزر المركزي */
}

/* =========================
   Notifications in nav
========================= */
.nav-notify {
    position: relative;
}

.icon-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    transition: 0.2s ease;
}

.nav-notify i {
    font-size: 1.35rem;
    line-height: 1;
}

.badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #dc3545;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: pop 0.25s ease;
}

.hidden {
    display: none !important;
}

.pulse {
    animation: pulseAnim 0.5s ease;
}

@keyframes pop {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulseAnim {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* =========================
   Share buttons
========================= */
.share-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
    text-decoration: none;
    background: #fcfcfc;
    transition: all 0.25s ease;
}

.share-icon:hover {
    transform: translateY(-3px);
}

.share-icon.whatsapp {
    color: #25D366;
}

.share-icon.facebook {
    color: #1877F2;
}

.share-icon.telegram {
    color: #229ED9;
}

.share-icon.copy {
    color: #6c757d;
}

/* =========================
   Ads / cards
========================= */
.ad-card {
    border-radius: 16px;
    overflow: hidden;
    transition: 0.22s ease;
    background: #fff;
}

.ad-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.ad-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.car-related-card {
    transition: 0.2s ease;
}

.car-related-card:hover {
    transform: translateY(-4px);
}

.notification-card {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px;
    margin-bottom: 10px;

    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: #333;

    box-shadow: var(--shadow-soft);
    transition: 0.2s ease;
}

.notification-card:hover {
    transform: translateY(-2px);
}

.notification-card.unread {
    background: #f8f9ff;
    border-right: 3px solid #0d6efd;
}

.notification-card .icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    border-radius: 50%;
    font-size: 18px;
    flex-shrink: 0;
}

.notification-card .content {
    flex: 1;
    min-width: 0;
}

.notification-card .title {
    font-weight: 600;
    font-size: 14px;
}

.notification-card .message {
    font-size: 13px;
    color: #666;
}

.notification-card .time {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #0d6efd;
    border-radius: 50%;
    flex-shrink: 0;
}

.empty,
.empty-liked-box {
    text-align: center;
    color: #888;
}

.empty-liked-box {
    background: #fff;
    border-radius: 20px;
    padding: 28px 20px;
    border: 1px dashed #d7d7d7;
}

/* =========================
   Reaction buttons
========================= */
.reaction-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reaction-btn {
    border: none;
    background: #f8f9fa;
    border-radius: 999px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s ease;
    font-weight: 600;
}

.reaction-btn:hover {
    background: #eceff1;
}

.reaction-btn i {
    font-size: 1.4rem;
    line-height: 1;
}

.bi-hand-thumbs-up-fill {
    color: #198754;
}

.bi-hand-thumbs-down-fill {
    color: #dc3545;
}

/* =========================
   Shine effect
========================= */
.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shine-move 2s infinite;
}

@keyframes shine-move {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* =========================
   Hero section
========================= */
.hero-section {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-2xl);
    padding: 30px 20px;
    background: linear-gradient(135deg, #50b0ff 0%, #6aa8ff 100%);
    color: #fff;
}

.hero-overlay {
    position: absolute;
    inset: 0;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-logo {
    max-height: 62px;
}

.hero-title {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 15px;
    line-height: 1.8;
    opacity: 0.95;
    max-width: 480px;
    margin: 0 auto 20px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-btn,
.hero-btn-outline {
    border-radius: 14px;
    padding: 12px 20px;
    font-weight: 700;
}

.hero-btn-outline {
    border: none;
}

.hero-user {
    font-size: 14px;
    opacity: 0.95;
}

/* =========================
   Categories
========================= */
.categories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    padding-right: 2px;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-pill {
    min-width: 105px;
    height: 92px;
    border-radius: 22px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    color: #111;
    transition: 0.2s ease;
    flex-shrink: 0;
    scroll-snap-align: start;
}

.category-pill:hover {
    transform: translateY(-3px);
}

.category-pill span {
    font-size: 28px;
    margin-bottom: 8px;
}

.category-pill small {
    font-size: 13px;
    font-weight: 700;
}

/* =========================
   Sections / spacing
========================= */
.section {
    margin-top: 42px;
}

/* =========================
   Viewer.js
========================= */
.viewer-footer {
    top: 0;
    bottom: auto;
}

.viewer-toolbar {
    margin-top: 20px;
}

/* =========================
   Responsive
========================= */
@media (max-width: 576px) {
    body {
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
        /* تعديل الـ padding للهاتف الصغير */
    }

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .sticky-breadcrumb {
        top: 18px;
    }

    .pagination {
        gap: 8px;
    }

    .pagination .page-link {
        padding: 12px 16px;
        font-size: 15px;
        min-width: 46px;
    }

    .bottom-nav {
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
        /* تعديل الحشو */
    }

    .bottom-nav .nav-item {
        padding: 7px 2px;
        /* تقليل الحشو */
        font-size: 10px;
        /* تقليل حجم الخط */
    }

    .bottom-nav .nav-item i {
        font-size: 19px;
        /* تقليل حجم الأيقونة */
        margin-bottom: 3px;
        /* تقليل الهامش السفلي */
    }

    .icon-wrapper {
        width: 38px;
        height: 38px;
    }

    .bottom-nav .nav-add {
        width: 56px;
        /* تقليل حجم الزر المركزي */
        height: 56px;
        margin-top: -20px;
        /* تعديل الموضع */
    }

    .bottom-nav .nav-add i {
        font-size: 24px;
        /* تقليل حجم أيقونة الزر المركزي */
    }

    .bottom-nav .nav-add span {
        font-size: 8px;
        /* تقليل حجم نص الزر المركزي */
    }

    .share-icon {
        width: 42px;
        height: 42px;
        font-size: 17px;
    }

    .hero-section {
        padding: 24px 14px;
        border-radius: 22px;
    }

    .hero-logo {
        max-height: 54px;
    }

    .hero-title {
        font-size: 23px;
    }

    .hero-subtitle {
        font-size: 14px;
        line-height: 1.7;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-btn,
    .hero-btn-outline {
        width: 100%;
    }

    .hero-user {
        font-size: 13px;
    }

    .categories-scroll {
        gap: 10px;
        padding-right: 14px;
    }

    .category-pill {
        min-width: 78px;
        height: 82px;
        border-radius: 18px;
    }

    .category-pill span {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .category-pill small {
        font-size: 11px;
    }

    .ad-img {
        height: 100px;
    }

    .section h5 {
        font-size: 15px;
    }

    .card-body {
        padding: 10px !important;
    }

    .notification-card .icon {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    .notification-card .title {
        font-size: 13px;
    }

    .notification-card .message {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .bottom-nav .nav-item span {
        font-size: 9px;
        /* تقليل حجم النصوص في الهاتف الصغير */
    }

    .bottom-nav .nav-item i {
        font-size: 18px;
        /* تقليل حجم الأيقونات */
    }

    .bottom-nav .nav-add {
        width: 52px;
        /* تقليل حجم الزر المركزي */
        height: 52px;
        margin-top: -18px;
        /* تعديل الموضع */
    }

    .icon-wrapper {
        width: 36px;
        height: 36px;
    }
}

.reaction-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem .9rem;
    border: 0;
    border-radius: 999px;
    background: #f1f3f4;
    color: #0f0f0f;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.reaction-btn:hover {
    background: #e9ecef;
}

.reaction-btn:active {
    transform: scale(.96);
}

.reaction-btn.like-active {
    background: #e8f0fe;
    color: #1a73e8;
}

#like-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transform-origin: center;
    will-change: transform;
}

.reaction-btn.like-active #like-icon {
    color: #1a73e8;
}

#like-icon.like-animate {
    animation: ytLikePop .42s cubic-bezier(.2, 1.35, .35, 1);
}

.reaction-btn.like-burst::before,
.reaction-btn.like-burst::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.reaction-btn.like-burst::before {
    background: rgba(26, 115, 232, .25);
    animation: ytRipple .45s ease-out forwards;
}

.reaction-btn.like-burst::after {
    box-shadow:
        0 -18px 0 #1a73e8,
        13px -13px 0 #8ab4f8,
        18px 0 0 #1a73e8,
        13px 13px 0 #8ab4f8,
        0 18px 0 #1a73e8,
        -13px 13px 0 #8ab4f8,
        -18px 0 0 #1a73e8,
        -13px -13px 0 #8ab4f8;
    animation: ytBurst .45s ease-out forwards;
}

@keyframes ytLikePop {
    0% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.35) rotate(-8deg);
    }
    70% {
        transform: scale(1.08) rotate(4deg);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes ytRipple {
    0% {
        opacity: .9;
        transform: translate(-50%, -50%) scale(.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.2);
    }
}

@keyframes ytBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(.35);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.7);
    }
}