/* =====================================================================
   stylec.css — نسخه تمیز و بهینه‌شده بدون تغییر در رفتار
   ===================================================================== */

/* =========================
   پایه / ابزارهای عمومی
   ========================= */
.js-hidden {
    display: none !important;
}

.imagecenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.border-bottom {
    border-bottom-color: #e9e5e5 !important;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

table,
th,
td {
    border: 1px solid rgb(0, 0, 0);
    text-align: center;
}

table {
    width: 100%;
}

hr {
    border: 0;
    height: 1px;
    margin: 30px 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

/* =========================
   آکاردئون ساده
   ========================= */
.accordion {
    width: 100%;
    padding: 12px;
    border: none;
    outline: none;
    cursor: pointer;
    text-align: right;
    font-size: 10px;
    color: #444;
    background-color: #eee;
    border-radius: 2.5px;
    transition: 0.4s;
}

.accordion:hover {
    background-color: #ccc;
}

.accordion::after {
    content: "\25E2";
    float: left;
    margin-left: 5px;
    color: #777;
    font-weight: bold;
}

.accordion.active::after {
    content: "\25E5";
}

.panel {
    padding: 0 10px;
    overflow: hidden;
    max-height: 0;
    background-color: #fff;
    transition: max-height 0.2s ease-out;
}

.panel p {
    font-size: 10px;
    color: #444;
}

.panelcontent:hover {
    color: #777;
    background-color: #eee;
}

/* =========================
   پیام‌ها
   ========================= */
.success-msg,
.error-msg {
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    text-align: right;
    animation: fadeOut 4s ease 1 forwards;
}

.success-msg {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.error-msg {
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* =========================
   Comment box قدیمی
   ========================= */
.commentbox {
    float: right;
    width: 100%;
    margin: 10px;
    padding: 20px;
    border: 3px solid grey;
    background-color: whitesmoke;
}

.commentboxavatar {
    float: right;
    width: 100%;
    height: 100%;
}

/* =========================
   هدر
   ========================= */
.header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: #1f2d3d;
    background-position: center;
    background-repeat: repeat;
    background-size: cover;
}

.header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(255, 255, 255, 0.75);
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 20px;
}

.header-content h1 {
    margin-bottom: 20px;
    font-size: 28px !important;
}

.header-content h2 {
    margin-bottom: 20px;
    font-size: 24px !important;
}

.header-content a {
    color: #1f2d3d !important;
}

.left-box {
    text-align: center;
}

.right-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.profile-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.profile-box p {
    margin: 0;
}

.profile-box img {
    width: 95px;
    height: 95px;
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* =========================
   ساختار محتوای دوره
   ========================= */
.course-content {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    direction: rtl;
    margin-top: 20px;
}

.sidebar {
    width: 260px;
    height: fit-content;
    padding: 20px;
    color: #fff;
    background: #1f2d3d;
    border: 1px solid;
    border-radius: 12px;
    top: 20px;
}

.sidebar ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar li {
    margin-bottom: 12px;
}

.sidebar a {
    display: block;
    padding: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: 0.2s;
}

.sidebar a:hover,
.sidebar a.active {
    padding-right: 20px;
    color: #1f2d3d;
    background: #fff;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 260px;
    position: sticky;
    top: 20px;
}

.main-content {
    flex: 1;
    width: 100%;
    padding: 15px;
    color: #1f2d3d;
    line-height: 2;
    text-align: justify;
    background: #fff;
    border: 1px solid #1f2d3d;
    border-radius: 12px;
}

.main-content h1 {
    margin-bottom: 20px;
    font-size: 24px !important;
}

.main-content h2 {
    margin-bottom: 20px;
    font-size: 20px !important;
}

.main-content h3 {
    margin-bottom: 20px;
    font-size: 18px !important;
}

.main-content img {
    display: block;
    max-width: 80%;
    margin: 0 auto;
}

#notEnrol {
    margin-top: 74px !important;
    background-color: #fff;
}

/* =========================
   کارت دوره‌ها
   ========================= */
.courses-wrapper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    direction: rtl;
}

.course-card {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 14px 18px;
    background: #1f2d3d;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.course-card * {
    min-width: 0;
}

.course-card .title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.course-img {
    width: 90px;
    height: 70px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 10px;
}

.course-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
}

.course-info p {
    margin: 2px 0;
    font-size: 12px;
    color: #fff;
}

.title {
    display: -webkit-box;
    overflow: hidden;
    min-height: 2.8em;
    line-height: 1.4em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.enrol-help {
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.related-course-title,
.enrol-title {
    width: 100%;
    margin: 0;
    padding: 40px 0;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    background: #1f2d3d;
    border-radius: 10px;
}

.signup-card {
    margin: 25px 0;
    padding: 22px;
    color: #fff;
    text-align: center;
    background: #1f2d3d;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.signup-card h3 {
    margin-bottom: 10px;
    font-size: 20px;
}

.signup-card p {
    margin-bottom: 15px;
    font-size: 14px;
}

/* =========================
   ویدئو
   ========================= */
.video-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 15px auto;
}

.video-wrapper video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
}

