/* body {
    background: #f5f5f5;
} */

.grid-stack { 
    /* background: #f5f5f5;  */
    margin: 20px;
}

.grid-stack-item-content { 
    background-color: white; 
    border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.5); 
    padding: 15px; 
    overflow: hidden; 
    direction: rtl;
}

.card-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
    direction: ltr;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    margin-bottom: 15px;
}

.card-content {
    color: #666;
}



.chart-container {
    height: 100%;
    width: 100%;
    position: relative;
}

.transformChart {
    height: 93%;
    width: 100%;
    position: relative;
}

.controls {
    margin: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.select-container {
    position: relative;
    min-width: 110px;
    flex: 1;
}

.dropdown-select {
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.dropdown-select:hover {
    border-color: #007bff;
    background: #fff;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #666;
    margin-right: 8px;
}

.checkbox-list {
    min-width: 200px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-top: 5px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.selected-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: capitalize;
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.selected-item {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}

#sourceFilter {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: 100%;
    min-height: 100px;
    max-height: 200px;
}

#sourceFilter option {
    padding: 5px;
    margin: 2px 0;
}

#sourceFilter option:checked {
    background-color: #007bff;
    color: white;
}

#sourceFilter option[value="all"] {
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}

button {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 120px;
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    cursor: pointer;
    text-transform: capitalize;
}

.checkbox-item:hover {
    background-color: #f5f5f5;
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* .checkbox-item:first-child {
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
    margin-bottom: 8px;
    font-weight: bold;
} */

.search-box {
    padding: 0 0 12px 0;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 12px;
}

.search-box input {
    width: 80%;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: #007bff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.checkbox-item.hidden {
    display: none;
}

.no-results {
    padding: 10px;
    color: #666;
    text-align: center;
    font-style: italic;
}

.loading-spinner {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 10px;
    height: 10px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top-color: #9ea2a7;
    animation: spin 1s linear infinite;
    z-index: 1000;
}


.table-loading-spinner {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top-color: #9ea2a7;
    animation: spin 1s linear infinite;
    z-index: 1000;
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.dataTables_processing {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
}

.dataTable {
    position: relative;
    min-height: 200px;
}

/* .dataTables_processing > div:not(.loading-spinner) {
    display: none !important;
} */

.grid-stack-item-content::-webkit-scrollbar {
    width: 8px;
}

.grid-stack-item-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.grid-stack-item-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.grid-stack-item-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.table-container {
    padding: 15px;
    overflow: auto;
    margin: 10px;
    /* position: relative; */
    /* width: 100%;
    height: 100%; */
}

.DailyStatsTable-container {
    padding: 15px;
    overflow: visible;
    margin: 10px;
    position: relative;
}
.table-container {
    padding: 15px;
    overflow: auto;
    margin: 10px;
    /* position: relative; */
    /* width: 100%;
    height: 100%; */
}

#leadsTable {
    width: 100% !important;
}

.dataTables_wrapper {
    position: relative;
    /* padding: 10px; */
}

/* تخصيص مظهر الجدول */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}



.date-range-container {
    display: flex;
    gap: 10px;
    align-items: center;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.date-presets {
    flex: 1;
    min-width: 150px;
}

.date-presets select {
    width: 100%;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;  /* يرث نوع الخط من العنصر الأب */
}

.date-presets select:hover {
    border-color: #007bff;
}

.date-presets select:focus {
    outline: none;
    border-color: #007bff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.date-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.flatpickr-calendar {
    direction: rtl;
}


/* تحسين مظهر التوضيحات (tooltip) */
/* .echarts-tooltip {
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 8px !important;
    padding: 10px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e0e0e0 !important;
} */

/* تحسين مظهر حالة التحميل */
/* .loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
} */

/* .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
} */



.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin: 0 10px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #2196F3;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-container {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.toggle-label {
    margin-right: 8px;
    font-size: 14px;
    color: #666;
}

#funnelChart {
    width: 100% !important;
    height: calc(100% - 40px) !important;
    min-height: 300px;
}

#dailyChart {
    width: 100% !important;
    height: calc(100% - 40px) !important;
    min-height: 300px;
}

/* تنسيق جدول لإحصائيات اليومية */
#dailyStatsTable {
    width: 100% !important;
    margin: 0 !important;
    border-collapse: collapse !important;
}

/* تنسيق رأس الجدول */
#dailyStatsTable thead th {
    padding: 8px 15px;
    background-color: #fff;
    border-bottom: 2px solid #dee2e6 !important;
    margin-bottom: 0 !important;
}

/* تنسيق خلايا الجدول */
#dailyStatsTable tbody td {
    padding: 8px 15px;
    /* border-bottom: 1px solid #e9ecef; */
}

/* إزالة المسافات من الحاوية الرئيسية */
.dataTables_wrapper {
    margin: 0 !important;
    padding: 0 !important;
}

