/**
 * TasisPlus Market & Community (تأسیس‌مارکت)
 * Core Stylesheet - Clean, RTL, Zero Bloat
 */

:root {
    --tm-primary: #0066cc;
    --tm-primary-hover: #0052a3;
    --tm-urgent: #e63946;
    --tm-accent: #f77f00;
    --tm-success: #2a9d8f;
    --tm-bg-gray: #f8f9fa;
    --tm-border-color: #e2e8f0;
    --tm-text-main: #1e293b;
    --tm-text-muted: #64748b;
    --tm-radius: 10px;
    --tm-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --tm-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.tasis-market-container {
    max-width: 1240px;
    margin: 25px auto;
    padding: 0 16px;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    font-family: inherit;
    color: var(--tm-text-main);
}

.tasis-market-container * {
    box-sizing: border-box;
}

/* Breadcrumbs */
.tm-breadcrumbs {
    font-size: 13px;
    color: var(--tm-text-muted);
    margin-bottom: 20px;
    padding: 8px 14px;
    background: #f1f5f9;
    border-radius: var(--tm-radius);
}
.tm-breadcrumbs a {
    color: var(--tm-primary);
    text-decoration: none;
}
.tm-breadcrumbs a:hover {
    text-decoration: underline;
}

/* Header & Auth Bar */
.tasis-market-header {
    background: #ffffff;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: var(--tm-shadow);
}
.tm-header-inner h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--tm-text-main);
}
.tm-header-inner p {
    margin: 0;
    font-size: 14px;
    color: var(--tm-text-muted);
}

.tasis-market-auth-status {
    display: flex;
    align-items: center;
    gap: 10px;
}
.tm-logged-in-box,
.tm-logged-out-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.tm-user-badge {
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tm-pill-verified {
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* Buttons */
.tm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.tm-btn-primary {
    background: var(--tm-primary);
    color: #ffffff !important;
}
.tm-btn-primary:hover {
    background: var(--tm-primary-hover);
    color: #ffffff;
}
.tm-btn-outline {
    background: transparent;
    border-color: var(--tm-border-color);
    color: var(--tm-text-main) !important;
}
.tm-btn-secondary {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569 !important;
}
.tm-btn-secondary:hover {
    background: #f1f5f9;
    color: #1e293b !important;
    border-color: #94a3b8;
}
.tm-filter-actions-group {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tm-filter-actions-group .tm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13.5px;
    padding: 10px 14px;
    font-weight: 600;
}
.tm-btn-lg {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: 8px;
}
.tm-btn-block {
    width: 100%;
}

/* Layout: Archive */
.tasis-market-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 24px;
    align-items: start;
}

/* Sidebar Filters */
.tasis-market-sidebar {
    position: sticky;
    top: 20px;
}
.tm-filter-card {
    background: #ffffff;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    padding: 20px;
    box-shadow: var(--tm-shadow);
}
.tm-filter-card h3,
.tm-filter-card h2,
.tm-filter-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tm-border-color);
    display: flex;
    align-items: center;
    gap: 6px;
}
.tm-filter-group {
    margin-bottom: 16px;
}
.tm-filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--tm-text-main);
}
.tm-filter-group input[type="text"],
.tm-filter-group input[type="number"],
.tm-filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--tm-border-color);
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}
.tm-filter-group input:focus,
.tm-filter-group select:focus {
    border-color: var(--tm-primary);
}
.tm-price-range {
    display: flex;
    gap: 8px;
}
.tm-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

