.cctom-block-card {
    direction: rtl;
    border-radius: 18px;
    padding: 14px;
    background: linear-gradient(135deg, #071b3a 0%, #0b2d5f 55%, #101827 100%);
    color: #fff;
    box-shadow: 0 14px 30px rgba(2, 6, 23, .20);
    border: 1px solid rgba(255,255,255,.10);
    overflow: hidden;
    position: relative;
}
.cctom-block-card:before {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    left: -50px;
    top: -50px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.cctom-block-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 7px;
    position: relative;
}
.cctom-block-sub {
    font-size: 12px;
    opacity: .86;
    margin-bottom: 12px;
    line-height: 1.7;
    position: relative;
}
.cctom-btn-main,
.cctom-btn-soft {
    display: block;
    width: 100%;
    text-align: center;
    border-radius: 14px;
    padding: 10px 12px;
    margin-top: 8px;
    text-decoration: none !important;
    font-weight: 800;
    transition: all .18s ease;
    position: relative;
}
.cctom-btn-main {
    background: #fff;
    color: #071b3a !important;
}
.cctom-btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255,255,255,.18);
}
.cctom-btn-soft {
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(255,255,255,.08);
}
.cctom-btn-soft:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,.14);
}
.cctom-page {
    direction: rtl;
    max-width: 1180px;
    margin: 0 auto;
}
.cctom-hero {
    border-radius: 24px;
    padding: 26px;
    background: linear-gradient(135deg, #071b3a 0%, #0b2d5f 55%, #111827 100%);
    color: #fff;
    box-shadow: 0 18px 45px rgba(2,6,23,.18);
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.cctom-hero:after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    left: -90px;
    top: -90px;
    border-radius: 50%;
    background: rgba(255,255,255,.075);
}
.cctom-hero h2,
.cctom-hero h3 {
    margin: 0 0 8px 0;
    font-weight: 900;
    color: #fff;
}
.cctom-hero p {
    margin: 0;
    opacity: .9;
    line-height: 1.9;
}
.cctom-grid {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 18px;
    align-items: start;
}
@media (max-width: 900px) {
    .cctom-grid {
        grid-template-columns: 1fr;
    }
}
.cctom-card {
    border-radius: 22px;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 14px 36px rgba(15,23,42,.08);
    padding: 22px;
    margin-bottom: 18px;
}
.cctom-card h3 {
    margin-top: 0;
    font-weight: 900;
    color: #071b3a;
}
.cctom-label {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 7px;
    display: block;
}
.cctom-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: -4px;
    margin-bottom: 10px;
}
.cctom-preview {
    border-radius: 20px;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    line-height: 2;
    min-height: 230px;
    color: #0f172a;
}
.cctom-preview-title {
    font-weight: 900;
    color: #071b3a;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.cctom-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    background: #e0f2fe;
    color: #075985;
    font-size: 12px;
    font-weight: 800;
}
.cctom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.cctom-send-btn {
    border: 0;
    border-radius: 16px;
    padding: 13px 20px;
    background: linear-gradient(135deg, #071b3a, #0b2d5f);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 12px 24px rgba(7,27,58,.22);
    transition: all .18s ease;
}
.cctom-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(7,27,58,.28);
}
.cctom-muted-box {
    border-radius: 18px;
    padding: 14px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    line-height: 1.9;
}
.cctom-table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
}
.cctom-table-wrap table {
    margin-bottom: 0;
}
.cctom-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
}
.cctom-badge-success {
    background: #dcfce7;
    color: #166534;
}
.cctom-badge-warn {
    background: #fef3c7;
    color: #92400e;
}
.cctom-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}
.cctom-badge-neutral {
    background: #e5e7eb;
    color: #374151;
}

