/* ===== استایل پروژه تنکا (toneka.ir) — RTL ===== */

/* --- متغیرهای CSS --- */
:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --secondary: #6c757d;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --radius: 12px;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    --transition: all 0.25s ease;
    --font: "Vazirmatn", "Tahoma", "Segoe UI", sans-serif;
}

/* --- ریست پایه --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    direction: rtl;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

h1, h2, h3 { margin-bottom: 0.75rem; font-weight: 700; }
h2 { margin-top: 2rem; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* --- نوار بالا (Navbar) --- */
.navbar {
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.nav-links { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.nav-links a { color: var(--text); font-weight: 500; }
.nav-links a:hover { color: var(--primary); }
.nav-links .nav-admin-link { color: var(--danger); font-weight: 700; }
.nav-links .nav-admin-link:hover { color: #a71d2a; }

/* --- بخش قهرمان (Hero) --- */
.hero {
    background: linear-gradient(135deg, var(--primary), #6610f2);
    color: #fff;
    text-align: center;
    padding: 4.5rem 1.5rem;
    margin-bottom: 0.8rem;
}

.hero h1 { font-size: 2.4rem; margin-bottom: 0.8rem; }
.hero p { max-width: 640px; margin: 0 auto 1.6rem; font-size: 1.1rem; opacity: 0.92; }

/* --- کارت‌ها --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.4rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.8rem;
    text-align: center;
    transition: var(--transition);
}

.card:hover { transform: translateY(-5px); }
.card-icon { font-size: 2.4rem; margin-bottom: 0.6rem; }

/* --- کارت‌های آماری داشبورد --- */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    margin: 1.4rem 0;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 0.95rem; }

.stats-section { margin-top: 1rem; }

/* --- کارت ادمین در داشبورد --- */
.admin-card {
    background: linear-gradient(135deg, #1b2430, #2c3a4d);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem 1.8rem;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-card h3 { color: #ffc107; margin: 0; }
.admin-card p { margin: 0.3rem 0 0; color: #cbd5e1; font-size: 0.95rem; }
.admin-card .btn { margin: 0; }
.btn-warning { background: var(--warning); color: #212529; }
.btn-warning:hover { background: #e0a800; color: #212529; }

/* --- دکمه‌ها --- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.1rem; }

/* --- فرم‌ها --- */
.form-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 520px;
    margin: 2.5rem auto;
}

.filter-form {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.filter-form label { font-size: 0.9rem; color: var(--text-muted); }

label { display: block; margin: 0.8rem 0 0.3rem; font-weight: 600; }

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 1rem;
    background: #fff;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.filter-form input, .filter-form select { width: auto; min-width: 160px; }

form .btn { margin-top: 1.2rem; width: auto; }
.form-card form .btn { width: 100%; }
.form-note { margin-top: 1rem; text-align: center; color: var(--text-muted); }

/* --- جدول‌ها --- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 1rem;
}

.table th, .table td {
    padding: 0.8rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.table th { background: #f0f4f8; font-weight: 700; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8faff; }

/* --- جدول مدیریت کاربران (ادمین) --- */
.admin-table-wrap { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 1rem;
}

.admin-table th, .admin-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table th { background: #1b2430; color: #fff; font-weight: 700; }
.admin-table tbody tr:nth-child(even) { background: #f6f8fb; }
.admin-table tbody tr:nth-child(odd) { background: #ffffff; }
.admin-table tbody tr:hover { background: #eef4ff; }
.admin-table td.num { text-align: center; }

.phone-ltr {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
    text-align: left;
    min-width: 8.5em;
    font-family: "Tahoma", monospace;
    letter-spacing: 0.03em;
}

.role-admin { color: var(--danger); font-weight: 700; }
.role-user  { color: var(--text-muted); }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.page-header h1 { margin: 0; }

/* --- نشان‌های وضعیت (Badges) --- */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pending     { background: #fff3cd; color: #856404; }
.badge-in_progress { background: #cfe2ff; color: #084298; }
.badge-resolved    { background: #d1e7dd; color: #0f5132; }

/* --- هشدارها (Alerts) --- */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-right: 4px solid transparent;
}

.alert p { margin: 0.15rem 0; }
.alert-error { background: #f8d7da; border-right-color: var(--danger); color: #842029; }
.alert-info  { background: #cff4fc; border-right-color: var(--info); color: #055160; }
.alert-success { background: #d1e7dd; border-right-color: var(--success); color: #0f5132; }
.alert-success h2 { color: #0f5132; margin-top: 0; }

/* --- فوتر --- */
.footer {
    background: #1b2430;
    color: #cbd5e1;
    text-align: center;
    padding: 1.6rem 1rem;
    margin-top: 3rem;
}

/* --- واکنش‌گرایی --- */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.7rem; }
    .navbar { flex-direction: column; align-items: flex-start; }
    .nav-links { justify-content: flex-start; }
    .table, .admin-table { display: block; overflow-x: auto; }
    .form-card { padding: 1.3rem; margin: 1.5rem auto; }
    .admin-card { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .cards-grid, .dashboard-cards { grid-template-columns: 1fr; }
    .filter-form { flex-direction: column; align-items: stretch; }
    .filter-form input, .filter-form select { width: 100%; }
}


/* ================== افزوده‌های ویژگی‌های ۱ تا ۵ ================== */

/* --- نشان‌های زمانی ۲۴ / ۴۸ / ۷۲ ساعت --- */
.badge-24 {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #d1e7dd;
    color: #0f5132;
}

.badge-48 {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #fff3cd;
    color: #856404;
}

.badge-72 {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #f8d7da;
    color: #842029;
    animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

/* --- جعبه هشدار شمارنده گزارش‌های عقب‌افتاده --- */
.counter-box {
    background: #fff8f0;
    border: 2px solid #f0a04b;
    border-right: 8px solid var(--danger, #dc3545);
    border-radius: var(--radius, 10px);
    color: #842029;
    padding: 1.2rem 1.5rem;
    margin: 1.5rem 0;
    font-weight: 700;
    font-size: 1.05rem;
    box-shadow: 0 4px 14px rgba(220, 53, 69, 0.15);
}
.counter-box strong { font-size: 1.3rem; color: #dc3545; }

/* --- دکمه‌های اشتراک‌گذاری --- */
.share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.95rem;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.share-btn:hover { opacity: 0.85; transform: translateY(-2px); }

.share-wa { background: #25d366; }
.share-tg { background: #229ed9; }

/* --- دکمه دریافت پوستر --- */
.poster-btn {
    display: inline-block;
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: #fff;
    padding: 0.6rem 1.3rem;
    border: none;
    border-radius: var(--radius, 10px);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.poster-btn:hover { box-shadow: 0 6px 16px rgba(58, 12, 163, 0.35); transform: translateY(-2px); }

/* --- نمایشگاه گزارش‌های حل‌شده --- */
.resolved-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}

.resolved-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    overflow: hidden;
    box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.06));
    transition: transform 0.2s ease;
}
.resolved-card:hover { transform: translateY(-4px); }
.resolved-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.resolved-card .resolved-body { padding: 0.9rem 1rem; }
.resolved-card h3 { margin: 0 0 0.4rem; font-size: 1rem; }

/* --- نام کاربر با ارسال ناشناس --- */
.anon-name {
    font-style: italic;
    color: var(--text-muted, #64748b);
    background: #f1f5f9;
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* --- صفحه نمایش عمومی گزارش --- */
.report-view-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.06));
    padding: 1.5rem;
    margin: 1.5rem auto;
    max-width: 820px;
}

.report-view-img {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border, #e2e8f0);
    display: block;
    margin: 1rem 0;
}

/* --- کارت گزارش در پنل ادمین --- */
.admin-report-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.06));
    padding: 1.2rem;
    margin: 1rem 0;
}
.admin-report-card h3 { margin-top: 0; }

/* --- فرم خطی ادمین --- */
.admin-inline-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
    padding: 0.7rem;
    background: #f8fafc;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
}
.admin-inline-form select,
.admin-inline-form input[type="file"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border, #cbd5e1);
    border-radius: 6px;
    font-family: inherit;
}


/* ===== ویژگی‌های جدید تنکا: اسلایدر قبل/بعد، جدول کارما، ویجت منطقه‌ای، وضعیت آفلاین ===== */

/* --- اسلایدر مقایسه قبل/بعد --- */
.ba-slider {
    position: relative;
    max-width: 720px;
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow);
    user-select: none;
    touch-action: none;
}
.ba-slider img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}
.ba-after-wrap {
    position: absolute;
    inset: 0;
    width: 50%;
    overflow: hidden;
}
.ba-after-wrap img {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: auto;
    min-width: 100%;
    max-width: none;
    object-fit: cover;
}
.ba-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 50%;
    width: 4px;
    background: #fff;
    cursor: ew-resize;
    box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.ba-handle::after {
    content: "⟷";
    position: absolute;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
    background: #fff;
    color: #0d6efd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.ba-label {
    position: absolute;
    top: 0.6rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 0.15rem 0.7rem;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none;
}
.ba-label.before { right: 0.6rem; }
.ba-label.after { left: 0.6rem; }

/* --- جدول برترین‌های کارما --- */
.karma-leaderboard {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow);
    padding: 1rem 1.2rem;
    margin: 1rem 0;
}
.karma-leaderboard ol {
    list-style: none;
    counter-reset: karma;
    margin: 0;
    padding: 0;
}
.karma-leaderboard li {
    counter-increment: karma;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--border, #e2e8f0);
}
.karma-leaderboard li:last-child { border-bottom: none; }
.karma-leaderboard li::before {
    content: counter(karma);
    background: var(--primary, #0d6efd);
    color: #fff;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}
.karma-leaderboard li:first-child::before { background: #f0a500; }
.karma-rank-name { flex: 1; font-weight: 600; }
.karma-points {
    background: #e7f1ff;
    color: var(--primary-dark, #0a58ca);
    padding: 0.1rem 0.7rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}
.karma-medal { font-size: 1.1rem; }

/* --- ویجت گزارش‌های منطقه‌ای --- */
.region-widget {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow);
    padding: 1rem 1.2rem;
    margin: 1rem 0;
}
.region-widget h3 { margin-top: 0; font-size: 1.05rem; }
.region-widget ul { list-style: none; margin: 0; padding: 0; }
.region-widget li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px dashed var(--border, #e2e8f0);
}
.region-widget li:last-child { border-bottom: none; }
.region-name { font-weight: 600; }
.region-count {
    background: #f1f5f9;
    border-radius: 20px;
    padding: 0.05rem 0.7rem;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
}
.region-bar {
    height: 8px;
    background: #eef2f7;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.6rem;
}
.region-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #0d6efd), #0dcaf0);
    border-radius: 4px;
}

/* --- نشان وضعیت آفلاین PWA --- */
.offline-badge {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 9999;
    background: var(--warning, #ffc107);
    color: #212529;
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    display: none;
}
body.is-offline .offline-badge { display: block; }

/* --- باکس انتخاب فایل با GPS --- */
.gps-note {
    font-size: 0.85rem;
    color: var(--success, #198754);
    background: #eaf7f0;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    margin-top: 0.4rem;
}

@media (max-width: 600px) {
    .ba-handle::after { width: 32px; height: 32px; font-size: 0.9rem; }
    .karma-leaderboard, .region-widget { padding: 0.8rem; }
}
