﻿/* =============================
   فایل استایل اصلی سایت (عمومی)
   ============================= */

/* ---------------------- متغیرهای تم (رنگ‌ها) ---------------------- */
:root {
    --color-primary: #e50914;
    --color-primary-dark: #c90912;
    --color-accent: #ff4757;
    --surface: #fff6f7;
    --surface-2: #ffe9ec;
    --border: rgba(181,7,16,.18);
    --glow: 0 10px 35px rgba(229,9,20,.20);
    --text-muted: #6b7280;
    --brand: var(--color-primary);
    --brand-dark: var(--color-primary-dark);
    --brand-50: rgba(229,9,20,.10);
    --bg: linear-gradient(180deg, #c40010 0%, #b2060f 40%, #d3121d 100%);
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
}

/* ---------------------- فونت فارسی ---------------------- */
@font-face {
    font-family: 'Vazirmatn FD';
    src: url('/resources/fonts/Vazirmatn FD.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------------------- تنظیمات پایه ---------------------- */
html {
    font-size: 14px;
    scroll-behavior: smooth;
    background: #be0913;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    font-family: 'Vazirmatn FD', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ---------------------- محتوای پست/صفحه ---------------------- */
.content {
    line-height: 2;
    overflow-wrap: anywhere;
}

    .content img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    .content figure {
        margin: 1rem 0;
    }

    .content iframe, .content video {
        max-width: 100%;
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }

    .content table {
        width: 100% !important;
        display: block;
        overflow-x: auto;
        border-collapse: collapse;
    }

    .content pre, .content code {
        white-space: pre-wrap;
        word-break: break-word;
    }

/* ---------------------- فوکوس فرم‌ها ---------------------- */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem rgba(255,255,255,.8), 0 0 0 0.25rem var(--color-primary);
}

/* ---------------------- هدر قهرمان (Hero) ---------------------- */
.hero {
    background: radial-gradient(1000px 400px at 100% -100%, rgba(255,255,255,.08), transparent), linear-gradient(135deg, var(--color-primary), #0f1014);
    color: #000;
    border-radius: 18px;
    box-shadow: var(--glow);
}

/* ---------------------- کارت پست (Post Card) ---------------------- */
.post-card {
    border: 1px solid var(--border);
    background: var(--surface);
}

    .post-card .card-body {
        background: linear-gradient(180deg, rgba(229,9,20,.05), transparent 30%);
    }

    .post-card h5 a {
        color: var(--text);
    }

        .post-card h5 a:hover {
            color: var(--color-primary);
            text-decoration: none;
        }

/* ---------------------- کارت عمومی (Card) ---------------------- */
.card {
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: transform .2s ease, box-shadow .2s ease;
    overflow: hidden;
    background: var(--card);
    color: var(--text);
}

    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 14px 30px rgba(126, 10, 16, .22);
    }

.card-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.card-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
}

/* ---------------------- دکمه‌ها ---------------------- */
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--color-primary-dark);
        border-color: var(--color-primary-dark);
    }

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

    .btn-outline-primary:hover {
        background: var(--color-primary);
        color: #fff;
    }

.btn-outline-light {
    color: #fff !important;
    border-color: rgba(255,255,255,.4) !important;
}

    .btn-outline-light:hover, .btn-outline-light:focus {
        background: rgba(255,255,255,.08) !important;
        color: #fff !important;
    }

/* ---------------------- لینک‌ها ---------------------- */
a {
    text-decoration: none;
    color: #b50710;
}

    a:hover {
        text-decoration: underline;
        color: #8e040c;
    }

/* ---------------------- تیترها ---------------------- */
h3 {
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
    color: #1f2937;
}

    h3::after {
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        width: 60px;
        height: 3px;
        background: var(--color-primary);
        border-radius: 2px;
    }

/* ---------------------- انیمیشن ---------------------- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn .5s ease-out;
}

/* ---------------------- Toast ---------------------- */
.toast-container {
    gap: .5rem;
    display: flex;
    flex-direction: column;
}

/* ---------------------- تنظیمات RTL برای فرم‌ها ---------------------- */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--text-muted);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

