/* =====================================================
   المقايضة الذكية - منصة تبادل المنتجات
   الواجهة الأمامية - تصميم RTL عربي
   ===================================================== */

:root {
    --hwk-primary: #1f3b57;
    --hwk-primary-light: #305f82;
    --hwk-accent: #ff9f1c;
    --hwk-bg: #f7f7f7;
    --hwk-card: #ffffff;
    --hwk-text: #1f2937;
    --hwk-text-dim: #6b7280;
    --hwk-border: #e5e7eb;
    --hwk-success: #16a34a;
    --hwk-danger: #dc2626;
    --hwk-shadow: 0 4px 14px rgba(0,0,0,.06);
    --hwk-shadow-hover: 0 10px 30px rgba(0,0,0,.12);
    --hwk-radius: 12px;
}

/* ===== عام ===== */
* { box-sizing: border-box; }

body.hwk-page,
.hwk-products-page,
.hwk-product-detail,
.hwk-dashboard,
.hwk-exchanges-page,
.hwk-messages-page,
.hwk-profile-page,
.hwk-add-product-wrap {
    font-family: 'Tajawal', system-ui, sans-serif;
    color: var(--hwk-text);
}

.hwk-page-title {
    color: var(--hwk-primary);
    font-size: 24px;
    margin: 0 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hwk-page-title i { color: var(--hwk-accent); }

.hwk-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--hwk-text-dim);
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    border: 2px dashed var(--hwk-border);
}
.hwk-empty i { font-size: 48px; color: var(--hwk-accent); margin-bottom: 12px; display: block; }
.hwk-empty p { margin: 0 0 16px; }

.hwk-empty-sm { padding: 20px; text-align: center; color: var(--hwk-text-dim); }

.hwk-alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; }
.hwk-alert-ok { background: #ecfdf5; color: #065f46; border: 1px solid #10b981; }
.hwk-alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }

/* ===== أزرار ===== */
.hwk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.hwk-btn-primary { background: var(--hwk-primary); color: #fff; }
.hwk-btn-primary:hover { background: var(--hwk-primary-light); }
.hwk-btn-accent { background: var(--hwk-accent); color: #1f2937; }
.hwk-btn-accent:hover { filter: brightness(1.05); transform: translateY(-1px); }
.hwk-btn-outline { background: transparent; border: 2px solid var(--hwk-accent); color: var(--hwk-accent); }
.hwk-btn-outline:hover { background: var(--hwk-accent); color: #1f2937; }
.hwk-btn-green { background: var(--hwk-success); color: #fff; }
.hwk-btn-red { background: var(--hwk-danger); color: #fff; }
.hwk-btn-block { width: 100%; }
.hwk-btn-lg { padding: 14px 24px; font-size: 16px; }
.hwk-btn-sm { padding: 6px 12px; font-size: 12px; }

/* ===== شبكة المنتجات ===== */
.hwk-products-page { padding: 20px 0; }

.hwk-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    background: var(--hwk-card);
    padding: 14px 16px;
    border-radius: var(--hwk-radius);
    box-shadow: var(--hwk-shadow);
    align-items: center;
}

.hwk-search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}
.hwk-search-box i {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--hwk-text-dim);
}
.hwk-search-box input {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border: 1px solid var(--hwk-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

.hwk-filter-group select {
    padding: 10px 14px;
    border: 1px solid var(--hwk-border);
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.hwk-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* بطاقة المنتج */
.hwk-product-card {
    background: var(--hwk-card);
    border: 1px solid var(--hwk-border);
    border-radius: var(--hwk-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .25s, box-shadow .25s;
    display: block;
    position: relative;
}
.hwk-product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hwk-shadow-hover);
}

.hwk-product-thumb {
    height: 200px;
    background: linear-gradient(135deg, #e0e7ff, #f3f4f6);
    position: relative;
    overflow: hidden;
}
.hwk-product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hwk-thumb-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--hwk-text-dim);
}
.hwk-thumb-placeholder.big { font-size: 80px; }

.hwk-featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--hwk-accent);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.hwk-cat-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
}

.hwk-product-info { padding: 14px 16px; }
.hwk-product-title {
    font-size: 16px;
    color: var(--hwk-primary);
    margin: 0 0 6px;
    font-weight: 700;
    line-height: 1.3;
}
.hwk-product-excerpt {
    color: var(--hwk-text-dim);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
    min-height: 40px;
}
.hwk-product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--hwk-text-dim);
}
.hwk-product-points {
    background: var(--hwk-accent);
    color: #1f2937;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
}
.hwk-product-owner i, .hwk-product-location i { color: var(--hwk-text-dim); margin-left: 4px; }
.hwk-product-location { font-size: 11px; color: var(--hwk-text-dim); margin-top: 6px; }

