/* ============================================
   پنل دانشجو — تم سفید و تیل (#025A5A)
   ============================================ */
:root {
    --cm-primary: #025A5A;
    --cm-primary-dark: #013f3f;
    --cm-primary-light: #0a7a7a;
    --cm-primary-soft: #e6f2f2;
    --cm-primary-softer: #f3f9f9;
    --cm-accent: #d4a017;
    --cm-text: #1c2b2b;
    --cm-text-soft: #5a6e6e;
    --cm-border: #e2ecec;
    --cm-white: #ffffff;
    --cm-shadow: 0 2px 12px rgba(2, 90, 90, 0.06);
    --cm-shadow-hover: 0 12px 32px rgba(2, 90, 90, 0.14);
    --cm-radius: 16px;
    --cm-radius-sm: 10px;
}

/* پایه */
.cm-panel {
    direction: rtl;
    text-align: right;
    font-family: inherit;
    max-width: 1080px;
    margin: 0 auto;
    color: var(--cm-text);
}
.cm-panel *,
.cm-panel *::before,
.cm-panel *::after { box-sizing: border-box; }

/* عنوان اصلی */
.cm-title {
    position: relative;
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 1.8rem;
    padding: 0 0 1rem;
    color: var(--cm-primary-dark);
    letter-spacing: -0.01em;
}
.cm-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 64px;
    height: 4px;
    background: linear-gradient(90deg, var(--cm-primary), var(--cm-primary-light));
    border-radius: 4px;
}

.cm-subtitle {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 2.2rem 0 1rem;
    color: var(--cm-primary-dark);
    display: flex;
    align-items: center;
    gap: .6rem;
}
.cm-subtitle::before {
    content: "";
    width: 6px;
    height: 22px;
    background: var(--cm-primary);
    border-radius: 6px;
}

/* پیام‌ها */
.cm-alert {
    padding: 14px 18px;
    border-radius: var(--cm-radius-sm);
    margin-bottom: 1.4rem;
    font-size: .95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .6rem;
    animation: cmSlideIn .4s ease;
}
@keyframes cmSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cm-alert::before { font-size: 1.1rem; }
.cm-alert-success {
    background: #e8f6ed;
    color: #1b7a3d;
    border: 1px solid #b8e3c6;
}
.cm-alert-success::before { content: "✓"; }
.cm-alert-error {
    background: #fdeceb;
    color: #c0392b;
    border: 1px solid #f3c0bb;
}
.cm-alert-error::before { content: "!"; font-weight: 800; }

/* حالت خالی */
.cm-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--cm-text-soft);
    background: var(--cm-primary-softer);
    border: 2px dashed var(--cm-border);
    border-radius: var(--cm-radius);
    font-size: 1rem;
}

/* ===== گرید دوره‌ها ===== */
.cm-course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.5rem;
}

