/* ============================================================
   سامانه رأی‌گیری — سیستم طراحی
   پالت: سبز یشمی #2D6A4F / سبز روشن #95D5B2 / زرد گرم #FFD166
          خاکستری #6C757D / سفید #FFFFFF
   فونت: وزیرمتن
   ============================================================ */

:root {
    --jade: #2D6A4F;         /* سبز یشمی */
    --jade-dark: #1F4D39;    /* یشمی تیره (هاور) */
    --jade-2: #3A8265;       /* یشمی روشن‌تر */
    --green-light: #95D5B2;  /* سبز روشن */
    --green-pale: #E9F5EE;   /* تینت خیلی روشن از سبز */
    --yellow: #FFD166;       /* زرد گرم */
    --gray: #6C757D;         /* خاکستری */
    --paper: #FFFFFF;        /* زمینه */
    --surface: #F7FAF8;      /* سطح ملایم برای تمایز کارت */
    --ink: #26312B;          /* متن */
    --line: #DFE7E2;
}

body {
    font-family: "Vazirmatn", Tahoma, sans-serif;
    background-color: var(--surface);
    color: var(--ink);
}

h1, h2, h3, h4, h5 { font-weight: 700; color: var(--jade); }

/* ---------- نوار کاشی شمسه (امضای بصری) ---------- */
.tile-band {
    height: 14px;
    background-color: var(--jade);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M7 0l2 5 5 2-5 2-2 5-2-5-5-2 5-2zM21 0l2 5 5 2-5 2-2 5-2-5-5-2 5-2z' fill='%2395D5B2' fill-opacity='0.65'/%3E%3C/svg%3E");
    border-radius: 12px 12px 0 0;
}

/* ---------- دکمه‌ها ---------- */
.btn-primary {
    --bs-btn-bg: var(--jade);
    --bs-btn-border-color: var(--jade);
    --bs-btn-hover-bg: var(--jade-dark);
    --bs-btn-hover-border-color: var(--jade-dark);
    --bs-btn-active-bg: var(--jade-dark);
    --bs-btn-active-border-color: var(--jade-dark);
    font-weight: 600;
}
.btn-dark {
    --bs-btn-bg: var(--jade);
    --bs-btn-border-color: var(--jade);
    --bs-btn-hover-bg: var(--jade-dark);
    --bs-btn-hover-border-color: var(--jade-dark);
}
.btn { border-radius: 10px; }
.btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- کارت‌ها ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(45, 106, 79, 0.06);
}
.card-header {
    background-color: #fff;
    border-bottom: 2px solid var(--green-pale);
    color: var(--jade);
}

/* ---------- کارت ورود ---------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(149, 213, 178, 0.28), transparent 60%),
        radial-gradient(900px 500px at 10% 110%, rgba(255, 209, 102, 0.18), transparent 55%),
        var(--jade);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
.login-card .inner { padding: 2rem 2rem 2.25rem; }
.login-logo {
    width: 64px; height: 64px;
    margin: 0 auto 0.75rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--green-pale);
    border-radius: 50%;
    color: var(--jade);
}

/* لوگوی شناور روی نوار کاشی */
.brand-logo-wrap {
    width: 104px; height: 104px;
    margin: -52px auto 0.75rem;   /* نصف ارتفاع روی نوار کاشی می‌نشیند */
    background: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(45, 106, 79, 0.25), 0 0 0 5px var(--green-pale);
    position: relative;
    z-index: 2;
}
.brand-logo-wrap img {
    width: 62%;
    height: auto;
}
.login-card .tile-band { height: 64px; border-radius: 12px 12px 0 0; }

/* ---------- فرم‌ها ---------- */
.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--line);
    padding: 0.6rem 0.9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--jade);
    box-shadow: 0 0 0 0.2rem rgba(45, 106, 79, 0.15);
}
.form-label { font-weight: 600; color: var(--jade); }

/* ---------- صفحه رأی‌گیری ---------- */
.vote-shell { max-width: 760px; margin: 0 auto; }
.vote-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 6px 24px rgba(45, 106, 79, 0.08);
    overflow: hidden;
}
.vote-card .inner { padding: 1.75rem; }