.hwk-loading { text-align: center; padding: 30px; color: var(--hwk-text-dim); }

/* الترقيم */
.hwk-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 20px 0;
    flex-wrap: wrap;
}
.hwk-pagination button {
    background: #fff;
    border: 1px solid var(--hwk-border);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.hwk-pagination button.active { background: var(--hwk-primary); color: #fff; border-color: var(--hwk-primary); }

/* ===== تفاصيل المنتج ===== */

/* الرأس داخل السايدبار */
.hwk-pd-header { display: none; }

/* شبكة الصفحة: الصورة (يمين) + السايدبار (يسار) */
.hwk-pd-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 28px;
    align-items: start;
}
@media (max-width: 900px) { .hwk-pd-grid { grid-template-columns: 1fr; } }

/* --- عمود الصورة --- */
.hwk-pd-image {
    background: #f8fafc;
    border: 2px solid var(--hwk-border);
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(0,0,0,.08);
    margin-bottom: 0;
}
.hwk-pd-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.hwk-pd-image:hover img { transform: scale(1.03); }
.hwk-pd-image .hwk-thumb-placeholder.big {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-size: 80px;
    color: #c7d2de;
}
.hwk-pd-image .hwk-thumb-placeholder.big::after {
    content: 'لا توجد صورة للمنتج';
    font-size: 14px;
    color: var(--hwk-text-dim);
    font-weight: 500;
}

/* إحصائيات أسفل الصورة */
.hwk-pd-image-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    padding: 14px 0 0;
    margin-top: 14px;
    font-size: 13px;
    color: var(--hwk-text-dim);
}
.hwk-pd-image-stats i { color: var(--hwk-accent); margin-left: 5px; }

/* --- السايدبار --- */
.hwk-pd-sidebar {
    position: sticky;
    top: 20px;
}

.hwk-pd-card {
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    padding: 24px;
    box-shadow: var(--hwk-shadow);
    border: 1px solid var(--hwk-border);
}

/* عنوان المنتج داخل السايدبار */
.hwk-pd-title {
    color: var(--hwk-primary);
    font-size: 20px;
    margin: 0 0 16px;
    line-height: 1.5;
    font-weight: 700;
}

/* كتلة النقاط */
.hwk-pd-points {
    background: linear-gradient(135deg, var(--hwk-accent), #ffb84d);
    color: #1f2937;
    padding: 18px 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 16px;
}
.hwk-points-num { font-size: 36px; font-weight: 800; display: block; line-height: 1.2; }
.hwk-points-label { font-size: 14px; opacity: .85; font-weight: 600; }

/* رقائق المعلومات */
.hwk-pd-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.hwk-pd-chip {
    background: #f1f5f9;
    color: var(--hwk-text);
    border: 1px solid var(--hwk-border);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: border-color .2s, background .2s;
}
.hwk-pd-chip:hover {
    border-color: var(--hwk-accent);
    background: #fffbeb;
}
.hwk-pd-chip i { color: var(--hwk-primary); margin-left: 5px; }

/* إشعارات */
.hwk-own-notice, .hwk-need-login {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e40af;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    text-align: center;
}

/* إحصائيات داخل الكارد (قديم - مخفي لأنه نقل أسفل الصورة) */
.hwk-pd-card > .hwk-pd-stats { display: none; }
.hwk-pd-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--hwk-border);
    font-size: 13px;
    color: var(--hwk-text-dim);
}

