/* ============================================================
   سامانهٔ حراج شماره — سیستم طراحی
   ترکیب رنگ: سفید / قرمز / مشکی — Bento Grid + Card Based + Dark/Light
   ============================================================ */

:root {
    --red: #e10600;
    --red-dark: #b00500;
    --black: #111114;
    --white: #ffffff;

    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --text: #16161a;
    --text-muted: #6b7280;
    --border: #ececf0;
    --shadow: 0 6px 24px rgba(17, 17, 20, 0.06);
    --shadow-lg: 0 14px 40px rgba(17, 17, 20, 0.10);
    --radius: 18px;
    --radius-sm: 12px;
    --gold: #d4af37;
    --green: #1e9e5a;
    --transition: .25s cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
    --bg: #0d0d10;
    --surface: #17171c;
    --surface-2: #1d1d23;
    --text: #f3f3f5;
    --text-muted: #9ca3af;
    --border: #2a2a31;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main-content { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }

/* ---------------- نوار بالا ---------------- */
.navbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.navbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.brand img { height: 38px; width: auto; }
.brand span { color: var(--red); }
.nav-links { display: flex; gap: 6px; margin-inline-start: 12px; flex: 1; }
.nav-links a {
    padding: 8px 14px; border-radius: 10px; color: var(--text-muted); font-weight: 500;
    transition: var(--transition);
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }
.nav-links .nav-admin { color: var(--red); font-weight: 700; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: .85rem; color: var(--text-muted); }

.online-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 5px 12px; font-size: .8rem; color: var(--text-muted);
}
.online-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
.online-badge b { color: var(--text); }
@keyframes pulse { 0%,100%{opacity:1; transform:scale(1);} 50%{opacity:.4; transform:scale(.8);} }

.theme-toggle {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
    width: 38px; height: 38px; cursor: pointer; font-size: 1.1rem; transition: var(--transition);
}
.theme-toggle:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* ---------------- دکمه‌ها ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; border-radius: 12px; padding: 11px 20px; font-family: inherit;
    font-weight: 700; font-size: .95rem; cursor: pointer; transition: var(--transition);
}
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(225, 6, 0, .3); }
.btn-dark { background: var(--black); color: #fff; }
.btn-dark:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------------- کارت‌ها ---------------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); transition: var(--transition);
}
.card-pad { padding: 20px; }
.card:hover { box-shadow: var(--shadow-lg); }

/* ---------------- Bento Grid ---------------- */
.bento {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px;
}
.bento .b-2 { grid-column: span 2; }
.bento .b-4 { grid-column: span 4; }
.bento-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow); transition: var(--transition); position: relative; overflow: hidden;
}
.bento-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* Hero */
.hero {
    grid-column: span 4;
    background: linear-gradient(135deg, var(--black) 0%, #2a0a0a 55%, var(--red) 130%);
    color: #fff; border: none; padding: 40px 32px;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); margin: 0 0 10px; font-weight: 800; }
.hero p { color: #f0d6d6; margin: 0 0 22px; font-size: 1.05rem; }
.hero .search-box {
    display: flex; gap: 8px; background: rgba(255,255,255,.12); padding: 8px; border-radius: 16px;
    backdrop-filter: blur(6px); max-width: 620px; flex-wrap: wrap;
}
.hero .search-box input {
    flex: 1; min-width: 160px; border: none; border-radius: 10px; padding: 12px 16px;
    font-family: inherit; font-size: 1rem; background: #fff; color: var(--black);
}

/* آمار */
.stat { text-align: center; }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--red); }
.stat .label { color: var(--text-muted); font-size: .9rem; }

/* عناوین بخش */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 34px 0 14px; }
.section-head h2 { font-size: 1.35rem; margin: 0; position: relative; padding-inline-start: 14px; }
.section-head h2::before { content: ""; position: absolute; inset-inline-start: 0; top: 6px; bottom: 6px; width: 5px; background: var(--red); border-radius: 3px; }
.section-head a { color: var(--red); font-size: .9rem; font-weight: 600; }

/* ---------------- کارت شماره/مزایده ---------------- */
.auctions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.auc-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow); transition: var(--transition); display: flex; flex-direction: column; gap: 12px;
}
.auc-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--red) 30%, var(--border)); }
.auc-card.ending { border-color: var(--red); animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 0%,100%{ box-shadow: 0 0 0 0 rgba(225,6,0,.0);} 50%{ box-shadow: 0 0 0 4px rgba(225,6,0,.12);} }

