/* ========================================== */
/* ملف CSS موحد لنظام كوست للمحاسبة */
/* يحتوي على جميع الأنماط المطلوبة للنظام */
/* ========================================== */

/* ------------------------- */
/* متغيرات الألوان والأنماط العامة */
/* ------------------------- */
:root {
    /* الألوان الأساسية */
    --color-primary: 0, 128, 0;
    /* لون أساسي للنظام (يستخدم في الترويسة والذيل والازرار لون اخضر) */
    /* RGB اللون بنظام آر جي بي بدون اقواس*/
    --opacity: 50%;
    /* تغميق وتفتيح اللون */
    /* مثال على اللون وتفتيحه
      background: rgba(var(--color-primary), var(--opacity)); */
    --color-secondary: 255, 0, 0;
    /* اللون الثانوي لون احمر */
    --color-light: 255, 219, 200;
    /* لون الخفيف */
    --color-black: 0, 0, 0;
    /* لون خاص لون اسود */
    --color-alert: 71, 58, 56;
    /* لون التنبيه */
    --color-white: 255, 255, 255;
    /* لون ابيض */

    /* الظلال والتأثيرات */
    --shadow-modal: 1px 1px 0px 5px rgb(173 20 22 / 50%);
    /* ظل المودال */
    --shadow: 0px 0px 0px 2px rgb(173 20 22 / 50%);
    /* الظل للعناصر */

    /* هذه مع بعض transition transform */
    --transition: 0.3s;
    /* تأثير الانتقال هذه للعنصر */
    --transform: scale(1.1);
    /* تأثير الانتقال هذه للماوس او غيرها */

    --spacing-unit: 10px;
    /* قوس على الحواف border-radius كالتالي صغير 10 متوسط 15 كبير 30 بالبكسل */

    /* متغيرات المساعد العائم */
    --assistant-btn-size: 100px;
    /* حجم الزر */
    --assistant-z-button: 2000;
    --assistant-z-menu: 1999;
    --assistant-z-widget: 1900;
    --assistant-z-widget-active: 1099;
    /* أعلى من غير النشط */

    /* مثال على ذلك
      .element {
      padding: calc(var(--spacing-unit) * 2);
      width: calc(100% - var(--spacing-unit) * 5);
      margin: var(--spacing-unit) calc(var(--spacing-unit) / 2);
      font-size: clamp(1rem, 2vw + 1rem, 1.5rem);
      box-shadow: var(--card-shadow);
      border-radius: calc(var(--spacing-unit)*3);
      } */

    /* ------------------------- */

    /* تخصيص المتغيرات محليًا (Scoped Variables)
      يمكنك تغيير قيمة المتغير داخل عنصر معين.
      .card {
      --primary-color: #28a745;  تخصيص اللون داخل .card 
      background-color: var(--primary-color);
      padding: var(--spacing-unit);
      } */

    /* ------------------------- */

    /* استخدام المتغيرات في Media Queries
      يمكنك تغيير القيم بناءً على حجم الشاشة.
  
      :root {
      --font-size-base: 20px;
      }
    
      @media (max-width: 768px) {
      :root {
      --font-size-base: 14px;
      }
      }
      body {
      font-size: var(--font-size-base);
      } */

    /* ----------للمزيد الذكاء الاصطناعي---------- */
}

/* ------------------------- */
/* تنسيق الهيكل العام للنظام */
/* ------------------------- */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-rows: 80px 1fr auto;
    height: 100vh;
    background-color: #98df91;
    touch-action: manipulation;
}