/* --- الأقسام --- */
.hwk-pd-section {
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    padding: 20px 22px;
    margin-top: 20px;
    box-shadow: var(--hwk-shadow);
    border: 1px solid var(--hwk-border);
}
.hwk-pd-section-title {
    font-size: 16px;
    color: var(--hwk-primary);
    margin: 0 0 14px;
    border-bottom: 2px solid var(--hwk-accent);
    padding-bottom: 8px;
    display: inline-block;
}
.hwk-pd-content { line-height: 1.7; color: var(--hwk-text); }

.hwk-pd-table { width: 100%; border-collapse: collapse; }
.hwk-pd-table th { text-align: right; padding: 10px 14px; color: var(--hwk-text-dim); font-weight: 600; width: 35%; border-bottom: 1px solid var(--hwk-border); background: #f9fafb; }
.hwk-pd-table td { padding: 10px 14px; border-bottom: 1px solid var(--hwk-border); }

.hwk-pd-owner { display: flex; align-items: center; gap: 14px; }
.hwk-owner-avatar { width: 60px; height: 60px; border-radius: 50%; border: 3px solid var(--hwk-accent); object-fit: cover; }
.hwk-owner-info { flex: 1; }
.hwk-owner-name { font-weight: 700; color: var(--hwk-primary); font-size: 16px; }
.hwk-owner-rating { color: var(--hwk-accent); margin: 6px 0; font-size: 16px; letter-spacing: 2px; }
.hwk-rating-num { color: var(--hwk-text-dim); font-size: 13px; letter-spacing: 0; margin-right: 6px; }
/* ===== النماذج ===== */
.hwk-form-row { margin-bottom: 14px; }
.hwk-form-row label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--hwk-text); font-size: 14px; }
.hwk-form-row input, .hwk-form-row select, .hwk-form-row textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--hwk-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}
.hwk-form-row small { color: var(--hwk-text-dim); font-size: 12px; display: block; margin-top: 4px; }
.hwk-form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .hwk-form-row-2 { grid-template-columns: 1fr; } }