.auc-top { display: flex; align-items: center; justify-content: space-between; }
.phone {
    font-size: 1.5rem; font-weight: 800; letter-spacing: 1px; direction: ltr; text-align: left;
    font-family: 'Vazirmatn', monospace; color: var(--text);
}
.phone.ending { color: var(--red); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
    font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
    background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge-gold { background: #fbf3d6; color: #8a6d09; border-color: #f0e0a8; }
.badge-vip { background: var(--black); color: var(--gold); border-color: var(--black); }
.badge-red { background: #fde2e1; color: var(--red-dark); border-color: #f7c2c0; }
.badge-green { background: #dcf3e6; color: #146c3c; border-color: #b7e3c9; }
[data-theme="dark"] .badge-gold { background: #3a300f; color: #f0d680; }
[data-theme="dark"] .badge-red { background: #3a1110; color: #ff9b97; }
[data-theme="dark"] .badge-green { background: #0f2e1e; color: #7fe0a6; }

.score-pill {
    display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700;
}
.score-pill b { color: var(--red); }

/* نمایش مبلغ: عدد + حروف فارسی زیر آن */
.amount { display: inline-flex; flex-direction: column; line-height: 1.35; vertical-align: middle; }
.amt-num { font-weight: 700; white-space: nowrap; }
.amt-words { font-size: .72rem; color: var(--text-muted); font-weight: 400; }

.price-row { display: flex; justify-content: space-between; align-items: baseline; }
.price-label { font-size: .8rem; color: var(--text-muted); }
.price-val { font-size: 1.15rem; font-weight: 800; }
.price-val.secret { color: var(--text-muted); font-weight: 600; }

/* شمارنده معکوس */
.countdown { display: flex; gap: 6px; justify-content: center; direction: rtl; }
.countdown .seg {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
    padding: 6px 9px; min-width: 44px; text-align: center;
}
.countdown .seg b { display: block; font-size: 1.1rem; font-weight: 800; }
.countdown .seg span { font-size: .65rem; color: var(--text-muted); }
.countdown.ending .seg { border-color: var(--red); color: var(--red); }
.countdown.ended .seg { opacity: .6; }

/* ---------------- جدول ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--border); }
table.tbl th { color: var(--text-muted); font-weight: 700; background: var(--surface-2); }
table.tbl tr:hover td { background: var(--surface-2); }
table.tbl td.ltr { direction: ltr; text-align: left; font-family: monospace; }

/* ---------------- فرم ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .88rem; font-weight: 600; color: var(--text-muted); }
.form-control {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface); color: var(--text); font-family: inherit; font-size: .95rem; transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(225,6,0,.12); }
.form-control[dir="ltr"] { direction: ltr; text-align: left; }

/* ---------------- هشدارها ---------------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-top: 14px; font-size: .9rem; font-weight: 600; }
.alert-success { background: #dcf3e6; color: #146c3c; }
.alert-error { background: #fde2e1; color: var(--red-dark); }
.alert-info { background: #e0eefe; color: #1d4ed8; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 18px; }

/* ---------------- صفحه احراز هویت ---------------- */
.auth-wrap { max-width: 440px; margin: 40px auto; }
.auth-card { padding: 32px; }
.auth-card h1 { font-size: 1.4rem; margin: 0 0 6px; }
.auth-card .sub { color: var(--text-muted); margin: 0 0 22px; font-size: .9rem; }
.otp-input { letter-spacing: 8px; text-align: center; font-size: 1.4rem; direction: ltr; font-weight: 800; }
.dev-code { background: #fff7d6; border: 1px dashed var(--gold); color: #8a6d09; padding: 8px 12px; border-radius: 10px; text-align: center; margin-bottom: 14px; font-size: .85rem; }
[data-theme="dark"] .dev-code { background: #2e2710; }

/* ---------------- جزئیات مزایده ---------------- */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.bid-panel { position: sticky; top: 80px; }
.big-phone { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 800; direction: ltr; text-align: center; letter-spacing: 2px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-muted); font-size: .9rem; }
.kv .v { font-weight: 700; }

/* ---------------- ابزارها ---------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--text-muted); }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.text-red { color: var(--red); } .text-green { color: var(--green); } .bold { font-weight: 800; }
.chip { padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }

/* پاپ‌آپ (Modal) */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200; padding: 16px;
    background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    max-width: 580px; width: 100%; max-height: 85vh; overflow: auto; padding: 24px;
}
.modal-box h3 { margin-top: 0; }
.modal-close {
    float: left; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 10px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; color: var(--text);
}
.terms-text { white-space: pre-line; line-height: 2.1; color: var(--text-muted); font-size: .92rem; }

/* سوالات متداول (آکاردئون) */
.faq-item { border-bottom: 1px solid var(--border); padding: 6px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary { cursor: pointer; font-weight: 700; padding: 12px 4px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--red); font-size: 1.3rem; font-weight: 800; }
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { color: var(--red); }
.faq-answer { padding: 4px 8px 14px; color: var(--text-muted); line-height: 2; }

.footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--text-muted); font-size: .85rem; text-align: center; margin-top: 40px; }
.footer-info { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.footer-info .footer-item b { color: var(--text); }
.footer-info .footer-link { color: var(--red); font-weight: 700; }
.footer-info .footer-link:hover { text-decoration: underline; }

/* ---------------- ریسپانسیو ---------------- */
@media (max-width: 900px) {
    .bento { grid-template-columns: repeat(2, 1fr); }
    .hero, .bento .b-4 { grid-column: span 2; }
    .detail-grid { grid-template-columns: 1fr; }
    .bid-panel { position: static; }
    .form-grid, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .nav-links { display: none; }
    .bento { grid-template-columns: 1fr; }
    .hero, .bento .b-2, .bento .b-4 { grid-column: span 1; }
    .form-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .user-name { display: none; }
    .auctions-grid { grid-template-columns: 1fr; }
}
