/* اتجاه الصفحة حسب لغة html (بدون directory-style الذي يفرض rtl على body) */
html[dir="ltr"] body.market-requests-page-wrap {
    direction: ltr;
    text-align: left;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

html[dir="rtl"] body.market-requests-page-wrap {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* ارتفاع الهايدر الثابت للزوار (مطابق لـ modern-header-offline) */
body.market-requests-page-wrap:not(.has-modern-header) {
    --market-nav-header-height: 70px;
}

body.market-requests-page-wrap:not(.has-modern-header):has(.site-mode-alert) {
    --market-nav-header-height: 130px;
}

.market-requests-page {
    background: #f3f6f8;
    min-height: calc(100vh - 70px);
    padding-bottom: 3rem;
}

/* الزوار: المحتوى يبدأ تحت الهايدر الثابت (المسجّلون: sticky عبر has-modern-header) */
body.market-requests-page-wrap:not(.has-modern-header) .market-requests-page {
    padding-top: var(--market-nav-header-height, 70px);
}

.market-requests-page .service-request-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.market-requests-page .requester-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.market-requests-page .market-owner-row {
    margin-bottom: 0.5rem;
}

.market-requests-page .requester-name {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.market-requests-page .request-date {
    font-size: 0.72rem;
    color: #888;
}

.market-requests-page .market-owner-role {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color, #138275);
    background: rgba(19, 130, 117, 0.1);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    line-height: 1.3;
    margin-inline-start: 0.5rem;
}

.market-requests-page .requester-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

.market-requests-page .requester-avatar-initial {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color, #138275);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.market-profile-banner {
    max-width: 1100px;
    margin: 0 auto 0.5rem;
    border-radius: 10px;
}

.market-hero {
    background: linear-gradient(135deg, #0d5c54 0%, #138275 45%, #1aa896 100%);
    color: #fff;
    padding: 2rem 1.25rem 2.5rem;
    margin-bottom: 0;
}

.market-hero-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.market-hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.market-hero p {
    opacity: 0.92;
    margin-bottom: 1rem;
    max-width: 680px;
    line-height: 1.7;
}

.market-hero a,
.market-hero-links a {
    color: #fff !important;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
    opacity: 0.95;
}

.market-hero a:hover,
.market-hero-links a:hover {
    color: #fff !important;
    opacity: 1;
    text-decoration-thickness: 2px;
}

.market-hero-links-sep {
    color: rgba(255, 255, 255, 0.75);
    margin: 0 0.35rem;
}

.market-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    margin-inline-start: 0.5rem;
}

.market-main {
    max-width: 1100px;
    margin: -1.25rem auto 0;
    padding: 0 1rem;
}

.market-toolbar {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.market-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.market-tab-btn {
    border: 1px solid #dce3e8;
    background: #f8fafb;
    color: #444;
    border-radius: 10px;
    padding: 0.55rem 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

a.market-tab-btn:hover {
    color: #2d3748;
    background: #eef2f4;
}

.market-tab-btn.active {
    background: var(--primary-color, #138275);
    border-color: var(--primary-color, #138275);
    color: #fff;
}

a.market-tab-btn.active:hover {
    color: #fff;
    background: var(--primary-color, #138275);
}

.market-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.market-filters .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    color: #666;
}

.market-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: space-between;
    align-items: center;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.market-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.market-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.market-card-image {
    height: 140px;
    background: linear-gradient(145deg, #eef5f4, #dfeceb);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.market-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-card-image .placeholder-icon {
    font-size: 2.5rem;
    color: #9bb8b3;
}

.market-card-body {
    padding: 0.875rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.market-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.market-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.market-chip {
    font-size: 0.72rem;
    background: #f0f4f3;
    color: #35524d;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-weight: 600;
}

.market-signals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin: 0.5rem 0 0.75rem;
    padding: 0.5rem;
    background: #f8fbfa;
    border: 1px solid #e3ecea;
    border-radius: 8px;
}

.market-signal {
    font-size: 0.72rem;
    color: #2d5a52;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
}

.market-signal i {
    color: var(--primary-color, #138275);
    width: 14px;
    text-align: center;
}

.market-card-notes {
    font-size: 0.82rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    flex: 1;
}

.market-card-footer {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: auto;
}

.market-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.market-btn-interest,
.market-btn-save {
    border: 1px solid #c5ddd8;
    background: #fff;
    color: #138275;
    border-radius: 8px;
    padding: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.market-btn-interest.active,
.market-btn-save.active {
    background: #e8f5f2;
    border-color: #138275;
    color: #0d5c54;
}

.market-btn-save.active i {
    color: #138275;
}

.market-btn-message {
    width: 100%;
    padding: 0.5rem;
    background: linear-gradient(135deg, #0084ff 0%, #0066cc 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.market-btn-message-profile {
    margin-top: 0.25rem;
    background: #f0f4f3 !important;
    color: #35524d !important;
    box-shadow: none !important;
}

.market-status-chip {
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.15rem 0.45rem;
}

.market-status-chip.active {
    background: #e8f5e9;
    color: #2e7d32;
}

.market-status-chip.expired {
    background: #fff3e0;
    color: #e65100;
}

.market-status-chip.inactive {
    background: #fce4ec;
    color: #c62828;
}

.market-manage-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.market-btn-edit {
    border: 1px solid #138275;
    background: #fff;
    color: #138275;
    border-radius: 8px;
    padding: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.market-btn-delete {
    border: 1px solid #dc3545;
    background: #fff;
    color: #dc3545;
    border-radius: 8px;
    padding: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.market-filters.hidden {
    display: none !important;
}

.market-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
    grid-column: 1 / -1;
}

.market-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.market-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10050;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.market-modal-overlay.show {
    display: flex;
}

.market-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.market-modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.market-modal-body {
    padding: 1.25rem;
}

.market-image-preview {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 0.5rem;
    display: none;
}

.market-delivery-field {
    padding: 0.85rem 1rem;
    border: 1px solid #e3ecea;
    border-radius: 10px;
    background: #f8fbfa;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.market-delivery-field.is-on {
    border-color: #b8ddd6;
    background: #eef8f5;
}

.market-delivery-field__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.market-delivery-field__info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.market-delivery-field__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #dce8e5;
    color: var(--primary-color, #138275);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.market-delivery-field.is-on .market-delivery-field__icon {
    background: var(--primary-color, #138275);
    border-color: var(--primary-color, #138275);
    color: #fff;
}

.market-delivery-field__label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a1a;
    line-height: 1.3;
}

.market-delivery-field__state {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: #eceff1;
    color: #607d8b;
}

.market-delivery-field.is-on .market-delivery-field__state {
    background: #d4ede7;
    color: #1b6b5f;
}

.market-delivery-switch .form-check-input {
    width: 2.75rem;
    height: 1.4rem;
    cursor: pointer;
    margin: 0;
}

.market-delivery-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(19, 130, 117, 0.2);
}

@media (max-width: 576px) {
    .market-signals {
        grid-template-columns: 1fr;
    }
}
