/********** Template CSS **********/
:root {
    --primary: #EB1616;
    --secondary: #191C24;
    --light: #6C7293;
    --dark: #000000;
}

/* IranYekan Font Family */
body {
    font-family: iranyekan_regular, iranyekan, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
    font-family: iranyekan_regular, iranyekan, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.back-to-top {
    position: fixed;
    display: none;
    right: 45px;
    bottom: 45px;
    z-index: 99;
}

html[dir="rtl"] .back-to-top {
    right: auto;
    left: 45px;
}


/*** Spinner ***/
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
}


/*** Button ***/
.btn {
    transition: .5s;
}

.btn-square {
    width: 38px;
    height: 38px;
}

.btn-sm-square {
    width: 32px;
    height: 32px;
}

.btn-lg-square {
    width: 48px;
    height: 48px;
}

.btn-square,
.btn-sm-square,
.btn-lg-square {
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
    border-radius: 50px;
}


/*** Layout ***/
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    height: 100vh;
    overflow-y: auto;
    background: var(--secondary);
    transition: 0.5s;
    z-index: 999;
}

.content {
    margin-left: 250px;
    min-height: 100vh;
    background: var(--dark);
    transition: 0.5s;
}

.content-full {
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--dark);
    overflow-x: hidden;
}

/* Ensure full width containers */
.content-full .container-fluid {
    width: 100%;
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: 0;
    margin-right: 0;
}

/* Remove any default body/html padding/margin that might interfere */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

/* RTL Layout Support */
html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

html[dir="rtl"] .content {
    margin-left: 0;
    margin-right: 250px;
}

html[dir="rtl"] .content-full {
    margin-right: 0;
}

@media (min-width: 992px) {
    .sidebar {
        margin-left: 0;
    }

    html[dir="rtl"] .sidebar {
        margin-right: 0;
    }

    .sidebar.open {
        margin-left: -250px;
    }

    html[dir="rtl"] .sidebar.open {
        margin-left: auto;
        margin-right: -250px;
    }

    .content {
        width: calc(100% - 250px);
    }

    .content.open {
        width: 100%;
        margin-left: 0;
    }

    html[dir="rtl"] .content.open {
        margin-right: 0;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        margin-left: -250px;
    }

    html[dir="rtl"] .sidebar {
        margin-left: auto;
        margin-right: -250px;
    }

    .sidebar.open {
        margin-left: 0;
    }

    html[dir="rtl"] .sidebar.open {
        margin-right: 0;
    }

    .content {
        width: 100%;
        margin-left: 0;
    }

    html[dir="rtl"] .content {
        margin-right: 0;
    }
}


/*** Navbar ***/
.sidebar .navbar .navbar-nav .nav-link {
    padding: 7px 20px;
    color: var(--light);
    font-weight: 500;
    border-left: 3px solid var(--secondary);
    border-radius: 0 30px 30px 0;
    outline: none;
}

html[dir="rtl"] .sidebar .navbar .navbar-nav .nav-link {
    border-left: none;
    border-right: 3px solid var(--secondary);
    border-radius: 30px 0 0 30px;
}

.sidebar .navbar .navbar-nav .nav-link:hover,
.sidebar .navbar .navbar-nav .nav-link.active {
    color: var(--primary);
    background: var(--dark);
    border-color: var(--primary);
}

.sidebar .navbar .navbar-nav .nav-link i {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    border-radius: 40px;
}

.sidebar .navbar .navbar-nav .nav-link:hover i,
.sidebar .navbar .navbar-nav .nav-link.active i {
    background: var(--secondary);
}

.sidebar .navbar .dropdown-toggle::after {
    position: absolute;
    top: 15px;
    right: 15px;
    border: none;
    content: "\f107";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    transition: .5s;
}

html[dir="rtl"] .sidebar .navbar .dropdown-toggle::after {
    right: auto;
    left: 15px;
}

.sidebar .navbar .dropdown-toggle[aria-expanded=true]::after {
    transform: rotate(-180deg);
}

.sidebar .navbar .dropdown-item {
    padding-left: 25px;
    border-radius: 0 30px 30px 0;
    color: var(--light);
}

html[dir="rtl"] .sidebar .navbar .dropdown-item {
    padding-left: 0;
    padding-right: 25px;
    border-radius: 30px 0 0 30px;
}

.sidebar .navbar .dropdown-item:hover,
.sidebar .navbar .dropdown-item.active {
    background: var(--dark);
}

.content .navbar .navbar-nav .nav-link {
    margin-left: 25px;
    padding: 12px 0;
    color: var(--light);
    outline: none;
}

html[dir="rtl"] .content .navbar .navbar-nav .nav-link {
    margin-left: 0;
    margin-right: 25px;
}

.content .navbar .navbar-nav .nav-link:hover,
.content .navbar .navbar-nav .nav-link.active {
    color: var(--primary);
}

.content .navbar .sidebar-toggler,
.content .navbar .navbar-nav .nav-link i {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    border-radius: 40px;
}