.footer-content {
    text-align: center;
    padding: 2px;
    background: #4689eb;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}
    

.cost {
    border: 5px outset pink;
    outline: 0.3rem solid khaki;
    box-shadow: 0 0 0 1.2rem skyblue;
    border-radius: 12px;
    font: bold 1rem sans-serif;
    margin: 20px;
    padding: 2px;
    outline-offset: 0.5rem;
}

/* الهيدر */
header {
    padding: 2px 5px;
    background: #4689eb;
    color: white;
    box-shadow: var(--shadow);
}

.header-top {
    display: flex;
    justify-content: space-between;
    margin: 2px;
    flex-direction: row-reverse;
    align-items: center;
}

.closeButton,
.saveButton,
.toggleBtn {
    background: rgb(0 128 0);
    border: 2px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover {
    background: white;
    color: #3498db;
}

select {
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 0.5rem;
    border-radius: 15px;
    margin: 0 1rem;
}

/* ==================================
      تنسيقات اسم الشركة واسم المستخدم   
  ================================== */

.login-btn {
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 30px;
    /* شكل بيضاوي أنيق */
    background-color: #6cadf5;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid #183f03;
}

.login-btn:hover {
    background-color: #d2c9f1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    outline: none;
}

.logo-slogan {
    display: flex;
    flex-direction: row-reverse;
    align-items: anchor-center;
}

.logo-slogan img {
    width: 50px;
    height: auto;
}

.logo-slogan p {
    font-size: 15px;
}

.company-branch {
    text-align: center;
}

.company-branch h1 {
    font-size: 20px;
}

.company-branch h2 {
    font-size: 15px;
}

.user-section {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    border: 1px solid red;
    padding: 5px;
    border-radius: 30px;
    transition: all 0.3s ease;
}

.user-section:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-section.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.user-section img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-left: 10px;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.user-section:hover img {
    transform: scale(1.05);
}

.user-menu {
    display: none;
    position: absolute;
    top: 65px;
    right: 0;
    /* تغيير من left:0 إلى right:0 لظهور القائمة بجانب صورة المستخدم */
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    height: 350px;
    min-width: 220px;
    overflow: auto;
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.user-menu.active {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.user-menu h4 {
    padding: 15px;
    margin: 0;
    border-bottom: 1px solid #eee;
    color: #333;
    font-size: 16px;
    background-color: #f8f9fa;
}

.user-menu a {
    display: block;
    padding: 15px 25px;
    text-decoration: none;
    color: #333;
    white-space: nowrap;
    border-bottom: 1px solid #f1f1f1;
    transition: all 0.2s ease;
}

.user-menu a:last-child {
    border-bottom: none;
}

.user-menu a:hover {
    background-color: #d2c9f1;
    padding-right: 30px;
}

/* أنماط قائمة الأدوات المنسدلة في قائمة المستخدم */
.user-tools-dropdown {
    position: relative;
    border-top: 1px solid #eee;
    margin-top: 5px;
}

.tools-dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    color: #333;
    background-color: #f8f9fa;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid #eee;
}

.tools-dropdown-trigger:hover {
    background-color: #e9ecef;
}

.dropdown-arrow {
    margin-right: 5px;
    font-size: 10px;
    transition: transform 0.3s ease;
}

.dropdown-arrow.open {
    transform: rotate(180deg);
}

.user-tools-section {
    background-color: white;
    border-bottom: 1px solid #eee;
}

.user-tools-section a {
    display: block;
    padding: 8px 25px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
}

.user-tools-section a:last-child {
    border-bottom: none;
}

.user-tools-section a:hover {
    background-color: #e9ecef;
    padding-right: 30px;
}

/* تنسيق محدد اللغة داخل قائمة المستخدم */
.user-menu .lang-switcher {
    margin: 10px 15px;
    width: calc(100% - 30px);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    color: #333;
    transition: all 0.2s ease;
}

.user-menu .lang-switcher:hover {
    border-color: #4689eb;
}

/* ================================
          تنسيقات المودال   
  ================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s ease-out;
}

.modal-active .modal-content {
    transform: scale(1);
}

.close-btn {
    cursor: pointer;
    float: left;
    font-size: 24px;
    font-weight: bold;
    padding: 5px 10px;
}

/* =========================================
      تنسيقات details خاص بقائمة الزر العائم   
  ========================================== */
details {
    border: 2px solid green;
    border-radius: 15px;
    padding: 0.5em 0.5em 0;
}

details:hover {
    border: 1px solid green;
    background-color: burlywood;
}

summary {
    font-weight: bold;
    margin: -0.5em -0.5em 0;
    padding: 0.5em;
    border-radius: 10px;
}

details[open] {
    padding: 0.5em;
    border: 2px solid red;
}

details[open] summary {
    border-bottom: 3px solid green;
    margin-bottom: 0.5em;
}

img {
    display: block;
    margin: auto;
    max-width: 50vh;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    filter: contrast(100%);
}

/* ================================
          تنسيقات الويدجات   
  ================================ */
.reports-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 30px 0;
}

.report-card {
    /* width: 48%; */
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.report-card:hover {
    transform: scale(1.03);
}

.report-header {
    background-color: #e67e22;
    color: white;
    padding: 15px;
    text-align: center;
}

.report-body {
    padding: 20px;
    background-color: white;
}

.report-body p {
    margin-bottom: 15px;
    font-size: 15px;
}

.report-body ul {
    padding-right: 20px;
}

.report-body ul li {
    margin-bottom: 8px;
    color: #555;
}

.report-card.balance-sheet .report-header {
    background-color: #27ae60;
}

.report-card.income-statement .report-header {
    background-color: #e74c3c;
}

/* ================================
          تنسيقات iframes   
  ================================ */
iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ================================
          تنسيقات التنبيهات   
  ================================ */
#notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #2ecc71;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    display: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* ============================================ */
/* تنسيقات المساعد العائم - Floating Assistant */
/* ============================================ */

/* الزر العائم الأساسي */
#floatingAssistantBtn {
    position: fixed;
    width: var(--assistant-btn-size);
    height: var(--assistant-btn-size);
    background-color: #007bff;
    color: white;
    border: 5px solid red;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: grab;
    z-index: var(--assistant-z-button) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    /* Safari */
    -ms-user-select: none;
    /* IE 10+ */
    touch-action: none;
    /* منع التمرير الافتراضي عند لمس الزر */
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    /* سيتم تعيين Top/Left بواسطة JS */
}

#floatingAssistantBtn:hover {
    background-color: #0056b3;
    border: 5px solid green;
}

#floatingAssistantBtn.dragging {
    cursor: grabbing;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

/* لتوسيط الشعار داخل الزر */
#floatingAssistantBtn img {
    max-width: 65%;
    /* تعديل حجم الشعار حسب الحاجة */
    max-height: 65%;
    display: block;
    /* إزالة أي مسافة إضافية */
    pointer-events: none;
    /* منع الصورة من اعتراض أحداث السحب */
}

