/*
  ظاهر ترب الوکادو. یک فایل، بدون فریم‌ورک — چون کل سایت چند صفحهٔ ساده است و
  کشیدن یک فریم‌ورک CSS فقط حجم اضافه می‌کرد.
*/

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #e3e8ee;
    --text: #1f2933;
    --muted: #6b7785;
    --brand: #e8384f;
    --brand-dark: #c72c40;
    --ok: #0f9d58;
    --warn: #f4b400;
    --danger: #d93025;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Tahoma, "Segoe UI", IRANSans, sans-serif;
    font-size: 14px;
    line-height: 1.8;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }

.t-container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- سربرگ ---------- */

.t-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.t-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 64px;
    flex-wrap: wrap;
}

.t-brand { display: flex; align-items: baseline; gap: 6px; font-weight: 700; }
.t-brand-mark { color: var(--brand); font-size: 22px; }
.t-brand-sub { color: var(--muted); font-size: 12px; }

.t-search { display: flex; flex: 1 1 320px; gap: 8px; }

.t-search input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--bg);
}

.t-search input:focus { outline: 2px solid var(--brand); background: var(--surface); }

.t-search button {
    padding: 10px 18px;
    border: 0;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.t-search button:hover { background: var(--brand-dark); }

.t-nav { display: flex; align-items: center; gap: 14px; font-size: 13px; }

/* ---------- اجزای عمومی ---------- */

.t-main { padding: 24px 16px 48px; min-height: 60vh; }

.t-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.t-card h2, .t-card h3 { margin-top: 0; }

.t-btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-align: center;
}

.t-btn:hover { border-color: var(--brand); color: var(--brand); }
.t-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.t-btn-primary:hover { background: var(--brand-dark); color: #fff; }
.t-btn-sm { padding: 6px 12px; font-size: 13px; }
.t-btn-danger { border-color: var(--danger); color: var(--danger); }

.t-alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.t-alert-success { background: #e6f4ea; border-color: #b7dfc2; color: #0b6b33; }
.t-alert-error { background: #fce8e6; border-color: #f3b4ae; color: #9c221a; }
.t-alert-info { background: #e8f0fe; border-color: #b6cdf7; color: #174ea6; }

.t-muted { color: var(--muted); }
.t-small { font-size: 12px; }

/* ---------- فرم ---------- */

.t-field { margin-bottom: 14px; }
.t-field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

.t-field input,
.t-field select,
.t-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
}

.t-field input:focus,
.t-field select:focus,
.t-field textarea:focus { outline: 2px solid var(--brand); }

.t-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* ---------- کارت محصول ---------- */

.t-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.t-product {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.t-product:hover { border-color: var(--brand); }

.t-product-image {
    aspect-ratio: 1;
    background: var(--bg);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.t-product-image img { width: 100%; height: 100%; object-fit: contain; }

.t-product-title {
    font-size: 13px;
    line-height: 1.7;
    min-height: 3.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.t-price { font-weight: 700; font-size: 16px; }
.t-price small { font-weight: 400; font-size: 11px; color: var(--muted); }
.t-price-old { text-decoration: line-through; color: var(--muted); font-size: 12px; font-weight: 400; }

.t-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid var(--border);
}

.t-badge-ok { background: #e6f4ea; border-color: #b7dfc2; color: #0b6b33; }
.t-badge-warn { background: #fef7e0; border-color: #f6dd8f; color: #7a5b00; }
.t-badge-danger { background: #fce8e6; border-color: #f3b4ae; color: #9c221a; }
.t-badge-muted { background: var(--bg); color: var(--muted); }

.t-out-of-stock { color: var(--danger); font-size: 12px; }

/* ---------- جدول ---------- */

.t-table-wrap { overflow-x: auto; }

.t-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.t-table th, .t-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; }
.t-table th { background: var(--bg); font-weight: 600; color: var(--muted); white-space: nowrap; }
.t-table tbody tr:hover { background: #fafbfc; }

/* ---------- آمار ---------- */

.t-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

.t-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.t-stat-label { font-size: 12px; color: var(--muted); }
.t-stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; }

/* نمودار ستونی ساده؛ ارتفاع هر ستون با متغیر --h از سمت سرور می‌آید. */
.t-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: 12px; }
.t-chart-bar { flex: 1; background: var(--bg); border-radius: 4px 4px 0 0; position: relative; display: flex; align-items: flex-end; }
.t-chart-fill { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; height: var(--h, 0%); min-height: 2px; }
.t-chart-labels { display: flex; gap: 6px; font-size: 10px; color: var(--muted); margin-top: 6px; }
.t-chart-labels span { flex: 1; text-align: center; }

/* ---------- پنل ---------- */

.t-panel { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }

.t-panel-nav {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    position: sticky;
    top: 80px;
}

.t-panel-nav a { display: block; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.t-panel-nav a:hover { background: var(--bg); }
.t-panel-nav a.active { background: var(--brand); color: #fff; }

/* ---------- تبلیغات ---------- */

.t-ads { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 18px; }

.t-ad {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    display: block;
}

.t-ad img { width: 100%; display: block; }
.t-ad-body { padding: 10px 12px; }
.t-ad-tag { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 999px; }

/* ---------- صفحهٔ ورود ---------- */

.t-login { max-width: 400px; margin: 40px auto; }
.t-login .t-card { text-align: center; }
.t-otp-input { text-align: center; letter-spacing: 10px; font-size: 20px; }
.hidden { display: none !important; }

/* ---------- صفحه‌بندی ---------- */

.t-pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.t-pager a, .t-pager span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.t-pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- پابرگ ---------- */

.t-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0; margin-top: 40px; }
.t-footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.t-footer h4 { margin: 0 0 8px; font-size: 14px; }
.t-footer a { display: block; font-size: 13px; color: var(--muted); }

/* ---------- کد ---------- */

.t-code {
    background: #1f2933;
    color: #e3e8ee;
    padding: 14px;
    border-radius: var(--radius);
    font-family: Consolas, monospace;
    font-size: 12px;
    direction: ltr;
    text-align: left;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

@media (max-width: 820px) {
    .t-panel { grid-template-columns: 1fr; }
    .t-panel-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
    .t-header-inner { min-height: auto; padding: 10px 0; }
}
