/* hamyar-tools/assets/css/hmyt-bookmark.css */

/* --- دکمه افزودن/حذف بوکمارک (Frontend Button) --- */
.hmyt-bookmark-button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    gap: 8px;
}
.hmyt-bookmark-button svg path {
    transition: fill 0.3s ease, stroke 0.3s ease;
}
.hmyt-bookmark-button span {
    font-size: 14px;
}

/* --- کانتینر اصلی لیست --- */
.hmyt-bookmark-container {
    display: flex;
    width: 100%;
}

/* --- کارت بوکمارک (مشترک بین لیست و گرید) --- */
.hmyt-bookmark-card {
    background: #fff;
    border: 1px solid #f4f4f4;
    /* خط پایین ضخیم‌تر مثل نمونه افیلیت */
    border-bottom: solid 8px #f4f4f4;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hmyt-bookmark-card:last-child {
    border-bottom: 1px solid #f4f4f4;
}

.hmyt-bookmark-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

/* --- نوار رنگی وضعیت (Status Bar) --- */
.hmyt-bookmark-status-bar {
    background: #43d343; /* رنگ سبز مشابه نمونه افیلیت */
    width: 4px;
    height: 20px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* --- تصویر شاخص --- */
.hmyt-bookmark-thumb-link {
    flex-shrink: 0;
    display: block;
}
.hmyt-bookmark-thumb {
    width: 60px;
    height: 60px;
    border-radius: 10px; /* گردی گوشه‌ها مثل نمونه افیلیت */
    object-fit: cover;
}

/* --- اطلاعات آیتم --- */
.hmyt-bookmark-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: hidden; /* برای جلوگیری از سرریز متن طولانی */
}

.hmyt-bookmark-title {
    font-weight: 700;
    font-size: 15px;
    color: #334155 !important;
    text-decoration: none;
    transition: color 0.2s;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hmyt-bookmark-title:hover {
    color: #2563eb;
}

.hmyt-bookmark-meta {
    font-size: 12px;
    color: #64748b;
}

.hmyt-bookmark-type-badge {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    color: #475569;
}

/* --- دکمه‌های عملیات (مشاهده و حذف) --- */
.hmyt-bookmark-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0; /* جلوگیری از فشرده شدنِ دکمه‌ها توسط بخش اطلاعات محصول */
}

.hmyt-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b !important;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 !important;
}

.hmyt-action-btn svg {
    width: 18px;
    height: 18px;
}

.hmyt-action-btn:hover {
    opacity: .6;
}

/* =========================================
   استایل‌های اختصاصی حالت لیستی (List View)
   ========================================= */
.hmyt-bookmark-container.list-view {
    flex-direction: column;
}

/* =========================================
   استایل‌های اختصاصی حالت شبکه (Grid View)
   ========================================= */
.hmyt-bookmark-container.grid-view {
    flex-wrap: wrap;
    flex-direction: row;
}

.hmyt-bookmark-container.grid-view .hmyt-bookmark-card {
    /* محاسبه عرض: ۳ ستون با فاصله ۱۵ پیکسل */
    width: calc(33.333% - 10px); 
    flex-direction: column;
    text-align: center;
    align-items: center;
    padding: 20px;
    gap: 12px;
}

/* در حالت گرید، نوار رنگی را مخفی میکنیم یا به بالای کارت میبریم */
.hmyt-bookmark-container.grid-view .hmyt-bookmark-status-bar {
    width: 25px;
    height: 4px;
    margin-bottom: 5px;
}

.hmyt-bookmark-container.grid-view .hmyt-bookmark-thumb {
    width: 80px;
    height: 80px;
    margin-bottom: 5px;
}

.hmyt-bookmark-container.grid-view .hmyt-bookmark-info {
    width: 100%;
    align-items: center;
}

.hmyt-bookmark-container.grid-view .hmyt-bookmark-actions {
    width: 100%;
    justify-content: center;
    margin-top: 5px;
    border-top: 1px solid #f1f5f9;
    padding-top: 15px;
}

/* =========================================
   ریسپانسیو (Mobile)
   ========================================= */
@media (max-width: 768px) {
    /* در موبایل، گرید ۲ ستونه شود */
    .hmyt-bookmark-container.grid-view .hmyt-bookmark-card {
        width: calc(50% - 8px);
    }
}

