/* assets/css/forms.css — کنترل‌های فرم مشترک بین سایت و پنل */
/* ==========================================================
   چک‌باکس‌ها و رادیوهای سفارشی (یکدست در سایت و پنل)
   ========================================================== */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 0;
    border: 1.8px solid var(--border-color, #cbd5e1);
    border-radius: 6px;
    background: var(--bg-primary, #fff);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .12s ease;
    vertical-align: middle;
    flex: 0 0 auto;
}
input[type="radio"] {
    border-radius: 50%;
}
input[type="checkbox"]:hover,
input[type="radio"]:hover {
    border-color: var(--primary, #6366f1);
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: none;
    border-color: var(--primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .22);
}
input[type="checkbox"]::after {
    content: "";
    width: 11px;
    height: 6px;
    border-left: 2.4px solid #fff;
    border-bottom: 2.4px solid #fff;
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform .16s cubic-bezier(.35, 1.6, .6, 1);
    margin-top: -2px;
}
input[type="checkbox"]:checked {
    background: var(--brand-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    border-color: transparent;
}
input[type="checkbox"]:checked::after {
    transform: rotate(-45deg) scale(1);
}
input[type="checkbox"]:indeterminate {
    background: var(--primary, #6366f1);
    border-color: transparent;
}
input[type="checkbox"]:indeterminate::after {
    content: "";
    width: 10px;
    height: 2.4px;
    background: #fff;
    border: 0;
    transform: none;
    margin: 0;
}
input[type="radio"]::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    transform: scale(0);
    transition: transform .16s ease;
}
input[type="radio"]:checked {
    background: var(--brand-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    border-color: transparent;
}
input[type="radio"]:checked::after {
    transform: scale(1);
}

/* برچسب‌های انتخاب‌شدنی (تگ‌ها، تیک‌ها، گزینه‌های فرم) */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background: var(--bg-primary, #fff);
    cursor: pointer;
    font-size: 13.5px;
    line-height: 1.7;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
    user-select: none;
    max-width: 100%;
}
.checkbox-label:hover {
    border-color: var(--primary, #6366f1);
    padding: inherit;
}
.checkbox-label:has(input:checked) {
    border-color: var(--primary, #6366f1);
    background: rgba(99, 102, 241, .08);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, .18) inset;
}
.checkbox-label span {
    line-height: 1.7;
}
.tag-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 999px;
    background: var(--bg-primary, #fff);
    cursor: pointer;
    font-size: 13px;
    transition: all .18s ease;
    user-select: none;
}
.tag-checkbox:hover {
    border-color: var(--primary, #6366f1);
}
.tag-checkbox input[type="checkbox"] {
    width: 17px;
    height: 17px;
    min-width: 17px;
    border-radius: 5px;
}
.tag-checkbox:has(input:checked) {
    border-color: var(--primary, #6366f1);
    background: rgba(99, 102, 241, .1);
    color: var(--primary, #6366f1);
    font-weight: 600;
}
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ==========================================================
   جدول‌ها در متن مقاله — خوانا، اسکرول‌پذیر و یکدست
   ========================================================== */
.post-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 1.6em 0;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-primary, #fff);
}
.post-table-wrap::-webkit-scrollbar {
    height: 8px;
}
.post-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, .35);
    border-radius: 999px;
}
.post-table-wrap > table {
    margin: 0 !important;
    border: 0 !important;
    border-collapse: collapse;
    width: 100%;
    min-width: 480px;
    font-size: 13.8px;
    line-height: 1.9;
}
.post-body .post-table-wrap th {
    background: var(--bg-secondary, #f1f5f9);
    font-weight: 700;
    white-space: nowrap;
}
.post-body .post-table-wrap th,
.post-body .post-table-wrap td {
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    text-align: right;
    vertical-align: top;
}
.post-body .post-table-wrap tr:last-child td {
    border-bottom: 0;
}
.post-body .post-table-wrap tbody tr:nth-child(even) {
    background: var(--bg-secondary, #f8fafc);
}
.post-body .post-table-wrap tbody tr:hover {
    background: rgba(99, 102, 241, .06);
}
[data-theme="dark"] .post-body .post-table-wrap th {
    background: #1e293b;
}
[data-theme="dark"] .post-body .post-table-wrap tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, .08);
}
.post-body figure {
    max-width: 100%;
    margin: 1.6em 0;
}
.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
}
.post-body blockquote {
    margin: 1.5em 0;
    padding: 12px 18px;
    border-right: 4px solid var(--primary, #6366f1);
    background: var(--bg-secondary, #f8fafc);
    border-radius: 10px;
}

/* ---------- ورودی فایل‌ها (تصویر شاخص، صوت، آواتار) ---------- */
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px dashed var(--border-color, #cbd5e1);
    border-radius: 12px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-secondary, #64748b);
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
}
input[type="file"]:hover {
    border-color: var(--primary, #6366f1);
}
input[type="file"]:focus-visible {
    outline: none;
    border-color: var(--primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}
input[type="file"]::file-selector-button {
    margin-left: 12px;
    padding: 8px 16px;
    border: 0;
    border-radius: 9px;
    background: var(--brand-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    color: #fff;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .18s ease, transform .18s ease;
}
input[type="file"]::file-selector-button:hover {
    opacity: .92;
    transform: translateY(-1px);
}

/* ---------- فیلدهای فرم: حالت تمرکز و خطا ---------- */
.glass-input:focus,
textarea.glass-input:focus,
select.glass-input:focus {
    border-color: var(--primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
    outline: none;
}
.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    line-height: 1.8;
    color: var(--text-secondary, #64748b);
}