/* قائمة الأدوات */
#assistantToolsMenu {
    position: fixed;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 5px;
    z-index: var(--assistant-z-menu);
    display: none;
    min-width: 180px;
    max-height: 300px;
    overflow-y: auto;
}

#assistantToolsMenu.active {
    display: block;
}

#assistantToolsMenu h4 {
    margin: 0 0 5px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    font-size: 1em;
    color: #333;
    text-align: right;
    /* RTL */
    /* i18n candidate */
}

#assistantToolsMenu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#assistantToolsMenu li button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: right;
    /* RTL */
    background: none;
    border: 2px solid #ccc;
    cursor: pointer;
    font-size: 0.95em;
    color: #212529;
    border-radius: 15px;
    transition: background-color 0.2s ease;
    /* i18n candidate for button text */
}

#assistantToolsMenu li button:hover {
    background-color: #e9ecef;
}

/* الويدجات (النوافذ المنبثقة) */
.assistant-widget {
    position: fixed;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: var(--assistant-z-widget);
    /* أقل من الزر العائم ولكن أعلى من الويدجات بشكل */
    display: none;
    min-width: 250px;
    min-height: 150px;
    resize: both;
    overflow: hidden;
    top: 100px;
    left: 100px;
}

.assistant-widget.active {
    display: flex;
    flex-direction: column;
    width: 90%;
    height: 90%;
    max-width: 95%;
    max-height: 95%;
}