.hwk-form-title { color: var(--hwk-primary); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.hwk-form-subtitle { color: var(--hwk-text-dim); font-size: 13px; margin: 0 0 20px; }

.hwk-add-product-card {
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    padding: 28px;
    box-shadow: var(--hwk-shadow);
    max-width: 720px;
    margin: 0 auto;
}

.hwk-image-upload {
    position: relative;
    border: 2px dashed var(--hwk-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s;
}
.hwk-image-upload:hover { border-color: var(--hwk-accent); }
.hwk-image-upload input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.hwk-image-preview {
    padding: 30px 20px;
    text-align: center;
    color: var(--hwk-text-dim);
}
.hwk-image-preview i { font-size: 32px; color: var(--hwk-accent); display: block; margin-bottom: 8px; }
.hwk-image-preview small { display: block; margin-top: 4px; font-size: 11px; }

.hwk-form-result { margin-top: 14px; }
.hwk-form-result .ok { background: #ecfdf5; color: #065f46; padding: 12px; border-radius: 8px; border: 1px solid #10b981; }
.hwk-form-result .err { background: #fef2f2; color: #991b1b; padding: 12px; border-radius: 8px; border: 1px solid #ef4444; }

.hwk-balance-info {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    color: #92400e;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
}

/* ===== لوحة المستخدم ===== */
.hwk-welcome-card {
    background: linear-gradient(135deg, var(--hwk-primary), var(--hwk-primary-light));
    color: #fff;
    border-radius: var(--hwk-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.hwk-welcome-avatar img { border-radius: 50%; border: 3px solid var(--hwk-accent); }
.hwk-welcome-text { flex: 1; min-width: 200px; }
.hwk-welcome-text h2 { margin: 0 0 4px; font-size: 22px; }
.hwk-welcome-text p { margin: 0; opacity: .85; font-size: 14px; }
.hwk-welcome-points {
    background: var(--hwk-accent);
    color: #1f2937;
    padding: 14px 24px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
}
.hwk-welcome-points .hwk-points-num { font-size: 28px; }

.hwk-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.hwk-stat-card {
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    padding: 18px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--hwk-shadow);
    transition: transform .2s;
    display: block;
}
.hwk-stat-card:hover { transform: translateY(-3px); }
.hwk-stat-card i { font-size: 24px; color: var(--hwk-accent); }
.hwk-stat-num { font-size: 26px; font-weight: 700; color: var(--hwk-primary); margin: 6px 0 2px; }
.hwk-stat-label { font-size: 12px; color: var(--hwk-text-dim); }

.hwk-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}
.hwk-qa {
    background: var(--hwk-card);
    padding: 12px 18px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--hwk-primary);
    font-weight: 600;
    font-size: 13px;
    box-shadow: var(--hwk-shadow);
    transition: all .2s;
}
.hwk-qa:hover { background: var(--hwk-accent); color: #1f2937; }
.hwk-qa i { color: var(--hwk-accent); margin-left: 4px; }
.hwk-qa:hover i { color: #1f2937; }

.hwk-dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .hwk-dash-grid { grid-template-columns: 1fr; } }

.hwk-panel {
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    overflow: hidden;
    box-shadow: var(--hwk-shadow);
}
.hwk-panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--hwk-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hwk-panel-head h3 { margin: 0; color: var(--hwk-primary); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.hwk-panel-head h3 i { color: var(--hwk-accent); }
.hwk-panel-body { padding: 14px 18px; }
.hwk-link { color: var(--hwk-accent); text-decoration: none; font-size: 13px; font-weight: 600; }

.hwk-list { list-style: none; padding: 0; margin: 0; }
.hwk-list li { border-bottom: 1px solid var(--hwk-border); }
.hwk-list li:last-child { border: none; }
.hwk-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; text-decoration: none; color: inherit; }
.hwk-list-title { font-weight: 600; color: var(--hwk-text); }

.hwk-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-green { background: #22c55e22; color: #16a34a; }
.badge-orange { background: #ff9f1c22; color: #b45309; }
.badge-gray { background: #6b728022; color: #6b7280; }
.badge-red { background: #ef444422; color: #dc2626; }

/* ===== التبادلات ===== */
.hwk-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--hwk-border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.hwk-tab {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--hwk-text-dim);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
}
.hwk-tab.active { color: var(--hwk-primary); border-color: var(--hwk-accent); }
.hwk-tab-count {
    background: var(--hwk-accent);
    color: #1f2937;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
}

.hwk-exchanges-list { display: flex; flex-direction: column; gap: 10px; }
.hwk-exch-row {
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--hwk-shadow);
    transition: transform .2s;
}
.hwk-exch-row:hover { transform: translateX(-3px); }
.hwk-exch-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #f3f4f6; }
.hwk-exch-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hwk-thumb-placeholder-sm { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--hwk-text-dim); }
.hwk-exch-info-row { flex: 1; min-width: 0; }
.hwk-exch-title { font-weight: 700; color: var(--hwk-primary); margin-bottom: 4px; }
.hwk-exch-meta { font-size: 12px; color: var(--hwk-text-dim); }
.hwk-exch-date { font-size: 11px; color: var(--hwk-text-dim); margin-top: 4px; }

.hwk-exchange-detail { padding: 20px 0; }
.hwk-back { color: var(--hwk-text-dim); text-decoration: none; margin-bottom: 14px; display: inline-block; }
.hwk-exchange-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.hwk-exchange-head h2 { margin: 0; color: var(--hwk-primary); }
.hwk-exchange-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .hwk-exchange-grid { grid-template-columns: 1fr; } }

.hwk-exch-products { background: var(--hwk-card); border-radius: var(--hwk-radius); padding: 20px; box-shadow: var(--hwk-shadow); }
.hwk-exch-label { color: var(--hwk-text-dim); font-size: 13px; margin-bottom: 8px; }
.hwk-exch-prod-card { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--hwk-bg); border-radius: 8px; text-decoration: none; color: inherit; }
.hwk-exch-prod-card img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; }
.hwk-exch-arrow { text-align: center; font-size: 24px; color: var(--hwk-accent); margin: 14px 0; }
.hwk-exch-points-only { background: var(--hwk-bg); padding: 14px; border-radius: 8px; text-align: center; }
.hwk-exch-points-only strong { font-size: 20px; color: var(--hwk-accent); }
.hwk-exch-extra-points { background: #fffbeb; padding: 8px; border-radius: 6px; text-align: center; margin-top: 8px; color: #92400e; font-size: 13px; }

.hwk-exch-actions { background: var(--hwk-card); border-radius: var(--hwk-radius); padding: 20px; box-shadow: var(--hwk-shadow); }
.hwk-exch-info { margin-bottom: 18px; }
.hwk-exch-info > div { padding: 6px 0; border-bottom: 1px solid var(--hwk-border); }
.hwk-exch-info > div:last-child { border: none; }
.hwk-exch-msg { color: var(--hwk-text); }
.hwk-exch-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.hwk-exch-buttons .hwk-btn { flex: 1; min-width: 100px; }
.hwk-completed-note {
    background: #ecfdf5;
    color: #065f46;
    padding: 14px;
    border-radius: 8px;
    text-align: center;
    width: 100%;
}

/* ===== الرسائل ===== */
.hwk-msg-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    height: 600px;
    background: var(--hwk-card);
    border-radius: var(--hwk-radius);
    overflow: hidden;
    box-shadow: var(--hwk-shadow);
}
@media (max-width: 768px) { .hwk-msg-layout { grid-template-columns: 1fr; height: auto; } }

.hwk-threads-list { border-left: 1px solid var(--hwk-border); overflow-y: auto; max-height: 600px; }
.hwk-thread {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--hwk-border);
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.hwk-thread:hover, .hwk-thread.active { background: #eff6ff; }
.hwk-thread-avatar { width: 40px; height: 40px; border-radius: 50%; }
.hwk-thread-body { flex: 1; min-width: 0; }
.hwk-thread-head { display: flex; justify-content: space-between; align-items: center; }
.hwk-thread-badge { background: var(--hwk-accent); color: #1f2937; padding: 1px 7px; border-radius: 10px; font-size: 10px; }
.hwk-thread-product { font-size: 11px; color: var(--hwk-text-dim); margin: 2px 0; }
.hwk-thread-preview { font-size: 12px; color: var(--hwk-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hwk-chat-window { display: flex; flex-direction: column; }
.hwk-chat-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hwk-border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.hwk-chat-head img { width: 36px; height: 36px; border-radius: 50%; }
.hwk-chat-head strong { color: var(--hwk-primary); display: block; }
.hwk-chat-head small { color: var(--hwk-text-dim); font-size: 11px; }

.hwk-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9fafb;
}
.hwk-msg { max-width: 75%; padding: 10px 14px; border-radius: 12px; }
.msg-out { background: var(--hwk-accent); color: #1f2937; align-self: flex-start; }
.msg-in { background: #fff; color: var(--hwk-text); align-self: flex-end; box-shadow: var(--hwk-shadow); }
.hwk-msg-body { font-size: 14px; line-height: 1.5; }
.hwk-msg-meta { font-size: 10px; opacity: .7; margin-top: 4px; }

.hwk-chat-form {
    display: flex;
    padding: 12px;
    border-top: 1px solid var(--hwk-border);
    gap: 8px;
}
.hwk-chat-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--hwk-border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
}

.hwk-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--hwk-text-dim);
    padding: 40px;
}
.hwk-chat-empty i { font-size: 60px; color: var(--hwk-accent); margin-bottom: 14px; }

/* ===== الملف الشخصي ===== */
.hwk-profile-head {
    background: linear-gradient(135deg, var(--hwk-primary), var(--hwk-primary-light));
    color: #fff;
    border-radius: var(--hwk-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.hwk-profile-avatar { border-radius: 50%; border: 4px solid var(--hwk-accent); }
.hwk-profile-info { flex: 1; min-width: 200px; }
.hwk-profile-info h2 { margin: 0 0 4px; }
.hwk-profile-email { opacity: .85; margin: 0 0 10px; }
.hwk-profile-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.hwk-profile-stats span { background: rgba(255,255,255,.1); padding: 6px 12px; border-radius: 20px; }

.hwk-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .hwk-profile-grid { grid-template-columns: 1fr; } }

.hwk-points-summary { display: flex; gap: 12px; font-size: 13px; }
.hwk-ps-earn { color: var(--hwk-success); font-weight: 700; }
.hwk-ps-spend { color: var(--hwk-danger); font-weight: 700; }

.hwk-points-list { list-style: none; padding: 0; margin: 0; }
.hwk-points-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--hwk-border); }
.hwk-points-list li:last-child { border: none; }
.hwk-points-list li.positive .hwk-pl-amount { color: var(--hwk-success); }
.hwk-points-list li.negative .hwk-pl-amount { color: var(--hwk-danger); }
.hwk-pl-reason { font-weight: 600; color: var(--hwk-text); }
.hwk-pl-date { font-size: 11px; color: var(--hwk-text-dim); margin-top: 2px; }
.hwk-pl-amount { font-weight: 700; font-size: 16px; }
.hwk-pl-amount small { display: block; font-size: 10px; color: var(--hwk-text-dim); font-weight: 400; }

/* ===== شريط القائمة ===== */
.hwk-menu-balance a, .hwk-menu-notif a, .hwk-menu-msg a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}
.hwk-notif-count {
    background: var(--hwk-danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    margin-right: 4px;
}
.hwk-balance-inline { color: var(--hwk-accent); font-weight: 700; }

.hwk-mini-stats { display: flex; gap: 20px; flex-wrap: wrap; background: var(--hwk-card); padding: 18px; border-radius: var(--hwk-radius); }
.hwk-ms-item { color: var(--hwk-text-dim); font-size: 14px; }
.hwk-ms-item strong { color: var(--hwk-primary); font-size: 18px; margin-left: 4px; }
.hwk-ms-item i { color: var(--hwk-accent); }

/* تحميل */
.hwk-loading-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #ddd; border-top-color: var(--hwk-accent); border-radius: 50%; animation: hwk-spin .8s linear infinite; }
@keyframes hwk-spin { to { transform: rotate(360deg); } }



/* =========================================================
   HWK CHAT — FIX V2
   تثبيت منطقة كتابة الرسالة وعدم دفعها خارج نافذة المحادثة
   ========================================================= */

.hwk-msg-layout {
    height: 600px !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.hwk-msg-layout > .hwk-chat-window {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.hwk-chat-window .hwk-chat-head {
    flex: 0 0 auto !important;
}

.hwk-chat-window .hwk-chat-body {
    flex: 1 1 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.hwk-chat-window .hwk-chat-form {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 64px !important;
    max-height: 150px !important;
    position: relative !important;
    z-index: 20 !important;
    background: var(--hwk-card) !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.hwk-chat-window .hwk-chat-form textarea {
    min-height: 40px !important;
    max-height: 100px !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

@media (max-width: 768px) {
    .hwk-msg-layout {
        height: 600px !important;
        min-height: 600px !important;
    }

    .hwk-msg-layout > .hwk-chat-window {
        height: 100% !important;
        min-height: 0 !important;
    }
}
