/* =========================================================
   ۱. فراخوانی فونت استاندارد وزیرمتن و تنظیمات پایه‌ای (RTL)
========================================================= */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* اعمال اجباری فونت روی تمام بخش‌های پرسشنامه */
body, div, p, span, h1, h2, h3, h4, h5, h6, label, input, button, select, textarea, .question-text, .answer-text, .navbar, .progress-text {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
    direction: rtl !important;
}

/* پس‌زمینه اصلی تم تاریک مدرن همراه با افکت‌های نوری شناور */
body, .default-theme, #skel-container {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    line-height: 1.5 !important;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
}

body::before, body::after {
    content: '';
    position: fixed;
    filter: blur(90px);
    border-radius: 50%;
    animation: float 10s infinite ease-in-out alternate;
    z-index: -1;
    opacity: 0.35;
}

body::before {
    width: 320px; height: 320px;
    background: #4f46e5;
    top: -50px; right: -50px;
}

body::after {
    width: 380px; height: 380px;
    background: #06b6d4;
    bottom: -80px; left: -80px;
    animation-delay: -3s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, 40px) scale(1.1); }
    100% { transform: translate(-20px, 20px) scale(0.95); }
}

/* =========================================================
   ۲. سایز و فاصله تیترها و گروه‌ها
========================================================= */
.survey-name, .survey-name h1, .title-text {
    font-size: 26px !important;
    line-height: 1.6 !important;
    color: #f8fafc !important;
    text-align: center !important;
    width: 100% !important;
}

.group-title, .group-name, .group-title h2 {
    font-size: 22px !important;
    font-weight: bold !important;
    margin-bottom: 5px !important;
    padding-bottom: 0 !important;
    color: #f1f5f9 !important;
    text-align: center !important;
    width: 100% !important;
}

@media (max-width: 991px) {
    .survey-name, .survey-name h1, .title-text {
        font-size: 20px !important;
    }
    .group-title, .group-name, .group-title h2 {
        font-size: 18px !important;
    }
}

.group-description, .group-description-container {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.group-description p:first-child {
    margin-top: 5px !important;
}

/* =========================================================
   ۳. اصلاح رنگ متن‌ها و راهنماها برای تم تاریک
========================================================= */
.question-text, .ls-questiontext, .ls-questiontext p {
    color: #ffffff !important;
    font-weight: bold !important;
    direction: rtl !important;
    unicode-bidi: isolate !important;
}

.answer-text, .ls-answers td, label {
    color: #f8fafc !important;
}

/* متن‌های راهنما و خطاهای اعتبارسنجی لایمسروی */
.help-block, .ls-question-help, .question-help, .text-info, .text-muted, small,
.ls-em-tip, .em_default, .em_num_answers, .ls-question-valid-message, .validation-message {
    color: #38bdf8 !important;
    font-weight: 500 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
}

.asterisk, .mandatory, .ls-mandatory {
    color: #c084fc !important;
    font-weight: bold !important;
}

/* =========================================================
   ۴. کادرهای شیشه‌ای (Glassmorphism Cards)
========================================================= */
.question-container {
    background: rgba(30, 41, 59, 0.45) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
    /* کاهش حاشیه داخلی (Padding) برای نزدیک‌تر شدن محتوا به لبه‌ها */
    padding: 16px 20px !important; 
    /* تنظیم عرض به 100% برای پر کردن فضای کادر اصلی */
    width: 100% !important; 
    max-width: 100% !important; 
    margin-bottom: 20px !important;
    overflow: visible !important;
    contain: none !important;
    position: relative !important;
    z-index: 1 !important;
    box-sizing: border-box !important;
}

@media (max-width: 991px) {
    .container, .container-fluid {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .question-container, .group-container {
        /* در موبایل نیز عرض به صورت کامل (100%) در نظر گرفته می‌شود */
        width: 100% !important; 
        max-width: 100% !important; 
        margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 18px !important;
        box-sizing: border-box !important;
        /* حاشیه داخلی کمتر در موبایل */
        padding: 14px 12px !important; 
        border-radius: 14px !important;
    }
}

.question-container:focus-within, 
.question-container:hover {
    z-index: 100 !important;
}

.answer-container, .group-container {
    overflow: visible !important;
    contain: none !important;
}

/* =========================================================
   ۵. دکمه‌ها، نوار پیشرفت و متغیرها
========================================================= */
.btn, .btn-primary, .btn-default, .btn-secondary, #ls-button-previous, #ls-button-submit, .ls-move-prev-btn, .ls-move-next-btn {
    border-radius: 10px !important;
    padding: 10px 22px !important;
    font-weight: 600 !important;
    transition: all 0.25s ease !important;
    outline: none !important;
}

.btn-primary, button[value="movenext"], #ls-button-submit, .ls-move-next-btn {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3) !important;
}