/* =========================
   کامنت‌ها
   ========================= */
.comment-form {
    direction: rtl;
    text-align: right;
}

.comment-textarea {
    display: block;
    width: 100%;
    padding: 15px;
    color: #fff;
    direction: rtl;
    text-align: right;
    resize: none;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.comment-textarea:focus {
    color: #fff;
    outline: none;
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #ff9800;
    box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.1);
}

.comment-item {
    direction: rtl;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-actions {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 10px;
}

#commentStatus {
    margin-right: 0;
    font-size: 13px;
    color: #fff;
}

.comments-container {
    direction: rtl;
    text-align: right;
}

.comment-row,
.reply-row {
    direction: rtl;
    font-size: 12px;
    align-items: flex-start;
}

.comment-row {
    padding: 10px 5px;
}

.reply-item {
    margin-top: 15px;
    margin-right: 40px;
    padding: 10px;
    padding-top: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    border-right: 2px solid #00a8ff;
    border-radius: 8px;
}

.comment-user-name {
    display: block;
    margin-top: 5px;
    margin-bottom: 0;
    overflow: hidden;
    color: #eee;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.4;
    text-align: center;
    text-overflow: ellipsis;
    white-space: normal;
    word-wrap: break-word;
}

.comment-text {
    margin-bottom: 8px;
    color: #fff;
    font-size: 13px;
    line-height: 1.8;
    text-align: right;
    word-break: break-word;
}

.reply-btn {
    display: inline-block;
    font-size: 12px;
    color: #99dbfd !important;
    text-decoration: none !important;
    transition: all 0.3s;
}

.reply-btn:hover {
    color: #fff !important;
    text-decoration: none;
    transform: translateX(-3px);
}

.load-more-comments {
    display: block;
    margin-top: 20px;
    color: #fff;
    text-align: center;
    text-decoration: none;
}

.load-more-comments:hover {
    color: #ccc;
}

.text-left-wrapper {
    width: 100%;
    text-align: left;
}

/* =========================
   Video accordion
   ========================= */
.video-accordion {
    direction: rtl;
    overflow: hidden;
    background: rgba(20, 20, 30, 0.75);
    border: 1px solid rgba(252, 178, 72, 0.25);
    border-radius: 18px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(10px);
}

.video-accordion-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(252, 178, 72, 0.18), rgba(255, 255, 255, 0.04));
    border: 0;
    outline: 0;
    transition: 0.25s ease;
}

.video-accordion-btn:hover {
    background: linear-gradient(135deg, rgba(252, 178, 72, 0.28), rgba(255, 255, 255, 0.07));
}

.video-accordion-btn .accordion-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-accordion-btn i {
    font-size: 18px;
    color: #fcb248;
}

.accordion-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    color: #111;
    background: #fcb248;
    border-radius: 50%;
    transition: 0.25s ease;
}

.video-accordion.active .accordion-icon {
    transform: rotate(45deg);
}

.video-accordion-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease;
}

.video-accordion-inner {
    padding: 18px 20px 22px;
    color: #eee;
    line-height: 2;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.video-accordion-inner a {
    color: #fcb248;
}

.video-accordion-inner ul,
.video-accordion-inner ol {
    margin-bottom: 0;
    padding-right: 20px;
}

.video-accordion-inner li {
    margin-bottom: 8px;
}

/* =========================
   Theater mode
   ========================= */

/* پیش‌فرض: بخش‌های ردیف دوم مخفی باشند */
#course_file_comment_2,
#course_content_2,
#related_course_2 {
    display: none;
}

/* حالت سینما */
#courseContainer.theater-mode #videoCol,
.container.theater-mode #videoCol,
.theater-mode #videoCol {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.theater-mode #sidebarCol {
    display: none !important;
}

.theater-mode .theater-only-row {
    display: flex !important;
}

.theater-mode #course_content_1,
.theater-mode #related_course_1,
.theater-mode #course_file_comment_1,
#courseContainer.theater-mode #course_content_1,
#courseContainer.theater-mode #related_course_1,
#courseContainer.theater-mode #course_file_comment_1 {
    display: none;
}

.theater-mode #course_content_2,
.theater-mode #related_course_2,
.theater-mode #course_file_comment_2,
#courseContainer.theater-mode #course_content_2,
#courseContainer.theater-mode #related_course_2,
#courseContainer.theater-mode #course_file_comment_2 {
    display: block;
}

/* =========================
   ریسپانسیو
   ========================= */