/* رأس الويدجت */
.widget-header {
    background-color: #ffc315;
    padding: 5px 10px;
    cursor: move;
    border-bottom: 1px solid red;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    /* منع التمرير عند سحب الرأس باللمس */
}

.widget-header h5 {
    margin: 0;
    font-size: 0.9em;
    flex-grow: 1;
    margin-left: 10px;
    text-align: right;
    /* RTL */
    /* i18n candidate */
}

/* محتوى الويدجت */
.widget-content {
    padding: 10px;
    flex-grow: 1;
    overflow: auto;
    text-align: right;
    /* RTL */
    /* i18n candidate for content placeholders/labels */
}

/* زر إغلاق الويدجت */
.widget-close-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    color: #555;
    padding: 0 5px;
    order: -1;
    /* i18n candidate for aria-label */
}

.widget-close-btn:hover {
    color: #000;
}



/* ===== بداية: كود الشريط الإخباري المحسّن والمنساب ===== */

.news-ticker {
    background-color: #004d00;
    color: white;
    position: relative;
    height: 45px;
    overflow: hidden; /* يبقى مهما لكن الماسك سيقوم بالعمل الرئيسي */

    /* الخطوة 1: تطبيق التلاشي الناعم عند الحواف باستخدام mask */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.ticker-content {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    width: max-content;
    
    /* سيتم تحديد مدة الأنيميشن بواسطة الجافاسكريبت */
    animation-name: final-correct-marquee;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    
    will-change: transform; /* لتحسين الأداء */

    /* الخطوة 3: إضافة انتقال ناعم عند الإيقاف والتشغيل */
    transition: animation-play-state 0.5s ease-in-out;
}

/* إيقاف الحركة عند مرور الماوس */
.news-ticker:hover .ticker-content {
    animation-play-state: paused;
}


/* تنسيق الروابط والنصوص داخل الشريط الإخباري */
.ticker-content span,
.ticker-content a {
    font-size: 16px;
    white-space: nowrap;
    /* الخطوة 3: تنسيق الروابط لتبدو مثل النصوص العادية */
    color: inherit; /* تجعل الرابط يرث اللون الأبيض من الحاوية */
    text-decoration: none; /* تزيل الخط السفلي */
    transition: text-decoration 0.2s ease; /* انتقال ناعم للخط السفلي عند المرور */
}

/* إضافة تأثير مميز عند المرور فوق رابط معين */
.ticker-content a:hover {
    text-decoration: underline; /* إظهار خط سفلي عند المرور فوق الرابط فقط */
    text-decoration-thickness: 1px; /* جعل الخط أنحف وأكثر أناقة */
}


/* * @keyframes: الحركة النهائية التي تعمل بشكل صحيح ومستمر
 * هذه الحركة (من -50% إلى 0) هي الحركة المنطقية لليسار إلى اليمين
 * والتي يقوم المتصفح لديك بعكسها إلى الاتجاه الصحيح الذي نريده
*/
@keyframes final-correct-marquee {
    from {
        transform: translateX(-50%);
    }

    to {
        transform: translateX(0);
    }
}

/* الأنماط المتبقية تبقى كما هي */
.ticker-content span {
    font-size: 16px;
    white-space: nowrap;
}

.ticker-logo-separator {
    height: 25px;
    width: auto;
    vertical-align: middle;
    margin: 0 30px;
}

/* ===== نهاية: كود الشريط الإخباري ===== */






/* ================================
          الاستجابة للشاشات المختلفة
  ================================ */

/* تنسيقات للشاشات الصغيرة (التابليت والهاتف) */
@media (max-width: 800px) {
    .assistant-widget.active {
        width: 100%;
        height: 100%;
    }
}

@media (max-width: 768px) {
    header {
        align-items: flex-start;
    }

    .user-section {
        align-self: center;
    }
}

/* ================================
          نهاية ملف CSS الموحد
  ================================ */