/* Results Content */
.tm-results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 12px 18px;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--tm-text-muted);
}
.tm-results-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tm-sort-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.tm-sort-tabs {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--tm-border-color);
    border-radius: 20px;
    padding: 3px;
    gap: 3px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tm-sort-tabs::-webkit-scrollbar {
    display: none;
}
.tm-sort-tab {
    border: none;
    background: transparent;
    color: #475569;
    font-size: 12.5px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    outline: none;
    user-select: none;
}
.tm-sort-tab:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}
.tm-sort-tab.active {
    background: var(--tm-primary, #0284c7);
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.35);
}
.tm-sort-select {
    padding: 6px 12px;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius-sm, 6px);
    background: #ffffff;
    color: var(--tm-text-color, #1e293b);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.tm-sort-select:hover {
    border-color: #cbd5e1;
}
.tm-sort-select:focus {
    border-color: var(--tm-primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.tm-applied-status {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    animation: tmFadeIn 0.3s ease;
}
@keyframes tmFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.tm-view-toggle-wrap {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
    border: 1px solid var(--tm-border-color);
}
.tm-btn-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}
.tm-btn-view:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}
.tm-btn-view.active {
    background: #ffffff;
    color: var(--tm-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Grid & Cards */
.tm-ads-grid,
.tasis-market-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

/* 3 Columns Mode (Explicit) */
.tm-ads-grid.tm-grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1024px) {
    .tm-ads-grid,
    .tm-ads-grid.tm-grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .tm-ads-grid,
    .tm-ads-grid.tm-grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* 1 Column / Single Ad per Row (Wide List Layout) */
.tm-ads-grid.tm-grid-cols-1 {
    grid-template-columns: 1fr;
    gap: 16px;
}
.tm-ads-grid.tm-grid-cols-1 .tm-card {
    flex-direction: row;
    align-items: stretch;
    height: auto;
}
.tm-ads-grid.tm-grid-cols-1 .tm-card-thumb-wrap {
    width: 240px;
    min-width: 240px;
    height: auto;
    min-height: 170px;
}
.tm-ads-grid.tm-grid-cols-1 .tm-card-body {
    padding: 18px 24px;
    flex: 1;
}
.tm-ads-grid.tm-grid-cols-1 .tm-card-title {
    font-size: 17px;
    margin-bottom: 12px;
}
@media (max-width: 680px) {
    .tm-ads-grid.tm-grid-cols-1 .tm-card {
        flex-direction: column;
    }
    .tm-ads-grid.tm-grid-cols-1 .tm-card-thumb-wrap {
        width: 100%;
        min-width: 100%;
        height: 200px;
    }
}

/* Infinite Scroll Sentinel & Loading Animation */
.tm-infinite-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px 16px;
    font-size: 13px;
    color: var(--tm-text-muted);
}
.tm-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--tm-primary);
    border-radius: 50%;
    animation: tm-spin 0.8s linear infinite;
}
@keyframes tm-spin {
    to { transform: rotate(360deg); }
}
.tm-end-message {
    text-align: center;
    padding: 28px 16px;
    font-size: 13px;
    color: #94a3b8;
    position: relative;
}
.tm-end-message::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 20%;
    right: 20%;
    height: 1px;
    background: #e2e8f0;
    z-index: 1;
}
.tm-end-message span {
    position: relative;
    z-index: 2;
    background: #ffffff;
    padding: 0 16px;
}
.tm-card {
    background: #ffffff;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    overflow: hidden;
    box-shadow: var(--tm-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.tm-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tm-shadow-hover);
}
.tm-card-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    height: auto;
    max-height: 180px;
    background: #f1f5f9;
    overflow: hidden;
}
.tm-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tm-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 48px;
}
.tm-badge {
    position: absolute;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    z-index: 2;
}
.tm-badge-urgent {
    top: 8px;
    left: 8px;
    right: auto;
    background: var(--tm-urgent);
    color: #ffffff;
    animation: pulse 2s infinite;
    z-index: 3;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.tm-badge-cond {
    bottom: 8px;
    left: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    z-index: 2;
}

.tm-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.tm-card-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.9em;
}
.tm-card-title a {
    color: var(--tm-text-main);
    text-decoration: none;
}
.tm-card-title a:hover {
    color: var(--tm-primary);
}
.tm-card-specs {
    font-size: 11.5px;
    color: var(--tm-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.tm-card-specs span {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
.tm-ads-grid.tm-grid-cols-3 .tm-card-excerpt {
    display: none;
}
.tm-card-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.tm-card-price {
    font-size: 14.5px;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}
.tm-price-curr {
    font-size: 11px;
    font-weight: normal;
    color: var(--tm-text-muted);
}
.tm-btn-quickview {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 5px;
    white-space: nowrap;
}
.tm-card-meta {
    font-size: 11px;
    color: var(--tm-text-muted);
}

/* Card Excerpt & Date Badges */
.tm-card {
    cursor: pointer;
}
.tm-card-excerpt {
    font-size: 13px;
    line-height: 1.6;
    color: #475569;
    margin: 0 0 14px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 40px;
    cursor: pointer;
}
.tm-spec-date {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
    font-weight: 600;
}
.tm-ads-grid.tm-grid-cols-1 .tm-card-excerpt {
    -webkit-line-clamp: 3;
    font-size: 14px;
    margin-bottom: 16px;
    min-height: auto;
}

/* Enhanced Seller Message Card in Drawer & Single View */
.tm-seller-message-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.tm-seller-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #166534;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
}
.tm-seller-message-header .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #15803d;
}
.tm-seller-message-body {
    font-size: 14px;
    line-height: 1.8;
    color: #1e293b;
    white-space: pre-line;
}

/* Structured Specs List */
.tm-specs-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.tm-spec-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
}
.tm-content-h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 22px 0 12px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    border-right: 3px solid var(--tm-primary);
    padding-right: 8px;
}
.tm-content-h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 16px 0 8px 0;
}
.tm-content-hr {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 20px 0;
}
.tm-content-quote {
    background: #f8fafc;
    border-right: 3px solid #cbd5e1;
    margin: 12px 0;
    padding: 10px 14px;
    color: #475569;
    font-style: normal;
}