@media (max-width: 768px) {
    #related_course_1,
    #related_course_2 {
        display: block !important;
    }    
    .header {
        min-height: auto;
        padding: 30px 5px;
    }

    .header h1,
    .header p {
        font-size: 24px !important;
    }

    .header p {
        font-size: 14px !important;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-content h1 {
        margin-bottom: 10px;
        font-size: 20px !important;
    }

    .header-content h2 {
        margin-bottom: 10px;
        font-size: 17px !important;
    }

    .left-box,
    .right-box {
        width: 100%;
        margin-bottom: 15px;
    }

    .right-box {
        gap: 8px;
    }

    .profile-box img {
        width: 60px;
        height: 60px;
    }

    .sidebar-group,
    .sidebar,
    .sidebar-wrapper {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .course-content {
        flex-direction: column !important;
    }

    .video-accordion {
        margin-top: 16px;
        border-radius: 14px;
    }

    .video-accordion-btn {
        padding: 14px 15px;
        font-size: 15px;
    }

    .video-accordion-inner {
        padding: 15px;
        font-size: 14px;
    }
}

@media (max-width: 767px) {
    #videoCol {
        display: flex;
        flex-direction: column;
    }

    #videoCol > * {
        order: initial;
    }

    #videoCol > *:first-child {
        order: 1;
    }

    #videoCol .video-accordion {
        order: 2;
    }

    #course_file_comment_1 {
        order: 3;
    }

    #videoCol > div {
        margin-bottom: 20px;
    }
}

@media (min-width: 768px) {
    .theater-mode #videoCol {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .theater-mode #sidebarCol {
        display: none !important;
    }

    .theater-mode #videoCol::after {
        content: "";
    }
}

@media (max-width: 600px) {
    .courses-wrapper {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100%;
        padding: 0 10px;
    }

    .course-card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    .course-info p {
        font-size: 14px;
    }
}

/* خود مودال */
.replace-modal-dialog {
    max-width: 720px;
    width: calc(100% - 32px);
    margin: 1.75rem auto;
}

/* کارت اصلی مودال */
.replace-modal-content {
    direction: rtl;
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    overflow: hidden;
    background: #172736;
    color: #fff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

/* هدر */
.replace-modal-header {
    position: relative;
    direction: rtl;
    text-align: right;
    padding: 22px 28px 18px 64px;
    background:
        radial-gradient(circle at top right, rgba(64, 130, 180, 0.22), transparent 35%),
        linear-gradient(135deg, #1c3448, #172736);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* عنوان و توضیح */
.replace-modal-title-box {
    padding-left: 8px;
}

.replace-modal-title {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: -0.3px;
}

.replace-modal-desc {
    margin: 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.8;
}

/* دکمه بستن */
.replace-modal-close {
    position: absolute;
    top: 18px;
    left: 22px;        /* در RTL گوشه‌ی چپ بالا */
    right: auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 26px;
    line-height: 30px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.replace-modal-close:hover {
    background: rgba(244, 63, 94, 0.18);
    color: #fff;
    transform: rotate(90deg);
}

/* بدنه */
.replace-modal-body {
    padding: 22px 28px 28px;
    background: #172736;
}

/* خطا */
.replace-modal-error {
    display: none;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(244, 63, 94, 0.1);
    color: #fb7185;
    font-size: 13px;
    line-height: 1.7;
}

.replace-modal-error:not(:empty) {
    display: block;
}

/* لیست دوره‌ها */
.replace-course-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
    padding-left: 4px;
}

/* اسکرول ظریف */
.replace-course-list::-webkit-scrollbar {
    width: 6px;
}

.replace-course-list::-webkit-scrollbar-track {
    background: transparent;
}

.replace-course-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 99px;
}

.replace-course-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* آیتم دوره */
.replace-course-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
    transition: all 0.2s ease;
}

.replace-course-item:hover {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.13);
    transform: translateY(-1px);
}

/* عنوان دوره */
.replace-course-title {
    flex: 1;
    min-width: 0;
    color: #f8fafc;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.9;
    text-align: right;
    direction: rtl;
    unicode-bidi: plaintext;            /* ترکیب فارسی/انگلیسی مثل MCNP بهتر نمایش داده می‌شود */
    word-break: normal;
    overflow-wrap: anywhere;
}

/* دکمه خروج */
.replace-course-remove-btn {
    flex: 0 0 auto;
    min-width: 72px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.25);
    transition: all 0.2s ease;
}

.replace-course-remove-btn:hover {
    background: linear-gradient(135deg, #fb7185, #e11d48);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(225, 29, 72, 0.35);
}

.replace-course-remove-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* موبایل */
@media (max-width: 576px) {
    .replace-modal-dialog {
        width: calc(100% - 20px);
        max-width: none;
    }

    .replace-modal-header {
        padding: 18px 18px 16px 56px;
    }

    .replace-modal-body {
        padding: 18px;
    }

    .replace-modal-title {
        font-size: 18px;
    }

    .replace-modal-desc {
        font-size: 13px;
    }

    .replace-course-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .replace-course-remove-btn {
        width: 100%;
    }
}