html[dir="rtl"] body {
    font-family: "Vazirmatn FD", "IRANSans", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ---------------------- سایدبار اینترانت ---------------------- */
.sidebar {
    position: fixed;
    inset-block: 1;
    border: 2px solid red;
    inset-inline-start: 5;
    width: 50px;
    background: #fff !important;
    border-inline-end: 2px solid red;
    z-index: 1032;
    box-shadow: 12px 0 30px rgba(200,0,0,.25);
    margin-top: 20px;
    border-radius: 16px;
}

    .sidebar, .sidebar * {
        font-size: 20px !important;
    }

        .sidebar .brand {
            height: 64px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            color: #fff;
        }

        .sidebar nav {
            display: flex;
            flex-direction: column;
            gap: .25rem;
            padding: .5rem;
        }

        .sidebar a {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 44px;
            color: #ffe7e7;
            border-radius: .75rem;
            transition: all .15s ease;
            font-weight: 600;
        }

            .sidebar a.active, .sidebar a:hover {
                background: rgba(255,255,255,.15);
                color: #fff;
                box-shadow: 0 6px 14px rgba(229,9,20,.16);
            }

/* ---------------------- نوار جستجو (در اینترانت) ---------------------- */
.searchbar {
    flex: none;
    width: 300px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #1c1f29;
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: .25rem .75rem;
    color: var(--text);
}

    .searchbar input {
        width: 90%;
        min-width: 0;
        background: transparent;
        border: 0;
        color: var(--text);
    }

        .searchbar input:focus {
            outline: none;
            box-shadow: none;
        }

.page-wrap {
    padding-block-start: 92px;
    padding-inline-start: 88px;
    padding-inline-end: 16px;
}

/* ---------------------- ویجت‌ها ---------------------- */
.widget {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: .9rem;
    box-shadow: 0 1px 1px rgba(0,0,0,.25);
}

    .widget .widget-header {
        background: linear-gradient(90deg, rgba(229,9,20,.18), transparent);
        color: #fff;
        padding: .65rem .9rem;
        border-top-left-radius: .9rem;
        border-top-right-radius: .9rem;
        font-weight: 700;
    }

    .widget .widget-body {
        padding: .9rem;
    }

/* ---------------------- گرید لینک‌های سریع ---------------------- */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 12px;
}

.quick-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .5rem;
    border: 1px solid var(--border);
    border-radius: .9rem;
    padding: 16px;
    background: linear-gradient(145deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
    color: var(--text);
    transition: transform .1s ease, box-shadow .2s ease;
}

    .quick-tile .icon {
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        background: var(--brand-50);
        color: var(--brand);
        border-radius: 12px;
        font-size: 20px;
    }

    .quick-tile:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 18px rgba(0,0,0,.28);
    }