/* Single Ad View */
.tm-single-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}
.tm-single-main,
.tm-single-sidebar {
    background: #ffffff;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    padding: 24px;
    box-shadow: var(--tm-shadow);
}
.tm-single-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 16px 0;
    line-height: 1.4;
}
.tm-single-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--tm-text-muted);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--tm-border-color);
    margin-bottom: 20px;
}
.tm-gallery-main {
    margin-bottom: 24px;
    background: #f8fafc;
    border-radius: var(--tm-radius);
    overflow: hidden;
    text-align: center;
}
.tm-gallery-main img {
    max-height: 420px;
    object-fit: contain;
    width: 100%;
}
.tm-specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 13px;
}
.tm-specs-table th,
.tm-specs-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--tm-border-color);
}
.tm-specs-table th {
    background: #f8fafc;
    width: 35%;
    font-weight: 600;
    color: var(--tm-text-muted);
    text-align: right;
}

/* Call to Action Box */
.tm-call-box {
    background: #f8fafc;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}
.tm-call-box .tm-price-row {
    margin-bottom: 16px;
}
.tm-call-box .tm-price-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--tm-primary);
}
.tm-call-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    background: #16a34a;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    text-decoration: none;
}
.tm-call-btn:hover {
    background: #15803d;
}
.tm-call-btn.revealed {
    background: #0284c7;
    font-family: monospace;
    font-size: 18px;
    direction: ltr;
}

/* FATA Legal Notice */
.tm-fata-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--tm-radius);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 12px;
    line-height: 1.6;
    color: #92400e;
    margin-top: 20px;
}
.tm-fata-icon {
    font-size: 24px;
    color: #d97706;
}
.tm-fata-notice strong {
    display: block;
    margin-bottom: 4px;
}
.tm-fata-small {
    margin-bottom: 20px;
}

/* Submit Form */
.tm-submit-card {
    background: #ffffff;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    padding: 30px;
    box-shadow: var(--tm-shadow);
}
.tm-submit-header {
    border-bottom: 1px solid var(--tm-border-color);
    padding-bottom: 20px;
    margin-bottom: 24px;
}
.tm-submit-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px 0;
}
.tm-submit-header p {
    font-size: 14px;
    color: var(--tm-text-muted);
    margin: 0;
}
.tm-form-section {
    background: #f8fafc;
    border: 1px solid var(--tm-border-color);
    border-radius: var(--tm-radius);
    padding: 20px;
    margin-bottom: 20px;
}
.tm-section-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--tm-border-color);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--tm-primary);
}
.tm-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
}
.tm-form-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.tm-col-12 { width: 100%; }
.tm-col-6  { width: calc(50% - 8px); }
.tm-col-4  { width: calc(33.333% - 11px); }

.tm-form-group label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.tm-form-group label .required {
    color: var(--tm-urgent);
}
.tm-form-group input,
.tm-form-group select,
.tm-form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--tm-border-color);
    border-radius: 6px;
    font-size: 14px;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}
.tm-form-group input:focus,
.tm-form-group select:focus,
.tm-form-group textarea:focus {
    border-color: var(--tm-primary);
}
.tm-form-group small {
    font-size: 11px;
    color: var(--tm-text-muted);
    margin-top: 4px;
}

.tm-notice {
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
}
.tm-notice-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.tm-notice-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.tm-form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 24px;
}

