﻿
/* ========== إعدادات عامة ========== */

.auction-page {
    padding: 32px 15px 40px;
    max-width: 1200px;
    margin: 0 auto;
    direction: rtl;
    font-family: "Tajawal", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #111827;
}

/* ========== هيدر رئيسي (المزادات المتاحة) ========== */

.auction-header {
    margin-bottom: 18px;
}

    .auction-header h1 {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 1.7rem;
        margin: 0 0 4px;
        color: #111827;
        font-weight: 800;
    }

        .auction-header h1::before {
            content: "🏷️";
            font-size: 1.4rem;
        }

    .auction-header p {
        color: #6b7280;
        font-size: 0.9rem;
        margin: 0;
    }

/* لا توجد مزادات */
.auction-empty {
    text-align: center;
    padding: 32px 20px;
    border-radius: 16px;
    background: #f9fafb;
    color: #6b7280;
    border: 1px dashed #e5e7eb;
    font-size: 0.95rem;
}

/* ========== سكشن "مزاداتي" (السلايدر العلوي) ========== */

.my-auctions-section {
    margin: 0 0 16px;
    padding: 10px 12px 12px;
    border-radius: 14px;
    background: linear-gradient(to left, #fff7ed, #fdf4ff); /* برتقالي/بنفسجي فاتح ورايق */
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.my-auctions-header {
    margin-bottom: 6px;
    text-align: right;
}

    .my-auctions-header h2 {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 1.05rem;
        font-weight: 800;
        margin: 0;
        color: #111827;
    }

        .my-auctions-header h2::before {
            content: "📊";
            font-size: 1.2rem;
        }

    .my-auctions-header p {
        font-size: 0.78rem;
        margin: 2px 0 0;
        color: #6b7280;
    }

/* سطر كروت أفقي قابل للسحب */
.my-auctions-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 2px 4px;
}

    .my-auctions-scroll::-webkit-scrollbar {
        height: 4px;
    }

    .my-auctions-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .my-auctions-scroll::-webkit-scrollbar-thumb {
        background: rgba(15, 23, 42, 0.22);
        border-radius: 999px;
    }

/* بطاقة مزاداتي */

.my-auction-card {
    flex: 0 0 170px;
    max-width: 170px;
    padding: 6px 8px 8px;
    border-radius: 12px;
    background: #ffffff;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(148, 163, 253, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
    display: flex;
    flex-direction: column;
}

    .my-auction-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
        border-color: #6366f1;
        background-color: #fefeff;
    }

    /* صورة ثابتة مع contain */
    .my-auction-card .auction-image-wrap.small {
        height: 70px;
        margin-bottom: 4px;
        border-radius: 8px;
        overflow: hidden;
        background: #f9fafb;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .my-auction-card .auction-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    /* محتوى مضغوط */
    .my-auction-card .auction-body.compact {
        padding: 0;
    }

    /* عنوان - ثابت، بدون كسر، مع ... */
    .my-auction-card .auction-title {
        font-size: 0.78rem;
        margin: 0 0 2px;
        color: #111827;
        font-weight: 600;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* سعر مزاداتي */
    .my-auction-card .auction-price.tiny {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin: 0 0 2px;
        font-size: 0.68rem;
    }

        .my-auction-card .auction-price.tiny .label {
            color: #9ca3af;
        }

        .my-auction-card .auction-price.tiny .value {
            font-weight: 700;
            color: #2563eb; /* أزرق هادي يعطي إحساس ثقة */
        }

    /* تايمر صغير + بار تقدم */
    .my-auction-card .auction-timer-wrap.slim {
        margin: 0 0 2px;
    }

    .my-auction-card .auction-timer {
        font-size: 0.64rem;
        color: #4b5563;
        min-height: 14px;
    }

    .my-auction-card .auction-progress {
        margin-top: 1px;
        height: 3px;
        border-radius: 999px;
        background-color: #e5e7eb;
        overflow: hidden;
    }

    .my-auction-card .auction-progress-bar {
        height: 100%;
        border-radius: 999px;
        background: linear-gradient(to left, #4f46e5, #a855f7);
        transition: width 0.4s ease;
    }

/* هنت الحالة */
.my-auction-hint {
    margin-top: 2px;
    font-size: 0.64rem;
    line-height: 1.3;
    color: #16a34a;
    font-weight: 500;
    text-align: center;
}

.my-auction-card.auction-ended .my-auction-hint {
    color: #0f766e;
}

/* موبايل - سلايدر */
@media (max-width: 768px) {
    .my-auctions-section {
        margin: 0 -6px 14px;
        padding: 8px 8px 10px;
        border-radius: 0;
    }

    .my-auction-card {
        flex-basis: 155px;
        max-width: 155px;
    }
}

/* ========== شبكة المزادات العامة (المزادات المتاحة) ========== */

.auction-grid {
    margin-top: 8px;
    padding: 10px 10px 14px;
    border-radius: 16px;
    background: #f9fafb; /* أفتح من سكشن مزاداتي */
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

/* بطاقة المزاد العام */
.auction-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
    border: 1px solid #e5e7eb;
    position: relative;
}

    /* ما نطبّق هوفر قوي على بطاقات مزاداتي لأن عندها ستايلها الخاص */
    .auction-card:hover:not(.my-auction-card) {
        transform: translateY(-4px);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
        border-color: #6366f1;
    }

/* صورة المزاد العام: ثابتة + contain */
.auction-image-wrap {
    position: relative;
    overflow: hidden;
    height: 190px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auction-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.5s ease;
}

.auction-card:hover .auction-image {
    transform: scale(1.03);
}

/* بادج حالة المزاد */
.auction-badge {
    position: absolute;
    top:2px;
    right: 2px;
    background: linear-gradient(to left, #6366f1, #8b5cf6);
    color: #ffffff;
    padding: 4px 10px;
    font-size: 0.65rem;
    border-radius: 999px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.28);
}

.auction-card.auction-upcoming .auction-badge {
    background: linear-gradient(to left, #22c55e, #22c55e);
}

/* محتوى البطاقة */
.auction-body {
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* عنوان المزاد - سنتر + ... */
.auction-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* السعر */
.auction-price {
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: baseline;
}

    .auction-price .label {
        font-size: 0.78rem;
        color: #9ca3af;
    }

    .auction-price .value {
        font-size: 0.98rem;
        font-weight: 800;
        color: #16a34a; /* أخضر ثقة للمشتري */
    }

/* التايمر + البار */
.auction-timer-wrap {
    margin-top: 2px;
}

.auction-timer {
    font-size: 0.76rem;
    color: #4b5563;
    margin-bottom: 3px;
    min-height: 17px;
    text-align: center;
}

.auction-progress {
    width: 100%;
    height: 5px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.auction-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(to left, #4f46e5, #a855f7);
    transition: width 0.5s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

    .auction-progress-bar.hot {
        background: linear-gradient(to left, #ef4444, #f97316);
        box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
    }

    .auction-progress-bar.ended {
        background: #9ca3af;
    }

/* كارت منتهي */
.auction-card.auction-ended {
    opacity: 0.9;
    border-style: dashed;
}

/* زر دخول المزاد */
.auction-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 0;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(to left, #4f46e5, #6366f1);
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.22s ease, transform 0.14s ease, box-shadow 0.22s ease;
}

    .auction-btn:hover {
        background: linear-gradient(to left, #4338ca, #4f46e5);
        box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
        transform: translateY(-1px);
    }

    .auction-btn:active {
        transform: translateY(1px);
        box-shadow: none;
    }

/* ========== ريسبونسيف ========== */

@media (max-width: 992px) {
    .auction-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .auction-page {
        padding: 18px 10px 26px;
    }

    .auction-header h1 {
        font-size: 1.4rem;
    }

    .auction-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 8px 8px 10px;
        border-radius: 12px;
    }

    .auction-card {
        border-radius: 12px;
    }

    .auction-image-wrap {
        height: 150px;
    }

    .auction-title {
        font-size: 0.82rem;
    }

    .auction-price .value {
        font-size: 0.9rem;
    }
}


/* ===== My Auctions rank styles ===== */
.my-auctions-section .my-auction-card {
    transition: background-color .25s ease, box-shadow .25s ease, border-color .25s ease;
    border: 2px solid transparent;
}

    /* المتصدر */
    .my-auctions-section .my-auction-card.rank-1 {
        background: rgba(22,163,74,.06); /* أخضر فاتح */
        border-color: rgba(22,163,74,.45);
        box-shadow: 0 6px 18px rgba(22,163,74,.12);
    }

    /* ثاني */
    .my-auctions-section .my-auction-card.rank-2 {
        background: rgba(234,179,8,.06); /* ذهبي/أصفر فاتح */
        border-color: rgba(234,179,8,.45);
        box-shadow: 0 6px 18px rgba(234,179,8,.12);
    }

    /* ثالث */
    .my-auctions-section .my-auction-card.rank-3 {
        background: rgba(59,130,246,.06); /* أزرق فاتح */
        border-color: rgba(59,130,246,.45);
        box-shadow: 0 6px 18px rgba(59,130,246,.12);
    }

    /* خارج الثلاثة/الحالة الافتراضية */
    .my-auctions-section .my-auction-card.rank-none {
        background: rgba(0,0,0,.02);
        border-color: rgba(0,0,0,.06);
    }

    /* انتهى المزاد */
    .my-auctions-section .my-auction-card.auction-ended {
        background: rgba(107,114,128,.06); /* رمادي */
        border-color: rgba(107,114,128,.35);
        box-shadow: none;
        opacity: .9;
    }

/* ومضة خفيفة عند تغيّر الترتيب */
@keyframes rankFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(244,63,94,.35);
    }

    100% {
        box-shadow: 0 0 0 16px rgba(244,63,94,0);
    }
}

.my-auction-card.flash {
    animation: rankFlash .8s ease-out 1;
}




/* ===== تلوين كامل لخلفية بطاقة "مزاداتي" حسب الترتيب ===== */
.my-auctions-section .my-auction-card {
    background: #ffffff; /* ديفولت */
    border-width: 2px;
    transition: background-color .25s ease, box-shadow .25s ease, border-color .25s ease, transform .18s ease;
}

    /* المتصدر */
    .my-auctions-section .my-auction-card.rank-1 {
        /* خلفية ملوّنة واضحة */
        background: linear-gradient(180deg, rgba(22,163,74,.14), rgba(22,163,74,.06)) !important;
        border-color: rgba(22,163,74,.55);
        box-shadow: 0 8px 20px rgba(22,163,74,.16);
    }

        .my-auctions-section .my-auction-card.rank-1 .auction-price .value {
            color: #15803d;
        }

        .my-auctions-section .my-auction-card.rank-1 .my-auction-hint {
            color: #166534;
        }

    /* ثاني */
    .my-auctions-section .my-auction-card.rank-2 {
        background: linear-gradient(180deg, rgba(234,179,8,.16), rgba(234,179,8,.07)) !important;
        border-color: rgba(234,179,8,.55);
        box-shadow: 0 8px 20px rgba(234,179,8,.18);
    }

        .my-auctions-section .my-auction-card.rank-2 .auction-price .value {
            color: #a16207;
        }

        .my-auctions-section .my-auction-card.rank-2 .my-auction-hint {
            color: #854d0e;
        }

    /* ثالث */
    .my-auctions-section .my-auction-card.rank-3 {
        background: linear-gradient(180deg, rgba(59,130,246,.16), rgba(59,130,246,.07)) !important;
        border-color: rgba(59,130,246,.55);
        box-shadow: 0 8px 20px rgba(59,130,246,.18);
    }

        .my-auctions-section .my-auction-card.rank-3 .auction-price .value {
            color: #1d4ed8;
        }

        .my-auctions-section .my-auction-card.rank-3 .my-auction-hint {
            color: #1e40af;
        }

    /* خارج الثلاثة */
    .my-auctions-section .my-auction-card.rank-none {
        background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.02)) !important;
        border-color: rgba(0,0,0,.08);
    }

    /* انتهى المزاد */
    .my-auctions-section .my-auction-card.auction-ended {
        background: linear-gradient(180deg, rgba(107,114,128,.18), rgba(107,114,128,.08)) !important;
        border-color: rgba(107,114,128,.45);
        box-shadow: none;
        opacity: .92;
    }

    /* لا تبهّت الألوان عند الهوفر */
    .my-auctions-section .my-auction-card.rank-1:hover,
    .my-auctions-section .my-auction-card.rank-2:hover,
    .my-auctions-section .my-auction-card.rank-3:hover,
    .my-auctions-section .my-auction-card.rank-none:hover {
        transform: translateY(-2px);
        filter: brightness(1.02);
        border-color: currentColor;
    }

/* وميض بسيط عند تغيّر الترتيب */
@keyframes rankFlashStrong {
    0% {
        box-shadow: 0 0 0 0 rgba(244,63,94,.35);
    }

    100% {
        box-shadow: 0 0 0 20px rgba(244,63,94,0);
    }
}

.my-auction-card.flash {
    animation: rankFlashStrong .8s ease-out 1;
}