.btn-primary:hover, .btn-primary:focus, button[value="movenext"]:hover, .ls-move-next-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%) !important;
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5) !important;
    transform: translateY(-2px) !important;
    color: #ffffff !important;
}

.btn-default, .btn-secondary, #ls-button-previous, .ls-move-prev-btn, button[value="moveprev"] {
    background: rgba(30, 41, 59, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #f8fafc !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.btn-default:hover, .btn-default:focus, .btn-secondary:hover, #ls-button-previous:hover, #ls-button-previous:focus, .ls-move-prev-btn:hover, button[value="moveprev"]:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: #a855f7 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.25) !important;
    transform: translateY(-2px) !important;
}

.progress-bar {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%) !important;
}

body, :root {
    --bs-primary: #a855f7 !important;
    --ls-active-color: #a855f7 !important;
    --primary-color: #a855f7 !important;
}

/* =========================================================
   ۶. گزینه‌های انتخاب (رادیوباتن و چک‌باکس)
========================================================= */
input[type="radio"], input[type="checkbox"] {
    accent-color: #a855f7 !important;
    cursor: pointer !important;
}

.ls-answers input[type="radio"]:checked + label::before,
.ls-answers input[type="checkbox"]:checked + label::before,
div.radio input[type="radio"]:checked + label::before,
.awesome-radio input[type="radio"]:checked + label::before,
.radio-item input[type="radio"]:checked + label::before {
    border-color: #a855f7 !important;
    background-color: #a855f7 !important;
    box-shadow: inset 0 0 0 4px #a855f7 !important;
}

.ls-answers input[type="radio"]:checked + label,
div.radio input[type="radio"]:checked + label {
    color: #c084fc !important;
    font-weight: 600 !important;
}

/* =========================================================
   ۷. منوی کشویی (Bootstrap Select) - اصلاح شده و هماهنگ
========================================================= */
.bootstrap-select {
    width: 152% !important;
}

.bootstrap-select > .dropdown-toggle {
    background-color: rgba(15, 23, 42, 0.7) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 10px !important;
    direction: rtl !important;
    text-align: right !important;
    width: 100% !important;
}

.bootstrap-select > .dropdown-toggle .filter-option-inner-inner {
    direction: rtl !important;
    text-align: right !important;
}

.bootstrap-select .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    width: 100% !important;
    min-width: 100% !important;
    z-index: 999999 !important;
    background-color: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6) !important;
    direction: rtl !important;
    text-align: right !important;
}

.bootstrap-select .dropdown-item, .bootstrap-select .dropdown-menu li a, .bootstrap-select .dropdown-menu li span.text {
    direction: rtl !important;
    text-align: right !important;
    width: 100% !important;
    display: block !important;
    color: #f8fafc !important;
}

.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-menu > .active > a, .bootstrap-select .dropdown-menu li.active a, .bootstrap-select .dropdown-menu li.selected a, .bootstrap-select .dropdown-menu li a:hover {
    background-color: #8b5cf6 !important;
    color: #ffffff !important;
    outline: none !important;
}

.bootstrap-select > .dropdown-toggle::after {
    margin-right: auto !important;
    margin-left: 0 !important;
}

/* =========================================================
   ۸. هدر چسبان و اصلاح سوالات ماتریسی برای دسکتاپ و موبایل
========================================================= */
@media (min-width: 992px) {
    .table-responsive, .ls-answers-wrapper, div.answer-container, .array-point-choice {
        overflow: visible !important;
    }
    
    table.ls-answers thead tr th, table.ls-answers thead tr td, table.pt-choice thead tr th {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 38px !important;
        background-color: #1e293b !important; 
        color: #f8fafc !important;
        z-index: 100 !important;
        box-shadow: 0px 5px 12px rgba(0, 0, 0, 0.4) !important;
        border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
    }
}

table.ls-answers, table.ls-answers tbody tr, table.ls-answers tbody tr td, table.ls-answers tbody tr th, .table-striped > tbody > tr {
    background-color: transparent !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

table.ls-answers tbody tr.ls-even, table.ls-answers tbody tr:nth-child(even), .table-striped > tbody > tr:nth-of-type(even), .table-striped > tbody > tr:nth-of-type(even) > td, .table-striped > tbody > tr:nth-of-type(even) > th {
    background-color: rgba(30, 41, 59, 0.75) !important;
}

table.ls-answers tbody tr.ls-odd, table.ls-answers tbody tr:nth-child(odd), .table-striped > tbody > tr:nth-of-type(odd), .table-striped > tbody > tr:nth-of-type(odd) > td, .table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: rgba(15, 23, 42, 0.85) !important;
}