@media (max-width: 480px) {
    /* در موبایل خیلی کوچک، گرید ۱ ستونه شود */
    .hmyt-bookmark-container.grid-view .hmyt-bookmark-card {
        width: 100%;
    }
    
    /* در موبایل لیست ویو، دکمه‌ها پایین بیایند */
    .hmyt-bookmark-container.list-view .hmyt-bookmark-card {
        flex-wrap: wrap;
    }
    .hmyt-bookmark-container.list-view .hmyt-bookmark-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 10px;
        border-top: 1px solid #f0f0f0;
    }
}

.grid-view .hmyt-bookmark-card {
    border-left: solid 8px #f4f4f4;
    border-bottom: solid 1px #f4f4f4;
}

.grid-view .hmyt-bookmark-card:last-child {
    border-left: solid 1px #f4f4f4;
}

.grid-view .hmyt-bookmark-card:nth-child(3) { border-left: solid 1px #f4f4f4; }
.grid-view:has(.hmyt-bookmark-card:nth-child(4)) .hmyt-bookmark-card:nth-child(-n+3) { border-bottom: solid 8px #f4f4f4; }

/* استایل برای Placeholder (جایگزین تصویر) */
.hmyt-bookmark-thumb-link > .hmyt-card-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: #e3e8ee;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* تغییر سایز در حالت گرید (Grid View) */
.hmyt-bookmark-container.grid-view .hmyt-card-placeholder {
    width: 80px;
    height: 80px;
    margin-bottom: 5px;
}

/* برای اطمینان از اینکه SVG داخلش وسط‌چین و خوش‌فرم است */
.hmyt-card-placeholder svg {
    width: 28px;
    height: 28px;
    opacity: 0.7;
}


/* --- Dark Mode Styles --- */

/* Bookmark Card & Layout Spacing */
body.dark .hmyt-bookmark-card {
    background: #353542;
    /* Borders act as gaps in this layout, so they match the body bg */
    border-color: #262631; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

body.dark .hmyt-bookmark-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Grid View Specific Borders */
body.dark .grid-view .hmyt-bookmark-card,
body.dark .grid-view .hmyt-bookmark-card:last-child,
body.dark .grid-view .hmyt-bookmark-card:nth-child(3),
body.dark .grid-view:has(.hmyt-bookmark-card:nth-child(4)) .hmyt-bookmark-card:nth-child(-n+3) {
    border-color: #262631;
}

/* Text Colors */
body.dark .hmyt-bookmark-title {
    color: #fff !important;
}

body.dark .hmyt-bookmark-meta {
    color: #9ca3af;
}

/* Badges & Placeholders */
body.dark .hmyt-bookmark-type-badge {
    background: #262631;
    color: #e5e7eb;
}

body.dark .hmyt-bookmark-thumb-link > .hmyt-card-placeholder {
    background: #262631;
}

body.dark .hmyt-card-placeholder svg {
    opacity: 0.5;
    fill: #9ca3af;
}

/* Action Buttons */
body.dark .hmyt-action-btn {
    background: #262631;
    border-color: #414150;
    color: #ccc !important;
}

body.dark .hmyt-action-btn:hover {
    background-color: #414150;
    color: #fff !important;
}

/* Internal Separators (Grid View) */
body.dark .hmyt-bookmark-container.grid-view .hmyt-bookmark-actions {
    border-top-color: #414150;
}

/* Bookmark Main Button (if used separately) */
body.dark .hmyt-bookmark-button span {
    color: #e5e7eb;
}

body.dark .hmyt-bookmark-button svg path {
    stroke: #e5e7eb; 
}

.hmyt-bookmark-pc-compat {
    flex-grow: 1;
    flex-shrink: 0; /* محافظت قاطع از عرض المان‌های شورتکد فشرده (عدم درهم‌ریختگی) */
}

.hmyt-bookmark-actions .hmyt-pc-compact-item {
    padding: 0;
    gap: 15px;
}

.hmyt-mc-actions-row-2 {
    border-top: none !important; 
    padding-top: 0 !important; 
    margin-top: 10px !important;
}

.grid-view .hmyt-bookmark-card div .hmyt-pc-qty-controller > .hmyt-qty-text-section {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

/* خنثی‌سازی کانتینر کوئریِ شورتکد فشرده در داخل کارت بوکمارک برای جلوگیری از مچاله شدن */
.hmyt-bookmark-card .hmyt-pc-compact-item .hmyt-pc-action-box {
    container-type: normal !important;
    width: max-content !important;
    min-width: max-content !important;
}