.spin {
    animation: tm-spin 1s infinite linear;
}
@keyframes tm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 860px) {
    html, body, #page {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    .tasis-market-container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 16px !important;
        margin: 10px auto !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    .tasis-market-layout,
    .tm-single-layout {
        grid-template-columns: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    .tm-col-6,
    .tm-col-4 {
        width: 100%;
    }
    .tasis-market-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 14px;
        gap: 14px;
    }
    .tm-header-inner h1 {
        font-size: 18px;
        line-height: 1.4;
    }
    .tm-header-inner p {
        font-size: 13px;
    }
    .tasis-market-auth-status {
        width: 100%;
        justify-content: flex-start;
    }
    .tm-logged-out-box {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }
    .tm-logged-out-box span {
        font-size: 12.5px;
        text-align: center;
    }
    .tm-logged-out-box a {
        width: 100%;
        text-align: center;
    }
    .tm-results-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }
    .tm-results-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }
    .tm-sort-bar {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .tm-sort-tabs {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        width: max-content;
    }
    .tm-sort-tab {
        white-space: nowrap;
        padding: 6px 10px;
        font-size: 12px;
    }
    .tm-view-toggle-wrap {
        display: none !important;
    }
    #tm-filter-saved-toggle {
        width: 100%;
        text-align: center;
    }

    /* Mobile Cards: 1-Column Divar / Sheypoor List Layout */
    .tm-ads-grid,
    .tm-ads-grid.tm-grid-cols-3,
    .tm-ads-grid.tm-grid-cols-1 {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    .tm-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        direction: rtl !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 10px 14px !important;
        min-height: 105px !important;
        height: auto !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
        cursor: pointer !important;
        overflow: hidden !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    }
    .tm-card:active {
        background: #f8fafc !important;
        transform: scale(0.99) !important;
    }
    /* Thumb on left, text on right in RTL */
    .tm-card-body {
        order: 1 !important;
        padding: 0 0 0 12px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-align: right !important;
    }
    .tm-card-thumb-wrap {
        order: 2 !important;
        flex-shrink: 0 !important;
        width: 90px !important;
        min-width: 90px !important;
        max-width: 90px !important;
        height: 90px !important;
        min-height: 90px !important;
        max-height: 90px !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        align-self: center !important;
        margin: 0 0 0 4px !important;
        background: #f1f5f9 !important;
        position: relative !important;
    }
    .tm-card-thumb {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
    }
    .tm-card-title {
        font-size: 13.5px !important;
        font-weight: 700 !important;
        line-height: 1.45 !important;
        margin: 0 0 4px 0 !important;
        height: auto !important;
        color: #0f172a !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        word-break: break-word !important;
    }
    .tm-card-title a {
        color: #0f172a !important;
        text-decoration: none !important;
    }
    .tm-card-specs {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 4px 8px !important;
        margin: 4px 0 !important;
        font-size: 11px !important;
        color: #64748b !important;
        overflow: hidden !important;
    }
    .tm-card-specs span {
        display: inline-flex !important;
        align-items: center !important;
        background: #f1f5f9 !important;
        border: none !important;
        padding: 2px 6px !important;
        border-radius: 4px !important;
        font-size: 10.5px !important;
        color: #64748b !important;
        white-space: nowrap !important;
        max-width: 140px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .tm-card-footer {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-top: 6px !important;
        border-top: 1px dashed #f1f5f9 !important;
        margin-top: auto !important;
    }
    .tm-card-price {
        font-size: 14px !important;
        font-weight: 800 !important;
        color: #0284c7 !important;
        text-align: right !important;
    }
    .tm-card-excerpt {
        display: none !important;
    }
    .tm-btn-quickview {
        display: none !important; /* whole row is clickable */
    }
    .tm-card-bookmark {
        top: 4px !important;
        right: 4px !important;
        width: 24px !important;
        height: 24px !important;
        font-size: 12px !important;
        background: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(2px) !important;
    }
    }
}

/* ==============================================================================
 * Offcanvas Drawer & Fast SPA Interaction Styles
 * ============================================================================== */
.tm-results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--tm-border-color);
    padding: 12px 18px;
    border-radius: var(--tm-radius);
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--tm-text-muted);
}
.tm-results-actions {
    display: flex;
    gap: 8px;
}
.tm-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
}
#tm-filter-saved-toggle.active {
    background: #fef08a;
    border-color: #f59e0b;
    color: #854d0e;
    font-weight: 700;
}

