/*1*/
/*تنسيقات عامة مثل اخفاء قائمة القالب القديمة...*/
#primary, #secondary {
    width: 100%!important;
}

.ast-left-sidebar #secondary {
    display: none;
}
.entry-content ul li {
    list-style-image: none!important;
    margin-right: 0!important;
}
article {
    padding: 0!important;

}

.ms-page-container {
    max-width: 2000px!important;
    padding:0
}
section  {
    margin: 0!important;
    max-width: 100%!important;
}

.ast-container {
    max-width: 2000px;
    padding:0
}
.ast-separate-container, #primary, article, .comment-respond{
     margin:0 0 1em 0!important; 
        padding: 0!important;
    border:0!important;
    border-radius:0!important;
}
.entry-header {padding:2em 2em 0 0}



/*2*/

/*الكود هذا من اجل هيكلة الصفحة فقط وليس التنسيقات الداخلية*/
/* حاوية الصفحة الأساسية */
.ms-page-container {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    margin: 0 auto;
    padding: 20px;
}

/* تصميم القائمة الجانبية الجديدة */


.ms-custom-sidebar {
    flex: 0 0 300px;
    /* background: #f9f9f9; */
    /* border: 1px solid #eee; */
    border-radius: 8px;
    padding: 0px;
    position: sticky;
    top: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

/* تصميم منطقة المحتوى */
.ms-main-content {
    flex: 1; /* يأخذ باقي المساحة المتوفرة */
    min-width: 0; /* لمنع تمدد العناصر مثل الجداول */
}

/* header بسيط للقائمة */
.ms-sidebar-header {
    font-weight: bold;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #0073aa;
    color: #333;
    top: 0;
    position: sticky;
    background: white;
    z-index: 9;
    box-shadow: 1px 1px 9px #cecece;
}
/* الحاوية الرئيسية */
.ms-sidebar-container {
    direction: rtl; /* للتوافق مع العربية */
    background: var(--ms-bg);
    border: 1px solid var(--ms-border);
    border-radius: 12px;
    padding: 15px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* التجاوب مع الجوال */
@media (max-width: 768px) {
    .ms-page-container {
        flex-direction: column; /* القائمة فوق والمحتوى تحت */
    }
    .ms-custom-sidebar {
        flex: 1 1 auto;
        width: 100%;
        position: static;
    }
.ms-sidebar-container{
 max-width: 100%;
}
}





/*3*/



/*تصميم القائمة الجانبية*/
/* متغيرات الألوان لتسهيل التعديل */
:root {
    --ms-primary: #ff7704;
    --ms-primary-light: rgba(255, 119, 4, 0.1);
    --ms-text: #333;
    --ms-border: #e0e0e0;
    --ms-bg: #ffffff;
   --main-sector-color: #03a9f469;
            
}


/* قسم الفلاتر */
.ms-filter-group {
    margin-bottom: 20px;
}

.ms-filter-group select {
    width: 100%;
    padding: 10px;
padding-right: 33px;
    margin-bottom: 10px;
    border: 1.5px solid var(--ms-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
    background-color: #f9f9f9;
}

.ms-filter-group select:focus {
    border-color: var(--ms-primary);
}

/* القائمة الشجرية */
.ms-tree-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ms-tree-nav .ms-sub-tree {
    margin-right: 25px; /* إزاحة العناصر الفرعية */
    border-right: 1.5px dashed var(--ms-border);
    display: none; /* مخفية افتراضياً */
}

/* عنصر القائمة */
.ms-tree-item {
    margin: 5px 0;
}

.ms-item-content {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ms-item-content:hover {
    background-color: var(--ms-primary-light);
}

.ms-item-content a {
    text-decoration: none;
    color: var(--ms-text);
    flex-grow: 1;
    font-weight: 500;
}

/* الأيقونات */
.ms-toggle-btn {
    font-size: 12px;
    margin-left: 10px;
    transition: transform 0.3s;
    color: var(--ms-primary);
transform: rotate(90deg);
}

.ms-icon-wrapper {
    width: 24px;
    height: 24px;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* حالة الفتح */
.ms-tree-item.is-open > .ms-sub-tree {
    display: block;
}

.ms-tree-item.is-open > .ms-item-content .ms-toggle-btn {
    transform: rotate(0deg);
}

/* تأثير عند إخفاء العنصر بالفلتر */
.ms-hidden {
    display: none !important;
}




/*4*/




        /*ستايل ورقة العمل - ملف SVG*/
        /* حاوية الورقة الرئيسية */
        .page-container {
            background: white;
            box-shadow: 0 0 20px rgba(0,0,0,0.2);
           /* width: 210mm;*/
            /*height: 297mm;*/
            display: block;
        }

        /* تنسيق شبكة الأسئلة داخل الـ SVG */
        .questions-wrapper {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* توزيع مرن تلقائي */
            gap: 15px;
            padding: 10px;
            height: 100%;
        }

        .q-card {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 10px;
            background: #fafafa;
            page-break-inside: avoid;
        }

        @media print {
            body { background: none; padding: 0; }
            .page-container { box-shadow: none; border: none; margin: 0; }
        }
		
	/* in-line "table" fractions */
	.intbl { text-indent:0; display: inline-table; text-align: center; vertical-align: 40%; margin: 0 0.1rem 0 0.1rem; border-collapse: collapse; 
line-height: 12px;
white-space: nowrap;
}
	.intbl em:before, .intbl em:after, .intbl strong:before, .intbl strong:after { content: "\2005";	}  /* 2005=unicode 1/4 em space */


/* التنسيق النهائي لترويض التمارين */
#questions-area {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 4 أعمدة بناءً على عرض 48px */
    gap: 2px;
    padding: 2px;
	direction: ltr;
}

/* ترويض حاوية السؤال بناءً على قياساتك */
.q-container-fixed {
    text-align: center;
    display: inline-block;
    vertical-align: middle;
    width: 48px !important;
    height: 19px !important;
    font-size: 4px !important; /* الحجم السحري الذي اكتشفته */
    margin: 1px;
}

/* تنسيق الكسور الاحترافي */
.intbl { 
    text-indent: 0; 
    display: inline-table; 
    text-align: center; 
    vertical-align: middle; 
    border-collapse: collapse;
    font-size: inherit;
}
.intbl em { 
    display: table-row; 
    /*border-bottom: 0.12ch solid #000; */
	box-shadow: 0px 1px 0px -0.5px #020202;
    font-style: normal;
}
.intbl strong { 
    display: table-row; 
    font-weight: 400;
}



/* الحاوية الخارجية للتمرين الواحد */
.outer-box {
    text-align: center;
    display: inline-block;
    vertical-align: middle;
    margin: 0 0px 2px 4px;
    font-size: 6.5px; /* الحجم الذي اعتمدته للتوازن */
    position: relative; /* ضروري لضبط تموضع رقم التمرين */
}

/* تنسيق رقم التمرين (الركن العلوي) */
.ex-number {
    font: italic 4px Verdana;
    position: absolute;
    background: #cfecff;
    color: #2d2b2b;
    padding: 0px 3px;
    border-radius: 0 0 12px 0;
    top: 0;
    left: 0;
    z-index: 10;
}

/* الصندوق المحتوي على المسألة (الإطار المنقط) */
.ex-box0 {
    display: flex;
    align-items: center;
justify-content: center;
    /* border: 1px dotted rgb(200,230,250); */
    box-shadow: inset 0 0 0px 0.5px #e4e4e4;
    padding: 2px 0;
    border-radius: 0 2px;
    margin-bottom: 0;
}


.ex-box{
text-align:left;    /*padding-left: 7px;*/
}

.print-page { 
    background: white; 
    width: 200mm; /* القياس الذي اعتمدته */
    height: 290mm; /* ترك 10 ملم للأمان في الأسفل */
    margin: auto; 
    overflow: hidden;
}
.outer-draw{
display:flex;
margin: 0 2px 0 2px;
}







/*5*/



/*ستايل الازرار والحقول والعناصر الداخلية للصفحة */



/*My addition to style*/
#hsn-result-container{direction:ltr;}
#hsn-svg-math{margin: 0 auto;    display: block;}
/*paper shadow*/
.bended-shadow {
    position: relative;
    width: 306px;
    margin: 0;
    margin-bottom: 10px;
}
.bended-shadow::before, .bended-shadow::after {
    content: '';
    position: absolute;
    width: 59%;
    height: 41px;
    -webkit-box-shadow: 0 0 36px rgba(0,0,0,1);
    -moz-box-shadow: 0 0 36px rgba(0,0,0,1);
    -ms-box-shadow: 0 0 36px rgba(0,0,0,1);
    -o-box-shadow: 0 0 36px rgba(0,0,0,1);
    box-shadow: 0 0 17px rgba(0, 0, 0, 1);
    -webkit-transform: rotate(-3deg) skew(-10deg);
    -moz-transform: rotate(-3deg) skew(-10deg);
    -o-transform: rotate(-3deg) skew(-10deg);
    -ms-transform: rotate(-3deg) skew(-10deg);
    transform: rotate(357deg) skew(346deg);
    left: 19px;
    bottom: 13px;
    z-index: 0;
}
#hsn-svg-math {
    position: relative;
    bottom: 1px;
    background-color: #FFF;
    border-bottom: 1px solid #CACACA;
    z-index: 1;
    -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.1);
    -moz-box-shadow: 0 1px 1px rgba(0,0,0,.1);
    -ms-box-shadow: 0 1px 1px rgba(0,0,0,.1);
    -o-box-shadow: 0 1px 1px rgba(0,0,0,.1);
    box-shadow: 0 1px 1px rgba(0,0,0,.1);
}
/*generate button*/
.hsn-generate-btn {
    position: relative;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    outline-offset: 4px;
    transition: filter 250ms;
    user-select: none;
    touch-action: manipulation;
    border-radius: 12px;
    margin: 0 auto;
    display: block;
    margin-top: 33px;
}

.shadow {
 position: absolute;
 top: 0;
 left: 0;
 width: 100%;
 height: 100%;
 border-radius: 12px;
 background: hsl(0deg 0% 0% / 0.25);
 will-change: transform;
 transform: translateY(2px);
 transition: transform
    600ms
    cubic-bezier(.3, .7, .4, 1);
}

.edge {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(to left, hsl(34 100% 16% / 1) 0%, hsl(27 100% 32% / 1) 8%, hsl(26 100% 32% / 1) 92%, hsl(27 100% 16% / 1) 100%);
}

.front {
    display: block;
    position: relative;
    padding: 12px 27px;
    border-radius: 12px;
    font-size: 1.1rem;
    color: white;
    background: hsl(26 100% 47% / 1);
    will-change: transform;
    transform: translateY(-4px);
    transition: transform    600ms    cubic-bezier(.3, .7, .4, 1);
}

.hsn-generate-btn:hover {
 filter: brightness(110%);
}

.hsn-generate-btn:hover .front {
 transform: translateY(-6px);
 transition: transform    250ms    cubic-bezier(.3, .7, .4, 1.5);
}

.hsn-generate-btn:active .front {
 transform: translateY(-2px);
 transition: transform 34ms;
}

.hsn-generate-btn:hover .shadow {
 transform: translateY(4px);
 transition: transform    250ms    cubic-bezier(.3, .7, .4, 1.5);
}

.hsn-generate-btn:active .shadow {
 transform: translateY(1px);
 transition: transform 34ms;
}

.hsn-generate-btn:focus:not(:focus-visible) {
 outline: none;
}

/*The rest of this file is for main important styles*/

#hsn-generator-container {
    direction: rtl;
    margin: 20px auto;
    display: flex;
    justify-content: space-between;
}
@media (max-width:972px){
#hsn-generator-container {
    flex-direction: column;
}
.hsn-controls {

    margin-bottom: 20px;
}
}
/* تنسيق حقول الاختيار لجعل السهم على اليسار */
#hsn-generator-container select {
    appearance: none;       /* إلغاء سهم المتصفح الافتراضي */
    -webkit-appearance: none;
    -moz-appearance: none;
    
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: left 10px center; /* وضع السهم المخصص على اليسار */
    background-size: 15px;
    padding-left: 35px !important;       /* ترك مساحة للسهم على اليسار */
    padding-right: 10px !important;      /* تقليل المساحة على اليمين */
}
.hsn-controls {
    background: #fdfdfd;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-left: 20px;
    width: 100%;
}
.hsn-row { display: flex; gap: 15px; margin-bottom: 15px; }
.hsn-field { flex: 1; }
.hsn-field label { display: block; font-size: 13px; color: #555; }
.hsn-field input, .hsn-field select { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; background: #fff;color:#000}
.hsn-field input:hover, .hsn-field select:hover {
    border-color: #f06800;
}
.hsn-number-stepper { display: flex; border: 1px solid #ccc; border-radius: 4px; width: fit-content; background: #fff; }
.hsn-number-stepper button { border: none; padding: 0 12px; cursor: pointer; background: #eee; color: #000;    border-radius: 0;font-size: 30px; transition:.3s ease-in-out;}
 .hsn-number-stepper button:hover{     background:#89d334e3; }
.hsn-number-stepper input { width: 50px; border: none; text-align: center; font-weight: bold;background: white; }
.hsn-number-stepper input:focus {    border-style: unset;}
.hsn-tabs {
    display: flex;
    align-items: center;
    margin-bottom: 0px;
    background: #ececec;
}
.print-buttons {
    border-top: 1px solid #c7c4c4;
}
.hsn-preview-area {
    background: #ececec;
    padding: 20px;
    padding-bottom: 20px;
}
.hsn-tab-btn {
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    background: #e4e4e4;
    color: #000000;
}
.hsn-tab-btn:hover{
    color:#282828;
    background:#afafaf4a
}
.hsn-tab-btn.active {
    color: #474747;
    font-weight: bold;
    border-width: 1px 1px 1px 1px;
    border-color: #c2bdbd;
    border-bottom: 0;
    border-radius: 0;
    z-index: 8;
    background: white;
}
.hsn-print-btn { margin-right: auto; background: #333; color: #fff; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; }

    @media (max-width: 490px){
        .hsn-num-d {flex-wrap: wrap;
    justify-content: space-between;}
    }

/* تنسيق أزرار الأوامر */
.hsn-action-btn {
    margin-right: 5px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: white;
}
.hsn-action-btn.generate { background: #2196F3; } /* أزرق */
.hsn-action-btn.print-q { background: #2d3436; color:#fff; }    /* أسود */
.hsn-action-btn.print-a { background: #fdf2e9;  color:#2d3436;} /* وردي/أحمر */

/* إعدادات الطباعة */
@media print {

  .bended-shadow {
    position: relative;
    width: 195px;
    margin: 0;
    transform: rotatey(177deg);
    margin-bottom: 10px;
    filter: brightness(0.3);
    letter-spacing: -5px !important;
    word-spacing: -10px !important;
    line-height: 0.1 !important;
} 
    
}
.hsn-controls h3{
font-size: 18px;
}






/* for Grid options */

.grid-15-mode .ex-box { 
                font-size: 5px !important; 
            }
            /* يمكنك أيضاً تصغير المسافات هنا إذا أردت */
            .grid-15-mode .outer-box { 
                margin: 2px !important; 
            }
.grid-15-mode .sector{
    transform: scale(.9);
    margin: 2px 0 2px 1px!important;
}
























.emoji-picker-container {
    width: 450px;
    max-width: 450px;
    background: #ffffff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 1px solid #e1e1e1;
    font-family: sans-serif;
    position: absolute;
}

/* غلاف التبويبات للسماح بالسحب */
.sticker-tabs-wrapper {
    width: 100%;
    overflow-x: auto; /* يسمح بالسحب الأفقي */
    white-space: nowrap;
    border-bottom: 2px solid #ddd;
    background: #f9f9f9;
}

.sticker-tabs {
    display: inline-block;
    padding: 10px;
}

.sticker-tabs .tab-btn {
    display: inline-block;
color: black;
    padding: 8px 15px;
    margin-right: 5px;
    cursor: pointer;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 20px;
}

.sticker-tabs .tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

/* شبكة الصور */
.sticker-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.sticker-content img {
    width: 100%;
    cursor: pointer;
    transition: transform 0.2s;
}

.sticker-content img:hover {
    transform: scale(1.2);
}

/* تجميل حاوية الأزرار الرئيسية */
.action-buttons-container {
    display: flex;
    gap: 15px;
    border-radius: 12px;
    margin-bottom: 13px;
    justify-content: flex-start;
}

/* تصميم الزر العصري والموحد */
.modern-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 30px; /* زوايا دائرية بالكامل */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease; /* حركة ناعمة */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    outline: none;
}

/* ألوان زر الإيموجي (لون أزرق هادئ) */
.btn-emoji {
    background-color: #4a90e2;
    color: white;
}

.btn-emoji:hover {
    background-color: #357abd;
    transform: translateY(-2px); /* رفعة بسيطة عند التأشير */
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

/* ألوان زر الستيكر (لون أخضر زمردي) */
.btn-sticker {
    background-color: #2ecc71;
    color: white;
}

.btn-sticker:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46, 204, 113, 0.3);
}

/* تأثير عند الضغط المباشر */
.modern-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* تجميل حاويات اللوحات (Placeholder) */
#emoji-picker-placeholder,#stickers-placeholder {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    margin-top: 15px;
    overflow: hidden; /* لضمان بقاء المحتوى داخل الزوايا الدائرية */
    border: 1px solid #e1e8ed;
	    z-index: 9;
}

/* تأكد من أن الـ Tabs لا تزال قابلة للسحب كما برمجناها سابقاً */
.sticker-tabs-wrapper {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid #e1e8ed;
    background: #f8f9fa;
    padding: 5px 0;
}

.eq-sym{middle; margin: 0 3px;}

.entry-content {
    padding: 0 15px 30px 15px;
}
@media (max-width: 544px) {
    .ast-separate-container #content .ast-container
Specificity: (1,2,0)
 {
        padding-left: 0!important;
        padding-right: 0!important;
    }
}

@media (max-width: 768px) {
.ms-main-content {
    margin: 0 auto;
	width: 100%;
}
}