/* ---------------------- لیست‌های تمیز ---------------------- */
.list-clean {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .list-clean li {
        padding: .5rem .25rem;
        border-bottom: 1px dashed var(--border);
    }

        .list-clean li:last-child {
            border-bottom: none;
        }

.small-muted {
    color: #6b7280;
    font-size: .85rem;
}

/* ---------------------- کارت سبز (نمونه) ---------------------- */
.card-green {
    border-color: rgba(229,9,20,.25);
}

    .card-green > .card-header {
        background: var(--brand);
        color: #fff;
    }

/* ---------------------- ابزارهای کمکی ---------------------- */
.rtl-flip {
    transform: scaleX(-1);
}

@media (max-width: 1200px) {
    .quick-grid {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .quick-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

/* ---------------------- بنر صفحه اصلی ---------------------- */
.home-banner {
    background: linear-gradient(135deg, rgba(229,9,20,.9), #11131a);
    color: #fff;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    box-shadow: var(--glow);
}

    .home-banner h1 {
        font-size: 2.5rem;
    }

    .home-banner p {
        font-size: 1.25rem;
    }

/* ---------------------- باکس پست (صفحه اصلی) ---------------------- */
.post-box {
    border: 1px solid rgba(181,7,16,.22);
    border-radius: 14px;
    padding: 0;
    margin-bottom: 15px;
    background-color: #fff;
    box-shadow: 0 10px 24px rgba(84,14,18,.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 410px;
}

.post-box {
    border: 1px solid rgba(181,7,16,.22) !important;
}

    .post-box .post-thumbnail {
        width: 100%;
        height: 180px;
        object-fit: fill;
        object-position: center;
        border-radius: 0;
        border-bottom: 1px solid var(--color-primary);
        display: block;
        background: #f3f4f6;
    }

    .post-box .post-content {
        text-align: center;
        padding: 14px 12px 10px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 6px;
    }

    .post-box h3 {
        margin: 0;
        font-size: 1rem;
        line-height: 1.65;
        min-height: calc(1.65em * 2);
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

    .post-box h3, .post-box h3 a {
        color: #111827 !important;
    }

    .post-box .small-muted {
        line-height: 1.5;
        min-height: calc(1.5em * 2);
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

    .post-box p {
        font-size: .80rem;
        line-height: 1.8;
        color: #4b5563;
        margin-bottom: 0;
        min-height: calc(1.8em * 2);
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

@media (max-width: 576px) {
    .post-box {
        height: 100%;
        min-height: 360px;
    }

    .post-box .post-thumbnail {
        height: 160px;
    }
}

/* ---------------------- نوار چسبنده در پایین صفحات ---------------------- */
.sticky-actions {
    position: sticky;
    bottom: 0;
    background: var(--card, #14161d);
    padding-top: .5rem;
    padding-bottom: .5rem;
    border-top: 1px solid var(--border, #e5e7eb);
    z-index: 10;
}

.card .ql-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card);
}

/* ---------------------- نوار اطلاعیه‌ها (News Ticker) ---------------------- */
.news-ticker-container {
    margin-bottom: 1rem;
    width: calc(100% - 24px);
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 16px !important;
    margin: 0 auto;
    background: linear-gradient(90deg, rgba(255,255,255,.26), rgba(255,255,255,.16));
    backdrop-filter: blur(2px);
}

.ticker-content-wrapper {
    display: flex;
    align-items: center;
    overflow: hidden;
    min-height: 48px;
}

.ticker-track {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: ticker-move var(--ticker-duration, 24s) linear infinite;
    --scroll-distance: 50%;
    will-change: transform;
    gap: 0;
    transform: translate3d(0,0,0);
}

    .ticker-track:hover {
        animation-play-state: paused;
    }

.ticker-item {
    display: inline-flex;
    align-items: center;
}

.ticker-link:hover {
    text-decoration: underline !important;
    color: #ffc107 !important;
}

@keyframes ticker-move {
    0% {
        transform: translate3d(calc(-1 * var(--scroll-distance)),0,0);
    }

    100% {
        transform: translate3d(0,0,0);
    }
}

.ticker-inner {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.ticker-item {
    margin-inline-end: 2rem;
    padding-inline-end: 1rem;
}

/* ---------------------- کارت قرمز سایدبارها ---------------------- */
.red-card {
    background: #ffffff !important;
    color: #1f2937 !important;
    border-radius: 16px !important;
    border: 1px solid rgba(181,7,16,.2) !important;
    box-shadow: 0 2px 18px rgba(0,0,0,.10) !important;
    overflow: hidden;
}

    .red-card .card-header {
        background: #c10a14 !important;
        color: #fff !important;
        font-weight: 700;
        border-bottom: 1px solid #fff2;
        font-size: 1.1rem;
    }

    .red-card .card-body {
        background: transparent !important;
        color: #1f2937 !important;
    }

    .red-card .list-group-item {
        background: #fff !important;
        color: #1f2937 !important;
        border: none !important;
    }

    .red-card a {
        color: #000 !important;
        text-decoration: underline;
    }

        .red-card a:hover {
            color: #ffd700 !important;
        }

/* ---------------------- ماشین حساب و ابزارها ---------------------- */
.org-calc-box {
    max-width: 400px;
    margin: auto;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 16px;
}

.calc-display {
    background: #000;
    color: #0f0;
    font-size: 2rem;
    text-align: right;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    direction: ltr;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

    .calc-buttons button {
        padding: 18px;
        font-size: 1.2rem;
        border: none;
        background: #e9ecef;
        border-radius: 10px;
        transition: 0.1s;
    }

        .calc-buttons button:hover {
            background: #d1d1d1;
        }

.btn-op {
    background: #ffd966;
}

.btn-eq {
    background: #91ccff;
}

.btn-zero {
    grid-column: span 2;
}

.unit-convert input {
    font-size: 1.1rem;
    padding: 10px;
}

/* ---------------------- ریسپانسیو عمومی ---------------------- */
@media (max-width: 991.98px) {
    .page-wrap .row.g-3 > [class^="col-"] {
        order: initial;
    }

    .sidebar {
        inset-block-start: auto;
        inset-block-end: 0;
        width: 100%;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-inline-end: 0;
        border-top: 1px solid var(--border);
        box-shadow: 0 -6px 18px rgba(0,0,0,.32);
    }

        .sidebar .brand {
            display: none;
        }

        .sidebar nav {
            flex-direction: row;
            justify-content: space-around;
            width: 100%;
        }

        .sidebar a {
            flex: 1;
            height: 48px;
            border-radius: 12px;
        }

    .page-wrap {
        padding-inline-start: 16px;
        padding-inline-end: 16px;
        padding-block-start: 96px;
        padding-block-end: 80px;
    }

    .news-ticker-container {
        width: 100%;
    }
}

@media (max-width: 576px) {
    body {
        font-size: 14px;
    }

    .quick-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .searchbar {
        width: 100%;
    }

    .post-box {
        height: 100%;
        min-height: 360px;
    }
}

/* Responsive posts grid using CSS grid auto-fit */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.post-item {
    display: flex;
}

/* Ensure post-box fills the flex item */
.post-item .post-box {
    display: flex;
    flex-direction: column;
}

@media (min-width: 1200px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 600px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* ---------------------- خوانایی متن روی زمینه قرمز ---------------------- */
.bg-danger,
.bg-primary,
.btn-danger,
.btn-primary,
.badge.bg-danger,
.badge.bg-primary,
.red-card .card-header,
.forum-telegram .card-header,
.home-banner {
    color: #fff !important;
}

.bg-danger a,
.bg-primary a,
.btn-danger a,
.btn-primary a,
.red-card .card-header a,
.forum-telegram .card-header a,
.home-banner a {
    color: #fff !important;
}

.bg-danger a:hover,
.bg-primary a:hover,
.btn-danger a:hover,
.btn-primary a:hover,
.red-card .card-header a:hover,
.forum-telegram .card-header a:hover,
.home-banner a:hover {
    color: #fff !important;
    opacity: .9;
}

/* Page-level titles: make them white on dark backgrounds */
.container h1,
.container h2,
.container h3,
.page-header-box h1,
.home-banner h1 {
    color: #fff !important;
}

/* Also ensure small subtitles under titles are readable */
.container .text-muted,
.page-header-box p,
.container small.text-muted {
    color: rgba(255,255,255,0.85) !important;
}

/* ---------------------- دکمه‌های بازگشت (متن سفید) ---------------------- */
.btn-outline-secondary {
    color: #fff !important;
    border-color: rgba(255,255,255,.35) !important;
    background: transparent !important;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.5) !important;
}

/* در صورتی که کلاس اختصاصی برای دکمه بازگشت استفاده شده باشد */
.back-button { color: #fff !important; }

/* ---------------------- اصلاح متن در بخش شرح محاسبه (Retirement) ---------------------- */
/* اگر عنصری همزمان دارای bg-light و text-muted باشد، رنگ متن تیره می‌شود تا روی پس‌زمینه سفید خوانا باشد */
.bg-light.text-muted {
    color: #111827 !important;
}

/* همچنین درون کارت‌های با پس‌زمینه روشن اگر text-muted استفاده شد، متن تیره نمایش داده شود */
.card .bg-light.text-muted,
.card .text-muted.bg-light {
    color: #111827 !important;
}