table.ls-answers tbody .answertext, table.ls-answers tbody th.answertext, table.ls-answers tbody td.answer-text, table.ls-answers tbody tr td label, .ls-answers tbody tr td, .ls-answers tbody tr th {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
}

@media (max-width: 991px) {
    table.ls-answers thead, 
    table.pt-choice thead {
        display: none !important;
    }

    table.ls-answers tbody tr,
    table.pt-choice tbody tr {
        display: block !important;
    }

    table.ls-answers tbody td, 
    table.pt-choice tbody td {
        display: block !important;
        text-align: right !important;
        padding: 10px 15px !important;
        border: none !important;
    }
    
    table.ls-answers tbody td label, 
    table.pt-choice tbody td label {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: auto !important; 
        color: #ffffff !important;
        cursor: pointer !important;
    }
    
    table.ls-answers tbody td input[type="radio"], 
    table.pt-choice tbody td input[type="radio"] {
        float: none !important;
        position: static !important;
        margin-left: 10px !important;
        margin-right: 0 !important;
    }
}

/* =========================================================
   ۹. منوی تنظیمات بالای صفحه (سه نقطه)
========================================================= */
.navbar, .navbar-default, .navbar-fixed-top, #top-container, .header-container {
    background-color: rgba(15, 23, 42, 0.95) !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    min-height: 38px !important;
    max-height: 48px !important;
    padding: 0 15px !important;
    margin-bottom: 0 !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
    z-index: 1000 !important;
}

.navbar .container, .navbar .container-fluid, .navbar-header, .navbar-collapse, .navbar-default .navbar-collapse {
    background-color: transparent !important;
    border: none !important;
    min-height: 38px !important;
    padding: 0 !important;
}

.navbar .navbar-nav > li > a, .navbar .navbar-brand, .navbar-default .navbar-nav > li > a, .navbar-toggle, .navbar .dropdown-toggle, .navbar-text {
    color: #f8fafc !important;
    background-color: transparent !important;
    padding: 6px 12px !important;
    line-height: 24px !important;
    font-size: 14px !important;
}

.navbar .navbar-nav > li > a:hover, .navbar .navbar-nav > li > a:focus, .navbar .dropdown-toggle:hover {
    color: #c084fc !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.navbar .dropdown-menu {
    background-color: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6) !important;
    padding: 6px 0 !important;
    max-height: 280px !important;
    overflow-y: auto !important;
    z-index: 2000 !important;
}

.navbar .dropdown-menu > li > a {
    color: #f8fafc !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
}

.navbar .dropdown-menu > li > a:hover, .navbar .dropdown-menu > li > a:focus {
    background-color: #8b5cf6 !important;
    color: #ffffff !important;
}

@media (max-width: 991px) {
    .navbar .dropdown-menu {
        position: fixed !important;
        top: 50px !important;
        right: 5% !important;
        left: 5% !important;
        width: 90% !important;
        float: none !important;
        text-align: right !important;
        direction: rtl !important;
    }
}

.dropdown-header::after, .navbar .dropdown-menu .dropdown-header::after {
    content: "تنظیمات پرسشنامه" !important;
    font-size: 14px !important;
    font-weight: bold !important;
    color: #38bdf8 !important;
    display: block !important;
    padding: 4px 0 !important;
}

/* =========================================================
   ۱۰. فاصله خطوط متون سوالات و ورودی‌ها
========================================================= */
.ls-questiontext, .ls-questiontext p, .answertext, .answer-text {
    line-height: 1.5 !important;
}

input[type="text"], input[type="number"], textarea, .form-control {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-radius: 10px !important;
}

/* =========================================================
   ۱۱. پنجره‌های پیام خطا، مدال‌ها (Modal) و هشدارهای خطا
========================================================= */
.modal {
    text-align: center !important;
    padding: 0 !important;
}

.modal::before {
    content: '' !important;
    display: inline-block !important;
    height: 100% !important;
    vertical-align: middle !important;
    margin-right: -4px !important;
}

.modal-dialog {
    display: inline-block !important;
    text-align: right !important;
    vertical-align: middle !important;
    margin: 30px auto !important;
    max-width: 500px !important;
    width: 90% !important;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8) !important;
    color: #ffffff !important;
}

.modal-header, .modal-body, .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
    direction: rtl !important;
    text-align: right !important;
}

.modal-header .close:hover {
    color: #ef4444 !important;
}

.modal-footer .btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    padding: 8px 22px !important;
}

.modal-footer .btn:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
}

.alert, .alert-danger, .has-error .question-container {
    background-color: rgba(127, 29, 29, 0.45) !important;
    border: 1px solid rgba(239, 68, 68, 0.6) !important;
    color: #fca5a5 !important;
    border-radius: 12px !important;
}