/* تأكيد إزالة أي مسافات إضافية */
.dataTables_scrollHeadInner {
    padding: 0 !important;
    margin: 0 !important;
}

/* تنسيق منطقة البحث */
.dataTables_filter {
    margin-bottom: 10px;
}

.selected-gender-text,
.selected-offers-text,
.selected-cities-text,
.selected-lead_type-text,
.selected-status-text {
    text-transform: capitalize;
}

.reset-filters-btn {
    background-color: #dc3545;  /* لون أحمر */
}

.reset-filters-btn:hover {
    background-color: #c82333;
}

/* تعديل نمط العرض المصغر */
.stats-container {
    transition: all 0.3s ease;
    transform-origin: top center;
    height: 100%;
    overflow: visible;
}

.stats-container.compact-medium {
    transform: scale(0.8);
    height: 125%;
    margin-bottom: -25%;
}

.stats-container.compact-small {
    transform: scale(0.6);
    height: 166%;
    margin-bottom: -66%;
}

.stats-container.compact-tiny {
    transform: scale(0.3);
    height: 333%;
    margin-bottom: -233%;
}

/* تنسيق زر التبديل */
.toggle-view-btn {
    float: right;
    margin-top: -5px;
    padding: 5px 10px;
    font-size: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-view-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.toggle-view-btn i {
    margin-right: 5px;
}

/* تنسيق مجموعة الأزرار */
.view-buttons {
    display: flex;
    gap: 5px;
}

/* تنسيق زر التبديل */
.toggle-view-btn {
    padding: 5px 10px;
    font-size: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
}

.toggle-view-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.toggle-view-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}

.toggle-view-btn i {
    margin-right: 5px;
}

/* تحديث تنسيق العنوان */
.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    margin-bottom: 15px;
}

/* تنسيق قسم أزرار الأشهر */
.months-filter {
    margin: 10px 0;
    padding: 0 10px;
}

.months-buttons {
    margin-bottom: 15px;
}

.month-btn[data-month="all"] {
    width: 100%;
    padding: 10px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.month-btn[data-month="all"]:hover {
    background-color: #5a6268;
}

.month-btn[data-month="all"].active {
    background-color: #007bff;
}

.year-dropdown {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: visible;
    position: relative;
    background-color: white;
}

.months-dropdown {
    display: none;
    padding: 15px;
    background-color: white;
    position: absolute;
    /* width: 100%; */
    z-index: 1000;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    left: 0;
    right: 0;
    margin: 0 auto;
}

.months-dropdown.show {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.year-header {
    padding: 12px 15px;
    background-color: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.year-header:hover {
    background-color: #e9ecef;
}

.year-header.active {
    background-color: #007bff;
    color: white;
}

.year-header i.fa-calendar-alt {
    margin-right: 10px;
    color: #007bff;
}

.year-header.active i {
    color: white;
}

.year-header i.fa-chevron-down {
    transition: transform 0.3s ease;
}

.year-header.active i.fa-chevron-down {
    transform: rotate(180deg);
}

.month-btn {
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    color: #495057;
    width: 100%;
    white-space: nowrap;
}

.month-btn:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    border-color: #adb5bd;
    color: #212529;
}

.month-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 600;
}

/* تحسين مظهر السنة النشطة */
.year-header.active {
    background-color: #007bff;
    color: white;
    border-bottom-color: #0056b3;
}

.year-header.active i {
    color: white;
}

/* تحسين مظهر حاوية السنوات */
.years-container {
    display: flex;
    gap: 15px;
    justify-content: stretch;
    margin-top: 10px;
    position: relative;
    width: 100%;
}

/* تعديل المسافات للحاوية الرئيسية */
.DailyStatsTable-container {
    margin-top: 0;
}

/* تنسيق زر التصدير */
.export-excel-btn {
    background-color: #28a745 !important;
    color: white !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    margin: 5px !important;
    position: relative !important;
    min-width: 100px !important;
}

.export-excel-btn:disabled {
    background-color: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 0.65 !important;
}

.export-excel-btn.loading {
    background-color: #218838 !important;
    pointer-events: none !important;
    animation: pulse 1s infinite !important;
}

/* إضافة تأثير النبض */
@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.90);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.export-excel-btn .loading-spinner {
    display: none;
}

.export-excel-btn.loading .loading-spinner {
    display: inline-block;
}

.export-excel-btn.loading .button-text {
    visibility: hidden;
}

.export-excel-btn .loading-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* تنسيق منطقة الأزرار */
.dt-buttons {
    margin-bottom: 10px !important;
}

#transformChart {
    width: 100% !important;
    height: 100% !important;
}

/* إخفاء البطاقة الرابعة من العرض */
.grid-stack-item:nth-child(4) {
    position: absolute;
    left: -9999px;
    visibility: hidden;}

/* إخفاء الجدول نفسه */
#leadsTable_wrapper {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

.all-months-btn {
    width: 100%;
    padding: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.all-months-btn:hover {
    background-color: #0056b3;
}