.cm-course-card {
    position: relative;
    background: var(--cm-white);
    border: 1px solid var(--cm-border);
    border-radius: var(--cm-radius);
    overflow: hidden;
    box-shadow: var(--cm-shadow);
    transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s;
    display: flex;
    flex-direction: column;
}
.cm-course-card::before {
    content: "";
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cm-primary), var(--cm-primary-light));
    z-index: 2;
}
.cm-course-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--cm-shadow-hover);
}
.cm-course-thumb {
    overflow: hidden;
    background: var(--cm-primary-soft);
}
.cm-course-thumb img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.cm-course-card:hover .cm-course-thumb img { transform: scale(1.06); }
.cm-course-body {
    padding: 1.3rem 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.cm-course-body h3 {
    margin: 0 0 .6rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cm-primary-dark);
    line-height: 1.4;
}
.cm-course-meta {
    color: var(--cm-text-soft);
    font-size: .88rem;
    margin: 0 0 1.3rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.cm-course-meta::before {
    content: "▶";
    font-size: .65rem;
    color: var(--cm-primary);
}
.cm-course-body .cm-btn { margin-top: auto; }

/* ===== دکمه‌ها ===== */
.cm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.5rem;
    background: var(--cm-primary);
    color: var(--cm-white) !important;
    border: none;
    border-radius: var(--cm-radius-sm);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .25s, transform .15s, box-shadow .25s;
    box-shadow: 0 4px 12px rgba(2, 90, 90, 0.18);
}
.cm-btn:hover {
    background: var(--cm-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(2, 90, 90, 0.28);
    color: var(--cm-white) !important;
}
.cm-btn:active { transform: translateY(0); }
.cm-btn-primary { background: var(--cm-primary); }

/* ===== جلسات ===== */
.cm-course-desc {
    line-height: 2;
    color: var(--cm-text-soft);
    margin-bottom: 1.8rem;
    padding: 1.2rem 1.4rem;
    background: var(--cm-primary-softer);
    border-right: 4px solid var(--cm-primary);
    border-radius: var(--cm-radius-sm);
}
.cm-lessons {
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
    margin-top: 1rem;
}
.cm-lesson-item {
    background: var(--cm-white);
    border: 1px solid var(--cm-border);
    border-radius: var(--cm-radius);
    padding: 1.4rem 1.6rem;
    box-shadow: var(--cm-shadow);
    transition: box-shadow .25s;
}
.cm-lesson-item:hover { box-shadow: var(--cm-shadow-hover); }
.cm-lesson-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.cm-lesson-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--cm-primary), var(--cm-primary-light));
    color: var(--cm-white);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(2, 90, 90, 0.2);
}
.cm-lesson-head h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cm-primary-dark);
}
.cm-lesson-video {
    margin: 1rem 0;
    border-radius: var(--cm-radius-sm);
    overflow: hidden;
    background: #000;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.cm-lesson-video video {
    display: block;
    width: 100%;
    border-radius: var(--cm-radius-sm);
}
.cm-lesson-content {
    line-height: 2;
    color: var(--cm-text);
    padding-top: .4rem;
}
.cm-lesson-download {
    margin: 1rem 0;
}
.cm-btn-download {
    background: var(--cm-white);
    color: var(--cm-primary) !important;
    border: 1.5px solid var(--cm-primary);
    box-shadow: none;
    padding: .55rem 1.3rem;
    font-size: .9rem;
}
.cm-btn-download:hover {
    background: var(--cm-primary-soft);
    color: var(--cm-primary-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 90, 90, 0.12);
}
.cm-btn-download svg { flex-shrink: 0; }

/* ===== فرم ===== */
.cm-homework-form-wrap { margin-top: 2.4rem; }
.cm-form {
    background: linear-gradient(180deg, var(--cm-primary-softer), var(--cm-white));
    border: 1px solid var(--cm-border);
    border-radius: var(--cm-radius);
    padding: 1.8rem;
    box-shadow: var(--cm-shadow);
}
.cm-form p { margin: 0 0 1.3rem; }
.cm-form p:last-child { margin-bottom: 0; }
.cm-form label {
    display: block;
    font-weight: 600;
    margin-bottom: .5rem;
    color: var(--cm-primary-dark);
    font-size: .92rem;
}
.cm-form input[type="file"],
.cm-form select,
.cm-form textarea {
    width: 100%;
    padding: .75rem .95rem;
    border: 1.5px solid var(--cm-border);
    border-radius: var(--cm-radius-sm);
    font-family: inherit;
    font-size: .92rem;
    color: var(--cm-text);
    background: var(--cm-white);
    transition: border-color .2s, box-shadow .2s;
}
.cm-form select:focus,
.cm-form textarea:focus,
.cm-form input[type="file"]:focus {
    outline: none;
    border-color: var(--cm-primary);
    box-shadow: 0 0 0 3px rgba(2, 90, 90, 0.12);
}
.cm-form textarea { resize: vertical; min-height: 80px; }
.cm-form input[type="file"] { padding: .6rem; cursor: pointer; }
.cm-hint {
    display: block;
    color: var(--cm-text-soft);
    font-size: .8rem;
    margin-top: .4rem;
    font-weight: normal;
}