.tm-card {
    position: relative;
}
.tm-card-bookmark {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(203, 213, 225, 0.8);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.tm-card-bookmark:hover {
    transform: scale(1.1);
    background: #ffffff;
}
.tm-card-bookmark.active {
    background: #fef08a;
    border-color: #f59e0b;
}

.tm-btn-quickview {
    background: #eff6ff;
    color: var(--tm-primary);
    border: 1px solid #bfdbfe;
    font-weight: 600;
    transition: all 0.2s ease;
}
.tm-btn-quickview:hover {
    background: var(--tm-primary);
    color: #ffffff;
}

/* Offcanvas Drawer */
body.tm-drawer-locked {
    overflow: hidden;
}
.tm-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    transition: opacity 0.3s ease;
}
.tm-ad-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 520px;
    max-width: 95vw;
    background: #ffffff;
    z-index: 99999;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(105%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
    text-align: right;
    overflow: hidden;
}
.tm-ad-drawer.open {
    transform: translateX(0) !important;
}
.tm-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--tm-border-color);
    background: #f8fafc;
}
.tm-drawer-close {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: background 0.2s;
}
.tm-drawer-close:hover {
    background: #dc2626;
    color: #ffffff;
}
.tm-drawer-actions {
    display: flex;
    gap: 8px;
}
.tm-btn-icon {
    background: #ffffff;
    border: 1px solid var(--tm-border-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.tm-btn-icon:hover {
    background: #f1f5f9;
}
.tm-btn-icon.active {
    background: #fef08a;
    border-color: #f59e0b;
}

.tm-drawer-content {
    flex: 1 1 auto;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0 0 30px 0;
}
.tm-drawer-loading,
.tm-drawer-error {
    padding: 60px 20px;
    text-align: center;
    color: var(--tm-text-muted);
}
.tm-drawer-loading .spin {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
}
.tm-drawer-media {
    background: #0f172a;
    max-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.tm-drawer-media img {
    width: 100%;
    height: 100%;
    max-height: 220px;
    object-fit: cover;
}
.tm-drawer-media.placeholder {
    height: 200px;
    color: #475569;
    font-size: 48px;
}
.tm-drawer-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.tm-drawer-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0;
    color: var(--tm-text-main);
}
.tm-drawer-price-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tm-drawer-price-card .label {
    font-size: 14px;
    color: #166534;
}
.tm-drawer-price-card .val {
    font-size: 19px;
    font-weight: 800;
    color: #15803d;
}
.tm-drawer-specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: #f8fafc;
    border: 1px solid var(--tm-border-color);
    padding: 14px;
    border-radius: 8px;
}
.tm-drawer-specs-grid .spec-cell {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    gap: 3px;
}
.tm-drawer-specs-grid .spec-cell span {
    color: var(--tm-text-muted);
}
.tm-drawer-specs-grid .spec-cell strong {
    color: var(--tm-text-main);
    font-size: 14px;
}
.tm-drawer-contact-box {
    margin: 6px 0;
}
.tm-drawer-contact-box .tm-btn-primary {
    background: #2563eb;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    padding: 14px;
}
.tm-drawer-contact-box .tm-btn-primary.revealed {
    background: #16a34a;
}
.tm-contact-note {
    display: block;
    text-align: center;
    color: var(--tm-text-muted);
    font-size: 11px;
    margin-top: 6px;
}
.tm-drawer-description {
    margin: 16px 0 14px 0;
}
.tm-drawer-description h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #1e3a8a;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tm-drawer-description .desc-text {
    font-size: 14px;
    line-height: 1.85;
    color: #1e293b;
    word-break: break-word;
}
.tm-drawer-specs-wrap {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed #cbd5e1;
}
.tm-drawer-specs-wrap h4 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tm-card-more-hint {
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    margin-right: 4px;
    white-space: nowrap;
}
.tm-card:hover .tm-card-more-hint {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Cornerstone SEO Guide Section */
.tm-seo-guide-section {
    margin-top: 36px;
    margin-bottom: 30px;
    clear: both;
}
.tm-seo-guide-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    padding: 28px 32px;
    line-height: 1.95;
    color: #334155;
    font-size: 14.5px;
}
.tm-seo-guide-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 24px 0 12px 0;
    border-right: 4px solid #0284c7;
    padding-right: 12px;
}
.tm-seo-guide-card h2:first-child {
    margin-top: 0;
}
.tm-seo-guide-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 18px 0 10px 0;
}
.tm-seo-guide-card p {
    margin-bottom: 16px;
    text-align: justify;
}
.tm-seo-guide-card a {
    color: #0284c7;
    text-decoration: underline;
    text-underline-offset: 4px;
    font-weight: 600;
    transition: color 0.15s ease;
}
.tm-seo-guide-card a:hover {
    color: #0369a1;
}
.tm-seo-guide-card ul, .tm-seo-guide-card ol {
    margin: 12px 24px 18px 0;
    padding: 0;
}
.tm-seo-guide-card li {
    margin-bottom: 8px;
}
.tm-seo-guide-card table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}
.tm-seo-guide-card th, .tm-seo-guide-card td {
    border: 1px solid #cbd5e1;
    padding: 10px 14px;
    text-align: right;
    font-size: 13.5px;
}
.tm-seo-guide-card th {
    background: #f8fafc;
    font-weight: 700;
    color: #0f172a;
}