.progress { border-radius: 99px; background-color: #E7EEE9; }
.progress-bar {
    background: linear-gradient(90deg, var(--green-light), var(--jade));
    border-radius: 99px;
}
.step-label { color: var(--jade-2); font-weight: 600; font-size: 0.9rem; }

/* کارت کاندیدا */
.candidate-card {
    border: 2px solid var(--line);
    border-radius: 12px;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
    position: relative;
}
.candidate-card:hover {
    border-color: var(--green-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(45, 106, 79, 0.15);
}
.candidate-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
}
.candidate-card input[type="checkbox"] {
    position: absolute;
    top: 10px; inset-inline-start: 10px;
    width: 1.25rem; height: 1.25rem;
    accent-color: var(--jade);
}
.candidate-card:has(input:checked) {
    border-color: var(--jade);
    background: var(--green-pale);
    box-shadow: 0 0 0 3px rgba(149, 213, 178, 0.45);
}

/* دکمه‌های موافق/مخالف */
.btn-agree {
    --bs-btn-bg: var(--jade);
    --bs-btn-border-color: var(--jade);
    --bs-btn-hover-bg: var(--jade-dark);
    --bs-btn-hover-border-color: var(--jade-dark);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    font-weight: 700;
}
.btn-disagree {
    --bs-btn-bg: #fff;
    --bs-btn-color: var(--gray);
    --bs-btn-border-color: var(--gray);
    --bs-btn-hover-bg: var(--gray);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: var(--gray);
    font-weight: 700;
}

.question-image img {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
}

/* ---------- پنل مدیریت ---------- */
.admin-topbar {
    background: var(--jade) !important;
}
.admin-topbar .navbar-brand { font-weight: 700; }

.admin-sidebar {
    background: #fff;
    border-inline-end: 1px solid var(--line);
    min-height: calc(100vh - 56px);
    padding-top: 1rem;
}
.admin-sidebar .nav-link {
    color: var(--ink);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    font-weight: 500;
    display: flex; align-items: center; gap: .55rem;
}
.admin-sidebar .nav-link:hover { background: var(--green-pale); color: var(--jade); }
.admin-sidebar .nav-link.active {
    background: var(--jade);
    color: #fff;
}
.admin-sidebar .nav-link .bi { font-size: 1.05rem; }

/* کارت‌های آماری داشبورد */
.stat-card {
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 1.1rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0; top: 0; bottom: 0;
    width: 5px;
    background: var(--accent, var(--jade));
}
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--jade); line-height: 1.2; }
.stat-card .lbl { color: var(--gray); font-size: 0.88rem; }

/* جدول‌ها */
.table {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.table thead th {
    background: var(--jade);
    color: #fff;
    font-weight: 600;
    border: none;
    white-space: nowrap;
}
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: #F8FBF9; }
.table td { vertical-align: middle; }

/* نشان‌های وضعیت */
.badge { font-weight: 600; padding: 0.45em 0.8em; border-radius: 99px; }
.badge.bg-success { background-color: var(--jade) !important; }
.badge.bg-warning { background-color: var(--yellow) !important; color: #5C4A12 !important; }
.badge.bg-secondary { background-color: var(--gray) !important; }

/* هشدارها */
.alert { border-radius: 10px; }
.alert-success { background: var(--green-pale); border-color: var(--green-light); color: var(--jade-dark); }
.alert-info { background: #FFF7E2; border-color: var(--yellow); color: #6B5613; }

/* ---------- دکمه‌ی ورود به تالار گفتگو ---------- */
.chat-entry-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    width: 100%;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 14px;
    background: var(--jade);
    border: 2px solid var(--green-light);
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(45, 106, 79, 0.28);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.chat-entry-btn:hover {
    color: #fff;
    background: var(--jade-dark);
    border-color: var(--green-light);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(45, 106, 79, 0.36);
}
.chat-entry-btn .bi { font-size: 1.2rem; }

/* ---------- تالار گفتگوی آنلاین (صفحه‌ی کامل) ---------- */
.chat-room-shell { max-width: 720px; margin: 0 auto; }
.chat-room {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(45, 106, 79, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: min(72vh, 640px);
}
.chat-room-header {
    background: linear-gradient(135deg, var(--jade), var(--jade-2));
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-room-header h5 { color: #fff; margin: 0; font-weight: 700; }
.chat-room-header .back-link {
    background: var(--green-light);
    color: var(--jade-dark);
    border: 2px solid #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    display: flex; align-items: center; gap: .35rem;
    transition: transform .15s ease, box-shadow .15s ease;
}
.chat-room-header .back-link:hover {
    color: var(--jade-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.chat-room-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.chat-bubble-row { display: flex; flex-direction: column; max-width: 78%; }
.chat-bubble-row.other { align-items: flex-start; align-self: flex-start; }
.chat-bubble-row.mine { align-items: flex-end; align-self: flex-end; }

.chat-bubble-meta {
    font-size: 0.72rem;
    color: var(--gray);
    margin-bottom: 3px;
    padding: 0 0.3rem;
}
.chat-bubble {
    padding: 0.6rem 0.95rem;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.chat-bubble-row.other .chat-bubble {
    background: #fff;
    border: 1px solid var(--line);
    border-start-start-radius: 4px;
}
.chat-bubble-row.mine .chat-bubble {
    background: var(--jade);
    color: #fff;
    border-start-end-radius: 4px;
}
.chat-bubble-row.admin {
    align-items: center;
    align-self: center;
    max-width: 92%;
}
.chat-bubble-row.admin .chat-bubble {
    background: #FFF7E2;
    border: 1px solid var(--yellow);
    color: #6B5613;
    font-weight: 600;
    border-radius: 16px;
}

.chat-room-footer {
    display: flex;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--line);
    background: #fff;
}
.chat-room-footer .form-control { border-radius: 24px; padding: 0.65rem 1.1rem; }
.chat-room-footer .btn {
    border-radius: 50%;
    width: 48px; height: 48px;
    padding: 0;
    flex-shrink: 0;
    font-size: 1.1rem;
}

/* حرکت ملایم ورود کارت‌ها */
@media (prefers-reduced-motion: no-preference) {
    .vote-card, .login-card { animation: rise .35s ease both; }
    @keyframes rise {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }
}