/* ===== جدول ===== */
.cm-homework-list-wrap { margin-top: 2.4rem; }
.cm-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    background: var(--cm-white);
    border-radius: var(--cm-radius);
    overflow: hidden;
    box-shadow: var(--cm-shadow);
    border: 1px solid var(--cm-border);
}
.cm-table thead th {
    background: var(--cm-primary);
    color: var(--cm-white);
    font-weight: 600;
    font-size: .9rem;
    padding: .95rem 1.1rem;
    text-align: right;
}
.cm-table tbody td {
    padding: .9rem 1.1rem;
    text-align: right;
    border-bottom: 1px solid var(--cm-border);
    font-size: .9rem;
    color: var(--cm-text);
}
.cm-table tbody tr:last-child td { border-bottom: none; }
.cm-table tbody tr { transition: background .15s; }
.cm-table tbody tr:hover { background: var(--cm-primary-softer); }
.cm-table a {
    color: var(--cm-primary);
    text-decoration: none;
    font-weight: 600;
}
.cm-table a:hover { text-decoration: underline; color: var(--cm-primary-dark); }

/* ===== وضعیت ===== */
.cm-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .85rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}
.cm-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.cm-status-pending  { background: #fff5e0; color: #b87800; }
.cm-status-approved { background: #e6f6ec; color: #1b7a3d; }
.cm-status-rejected { background: #fdeceb; color: #c0392b; }

/* ریسپانسیو */
@media (max-width: 600px) {
    .cm-title { font-size: 1.45rem; }
    .cm-table { display: block; overflow-x: auto; white-space: nowrap; }
    .cm-form { padding: 1.3rem; }
    .cm-lesson-item { padding: 1.1rem 1.2rem; }
}

/* ===== Thumbnail ویدیو + دکمه پخش ===== */
.cm-video-trigger {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 1rem 0;
    border-radius: var(--cm-radius-sm);
    overflow: hidden;
    cursor: pointer;
    background-color: #04403f;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    box-shadow: 0 6px 20px rgba(2, 90, 90, 0.18);
    transition: transform .25s, box-shadow .25s;
}
.cm-video-trigger::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(2,90,90,.35), rgba(1,40,40,.65));
    transition: background .25s;
}
.cm-video-trigger:hover { transform: translateY(-3px); box-shadow: var(--cm-shadow-hover); }
.cm-video-trigger:hover::before { background: linear-gradient(180deg, rgba(2,90,90,.25), rgba(1,40,40,.55)); }

.cm-play-btn {
    position: relative;
    z-index: 2;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--cm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: transform .25s, background .25s;
    padding-right: 4px; /* بصری: مثلث کمی به راست */
}
.cm-video-trigger:hover .cm-play-btn {
    transform: scale(1.12);
    background: #fff;
}
.cm-video-label {
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: .95rem;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* ===== Lightbox ===== */
.cm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    direction: rtl;
}
.cm-lightbox.cm-open { display: flex; animation: cmFade .25s ease; }
@keyframes cmFade { from { opacity: 0; } to { opacity: 1; } }

.cm-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(1, 30, 30, 0.86);
    backdrop-filter: blur(4px);
    cursor: pointer;
}
.cm-lightbox-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 900px;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: cmZoom .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes cmZoom { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.cm-lightbox-title {
    background: var(--cm-primary-dark);
    color: #fff;
    padding: .85rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    padding-left: 3rem; /* جا برای دکمه بستن */
}
.cm-lightbox-title:empty { display: none; }

.cm-lightbox-close {
    position: absolute;
    top: .5rem;
    left: .7rem;
    z-index: 5;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, transform .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cm-lightbox-close:hover { background: rgba(255, 255, 255, 0.3); transform: rotate(90deg); }

.cm-lightbox-body {
    width: 100%;
    background: #000;
    line-height: 0;
}
.cm-lightbox-body video { width: 100%; max-height: 80vh; display: block; }
/* وقتی محتوا iframe امبد است، نسبت 16:9 واکنش‌گرا */
.cm-lightbox-body.cm-has-iframe {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}
.cm-lightbox-body iframe { display: block; border: 0; }

@media (max-width: 600px) {
    .cm-play-btn { width: 60px; height: 60px; }
    .cm-lightbox { padding: 1rem .5rem; }
}