.cctom-open-btn {
    display: inline-block;
    border-radius: 14px;
    padding: 11px 18px;
    background: linear-gradient(135deg, #071b3a, #0b2d5f);
    color: #fff !important;
    font-weight: 900;
    text-decoration: none !important;
    margin-top: 12px;
}
.cctom-message-readable {
    direction: rtl;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 14px 36px rgba(15,23,42,.08);
    padding: 24px;
    line-height: 2;
    font-size: 16px;
}
.cctom-official-seal {
    border-radius: 18px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 14px 16px;
    color: #1e3a8a;
    margin-top: 16px;
}

.cctom-template-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.cctom-template-btn {
    width: 100%;
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    color: #0f172a;
    border-radius: 16px;
    padding: 12px 14px;
    text-align: right;
    cursor: pointer;
    transition: all .18s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cctom-template-btn:hover {
    transform: translateY(-1px);
    border-color: #0b2d5f;
    background: #eef6ff;
}
.cctom-template-btn.active {
    border-color: #071b3a;
    background: linear-gradient(135deg, #071b3a, #0b2d5f);
    color: #fff;
    box-shadow: 0 12px 26px rgba(7,27,58,.18);
}
.cctom-template-num {
    min-width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #075985;
    font-weight: 900;
}
.cctom-template-btn.active .cctom-template-num {
    background: #fff;
    color: #071b3a;
}
.cctom-template-title {
    font-weight: 800;
}

/* CCT Official Message - Sticky Preview */
@media (min-width: 901px) {
    .cctom-grid > .cctom-card:nth-child(2) {
        position: sticky;
        top: 120px;
        align-self: start;
        max-height: calc(100vh - 145px);
        overflow-y: auto;
    }
}

/* Hide scrollbar softly for preview card */
@media (min-width: 901px) {
    .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar {
        width: 6px;
    }
    .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar-thumb {
        background: rgba(15, 23, 42, .18);
        border-radius: 999px;
    }
}

/* CCT Official Message - Better sticky offset under Moodle header */
@media (min-width: 901px) {
    .cctom-grid > .cctom-card:nth-child(2) {
        position: sticky !important;
        top: 235px !important;
        align-self: start !important;
        max-height: calc(100vh - 260px) !important;
        overflow-y: auto !important;
    }
}

/* CCT Official Message - Smaller cleaner preview */
.cctom-grid > .cctom-card:nth-child(2) {
    padding: 16px !important;
}

.cctom-grid > .cctom-card:nth-child(2) h3 {
    font-size: 24px !important;
    margin-bottom: 14px !important;
}

.cctom-grid > .cctom-card:nth-child(2) .cctom-preview {
    padding: 16px !important;
    min-height: 0 !important;
    font-size: 14px !important;
    line-height: 1.75 !important;
}

.cctom-grid > .cctom-card:nth-child(2) .cctom-preview-title {
    margin-bottom: 8px !important;
}

.cctom-grid > .cctom-card:nth-child(2) .cctom-chip {
    font-size: 11px !important;
    padding: 4px 9px !important;
}

#preview-message {
    font-size: 15px !important;
    line-height: 1.85 !important;
}

@media (min-width: 901px) {
    .cctom-grid > .cctom-card:nth-child(2) {
        top: 220px !important;
        max-height: calc(100vh - 245px) !important;
    }
}

/* CCT Official Message - remove internal preview scrollbar */
@media (min-width: 901px) {
    .cctom-grid > .cctom-card:nth-child(2) {
        overflow: visible !important;
        overflow-y: visible !important;
        max-height: none !important;
    }

    .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar {
        display: none !important;
    }
}

.cctom-grid > .cctom-card:nth-child(2) .cctom-preview {
    overflow: visible !important;
    max-height: none !important;
}

/* FINAL FIX: No internal scrollbar for official message preview */
@media (min-width: 901px) {
    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) {
        position: sticky !important;
        top: 245px !important;
        align-self: start !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        overflow-y: visible !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        overflow-y: visible !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar,
    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
    }
}

/* FINAL: Disable sticky preview for smoother page scrolling */
@media (min-width: 901px) {
    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) {
        position: static !important;
        top: auto !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        overflow-y: visible !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        overflow-y: visible !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar,
    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
    }
}

/* CCT Official Message - final clean two-column override */
.cctom-page {
    max-width: 1320px !important;
}
.cctom-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
    align-items: start !important;
}
@media (max-width: 900px) {
    .cctom-grid {
        grid-template-columns: 1fr !important;
    }
}
body .cctom-page .cctom-grid > .cctom-card:nth-child(2) {
    position: static !important;
    top: auto !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    overflow-y: visible !important;
}
body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    overflow-y: visible !important;
}
body .cctom-page .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar,
body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* CCT Official Message - final clean two-column override */
.cctom-page {
    max-width: 1320px !important;
}
.cctom-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
    align-items: start !important;
}
@media (max-width: 900px) {
    .cctom-grid {
        grid-template-columns: 1fr !important;
    }
}
body .cctom-page .cctom-grid > .cctom-card:nth-child(2) {
    position: static !important;
    top: auto !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    overflow-y: visible !important;
}
body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    overflow-y: visible !important;
}
body .cctom-page .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar,
body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* CCT Official Message - polished buttons + smooth sticky preview */
@media (min-width: 901px) {
    body .cctom-page .cctom-grid {
        align-items: start !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) {
        position: sticky !important;
        top: 245px !important;
        align-self: start !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        overflow-y: visible !important;
        padding: 18px !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) h3 {
        font-size: 24px !important;
        margin-bottom: 14px !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        overflow-y: visible !important;
        padding: 16px !important;
        font-size: 14px !important;
        line-height: 1.75 !important;
    }

    body .cctom-page .cctom-grid > .cctom-card:nth-child(2)::-webkit-scrollbar,
    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) .cctom-preview::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
    }

    #preview-message {
        font-size: 15px !important;
        line-height: 1.85 !important;
    }
}

/* Improve template buttons appearance if button UI is active */
.cctom-template-card-polished,
.cctom-template-btn {
    border-radius: 18px !important;
    border: 1px solid #dbeafe !important;
    background: #f8fbff !important;
    box-shadow: 0 8px 18px rgba(15,23,42,.045) !important;
}

.cctom-template-card-polished:hover,
.cctom-template-btn:hover {
    transform: translateY(-1px) !important;
    border-color: #0b2d5f !important;
    background: #eef6ff !important;
}

.cctom-template-card-polished.active,
.cctom-template-btn.active {
    background: linear-gradient(135deg,#071b3a,#0b2d5f) !important;
    color: #fff !important;
    border-color: #071b3a !important;
    box-shadow: 0 14px 30px rgba(7,27,58,.20) !important;
}

/* On mobile keep everything normal */
@media (max-width: 900px) {
    body .cctom-page .cctom-grid > .cctom-card:nth-child(2) {
        position: static !important;
        top: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}