.content .navbar .dropdown-item {
    color: var(--light);
}

.content .navbar .dropdown-item:hover,
.content .navbar .dropdown-item.active {
    background: var(--dark);
}

.content .navbar .dropdown-toggle::after {
    margin-left: 6px;
    vertical-align: middle;
    border: none;
    content: "\f107";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    transition: .5s;
}

html[dir="rtl"] .content .navbar .dropdown-toggle::after {
    margin-left: 0;
    margin-right: 6px;
}

.content .navbar .dropdown-toggle[aria-expanded=true]::after {
    transform: rotate(-180deg);
}

@media (max-width: 575.98px) {
    .content .navbar .navbar-nav .nav-link {
        margin-left: 15px;
    }

    html[dir="rtl"] .content .navbar .navbar-nav .nav-link {
        margin-left: 0;
        margin-right: 15px;
    }
}


/*** Date Picker ***/
.bootstrap-datetimepicker-widget.bottom {
    top: auto !important;
}

.bootstrap-datetimepicker-widget .table * {
    border-bottom-width: 0px;
}

.bootstrap-datetimepicker-widget .table th {
    font-weight: 500;
}

.bootstrap-datetimepicker-widget.dropdown-menu {
    padding: 10px;
    border-radius: 2px;
}

.bootstrap-datetimepicker-widget table td.active,
.bootstrap-datetimepicker-widget table td.active:hover {
    background: var(--primary);
}

.bootstrap-datetimepicker-widget table td.today::before {
    border-bottom-color: var(--primary);
}


/*** Testimonial ***/
.progress .progress-bar {
    width: 0px;
    transition: 2s;
}


/*** Testimonial ***/
.testimonial-carousel .owl-dots {
    margin-top: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.testimonial-carousel .owl-dot {
    position: relative;
    display: inline-block;
    margin: 0 5px;
    width: 15px;
    height: 15px;
    border: 5px solid var(--primary);
    border-radius: 15px;
    transition: .5s;
}

.testimonial-carousel .owl-dot.active {
    background: var(--dark);
    border-color: var(--primary);
}

/* RTL adjustments */
html[dir="rtl"] body {
    text-align: right;
}

html[dir="rtl"] .sidebar {
    border-inline-end: none;
    border-inline-start: 1px solid rgba(255, 255, 255, 0.1);
}

html[dir="rtl"] .sidebar .navbar .navbar-nav .nav-link .me-2 {
    margin-inline-start: 0.5rem !important;
    margin-inline-end: 0 !important;
}

/* Utilities */
.card {
    background-color: var(--secondary);
    border-radius: 10px;
    -webkit-box-shadow: 0 0 28px rgba(0, 0, 0, .08);
    box-shadow: 0 0 28px rgba(0, 0, 0, .08);
}

.card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.list-group-flush > .list-group-item {
    border-width: 0 0 1px;
    padding: 0.75rem 0;
    color: var(--light);
}

.list-group-flush > .list-group-item:last-child {
    border-bottom: 0;
}

.table {
    color: var(--light);
}

.table thead th {
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table tbody tr:hover {
    background-color: rgba(235, 22, 22, 0.1);
}

.input-group-sm > .form-control {
    min-width: 200px;
}

.card-body .fs-3,
.card-body .fs-4 {
    direction: ltr;
    display: inline-block;
}

.chart-placeholder {
    height: 220px;
    background: repeating-linear-gradient(
        135deg,
        rgba(235, 22, 22, 0.1),
        rgba(235, 22, 22, 0.1) 10px,
        rgba(235, 22, 22, 0.05) 10px,
        rgba(235, 22, 22, 0.05) 20px
    );
    border-radius: 0.75rem;
}

.status-up {
    color: #198754;
}

.status-down {
    color: #dc3545;
}

.chart-card canvas {
    width: 100%;
    min-height: 260px;
}

/* Fix chart scrolling issue */
canvas {
    max-width: 100%;
    display: block;
}

/* Chart container styles */
canvas[id*="Chart"] {
    max-height: 100%;
}

/* Prevent chart containers from causing scroll */
.bg-secondary canvas {
    position: relative !important;
}

/* Ensure chart containers don't expand beyond viewport */
.bg-secondary div[style*="position: relative"] {
    overflow: hidden;
}

.bg-secondary div[style*="height: 220px"] {
    max-height: 220px;
}

.bg-secondary div[style*="height: 260px"] {
    max-height: 260px;
}

/* Table adjustments for RTL */
html[dir="rtl"] .table {
    text-align: right;
}

html[dir="rtl"] .table th.text-end,
html[dir="rtl"] .table td.text-end {
    text-align: left;
}

/* Form adjustments for RTL */
html[dir="rtl"] .form-control,
html[dir="rtl"] .form-select {
    text-align: right;
}

html[dir="rtl"] .input-group-text {
    border-left: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

html[dir="rtl"] .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-left: 0;
    margin-right: -1px;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

html[dir="rtl"] .input-group > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating) {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
