/* Global Box Sizing */
*,
::after,
::before {
    box-sizing: border-box;
}

/* Font Awesome */
@font-face {
    font-family: "Font Awesome";
    font-style: normal;
    font-weight: normal;
    font-display: auto;
    src: url(fonts/fontawesome-webfont.woff2) format("woff2"),
         url(fonts/fontawesome-webfont.woff) format("woff"),
         url(fonts/fontawesome-webfont.ttf) format("truetype"),
         url(fonts/fontawesome-webfont.svg) format("svg")
}

/* Font Awesome Icons */
.fa {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    font-family: "Font Awesome";
}

.fa-user:before { content: "\f007"; }
.fa-check:before { content: "\f00c"; }
.fa-home:before { content: "\f015"; }
.fa-lock:before { content: "\f023"; }
.fa-barcode:before { content: "\f02a"; }
.fa-book:before { content: "\f02d"; }
.fa-print:before { content: "\f02f"; }
.fa-edit:before { content: "\f044"; }
.fa-chevron-left:before { content: "\f053"; }
.fa-chevron-right:before { content: "\f054"; }
.fa-plus:before { content: "\f067"; }
.fa-eye:before { content: "\f06e" !important; }
.fa-eye-slash:before { content: "\f070"; }
.fa-cart-shopping:before { content: "\f07a"; }
.fa-chart-bar:before { content: "\f080"; }
.fa-credit-card:before { content: "\f09d"; }
.fa-users:before { content: "\f0c0"; }
.fa-bars:before { content: "\f0c9"; }
.fa-power-off:before { content: "\f011"; }
.fa-truck:before { content: "\f0d1"; }
.fa-money-bill:before { content: "\f0d6"; }
.fa-trash:before { content: "\f1f8"; }
.fa-history:before { content: "\f1da"; }
.fa-chart-line:before { content: "\f201"; }
.fa-shop:before { content: "\f54f"; }

/* Body Styles */
body {
    margin: 0;
    font-family: "Source Sans Pro",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: left;
    background-color: #f5fafd;
}

h1 {
    font-size: 1.7rem;
}
h2 {
    font-size: 1.5rem;
}
h3 {
    font-size: 1.2rem;
}
h1,
h2,
h3 {
    font-weight: 500;
    margin: 0;
}

a {
    text-decoration: none;
    color: #007bff;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background-color: #e9ecee;
}

th,
td {
    padding: .5rem;
    border-bottom: solid 1px #c2c7d0;
}

.sub-row {
    background-color: rgba(0, 0, 0, .03);
}

tr:hover {
    background-color: rgba(0, 0, 0, .05);
}

.actions-buttons {
    display: flex;
    gap: .5em;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.is-active {
    color: #166534;
    background-color: #dcfce7;
}

.status-badge.is-inactive {
    color: #991b1b;
    background-color: #fee2e2;
}

/* Form Styles */
form,
form > div {
    display: flex;
    flex-direction: column;
}

form {
    gap: 1rem;
}

form > div {
    position: relative;
}

label {
    display: inline-block;
}

input:not([type=checkbox]),
select,
textarea {
    padding: 0.375rem 0.75rem;
    font-family: "Source Sans Pro",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid hsl(210deg 13.95% 83.14%);
    border-radius: 0.25rem;
    box-shadow: inset 0 0 0 transparent;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
}

input[type=submit] {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
    box-shadow: none;
    transition: color .15s ease-in-out,background-color .15s ease-in-out;
}

input[type=submit]:hover {
    color: #fff;
    background-color: #0069d9;
    border-color: #0062cc;
}

input[type=submit]:not(:disabled) {
    cursor: pointer;
}

.dialog form input:not([type=checkbox]),
.dialog form select,
.dialog form textarea {
    display: block;
    width: 100%;
}

.dialog form > div > .ss-content.ss-relative {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    width: 100%;
    height: auto;
}

textarea {
    min-height: 100px;
}

button,
.ss-main {
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    background-color: hsl(0deg 0% 94.12%);
    border: 1px solid hsl(210deg 13.95% 83.14%);
}

button:hover,
.ss-main:hover {
    background-color: hsl(0deg 0.37% 97.38%);
    border: 1px solid hsl(210deg 16.13% 86.06%);
}

button.small {
    padding: 0.15rem 0.3rem;
    font-size: .9rem;
    color: #007bff;
}

button.delete-link {
    color: #dc3545;
}

.email-field {
    background: url(../images/log.png) no-repeat;
    padding-left: 36px!important;
}

.password-field {
    background: url(../images/pwd.png) no-repeat;
    padding-left: 36px!important;
}

i.fa-eye-slash {
    position: absolute;
    right: 15px;
    top: 39px;
    cursor: pointer;
}

/* Sidebar Styles */
.main-sidebar {
    position: absolute;
    height: 100vh;
    width: 250px;
    top: 0;
    left: -250px;
    overflow-y: hidden;
    z-index: 20;
    color: #c2c7d0;
    background-color: #343a40;
    transition: left .3s ease-in-out;
}

.main-sidebar.sidebar-open {
    left: 0;
    box-shadow: 0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22)!important;
}

.sidebar {
    height: calc(100% - 4rem);
    overflow-y: auto;
    padding-bottom: 0;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    padding-top: 0;
}

.brand {
    background-color: #007bff;
    color: white;
    text-align: center;
    padding: 0.5rem;
}

.sidebar nav > ul {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: .2rem;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.sidebar nav > ul > li {
    margin-bottom: 0;
}

.sidebar nav > ul > li > a {
    display: block;
    padding: 0.5rem 1rem;
    color: #c2c7d0;
    background-color: transparent;
    border-radius: .25rem;
}

.sidebar nav > ul > li > a:hover {
    background-color: rgba(255,255,255,.1);
    color: #fff;
}

.sidebar nav > ul > li > a.active {
    background-color: #007bff;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
}

.sidebar nav > ul > li  i {
    font-size: 1.1rem;
    margin-right: .2rem;
    text-align: center;
    width: 1.6rem;
}

/* Content Wrapper Styles */
.content-wrapper {
    position: relative;
    height: 100vh;
    overflow: auto;
}

.menu-button {
    position: fixed;
    top: 1rem;
    z-index: 30;
}

.menu-button {
    left: 1rem;
}

/* Page Header Styles */
#entete {
    display: none;
}

.content-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    position: sticky;
    top: 0;
    padding: 0.5rem 1rem;
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    overflow: auto;
    z-index: 10;
}

.content-header > :first-child {
    margin-left: 2rem;
}

.document-header-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.document-number-input {
    width: 5rem;
}

.document-header-meta {
    display: flex;
    flex: 1 1 100%;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.document-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.document-meta-label {
    font-weight: 600;
    color: #495057;
}

.document-meta-select {
    width: 100%;
}

.document-relation-select {
    display: inline-flex;
    width: 100%;
    min-width: 0;
}

.document-print-action {
    display: flex;
    gap: 0.75rem 1rem;
    align-items: center;
}

.document-print-action label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.report-header-title {
    margin: 0;
}

.report-form {
    display: flex;
    flex: 1 1 100%;
    flex-direction: column;
    gap: 0.75rem;
}

.report-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.report-form-type {
    max-width: 100%;
}

.report-form-actions {
    display: flex;
}

.report-form input[type=date] {
    width: 100%;
}

.report-form-actions input[type=submit] {
    width: 100%;
}

.filter-toggle-button {
    display: inline-flex;
    align-items: center;
}

.collapsible-filters {
    width: 100%;
}

/* Content Body Styles */
.content-body {
    padding: 1rem;
    overflow: auto;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
}

.pagination button.active {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.pagination-summary {
    color: #495057;
}

.log-description {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-entry {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.55rem;
    background-color: #e9f0f7;
}

.log-entry-label {
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.log-entry-value {
    color: #0f172a;
}

.dashboard-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.dashboard-grid-stats {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.dashboard-grid-finance {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-stat {
    gap: 0.45rem;
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 1rem;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.dashboard-stat-label {
    color: rgba(15, 23, 42, 0.72);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-stat-value {
    font-size: 1.8rem;
    line-height: 1.1;
    color: #0f172a;
}

.dashboard-section-title {
    margin-bottom: 0;
    font-size: 1.2rem;
}

.dashboard-stat-users {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
}

.dashboard-stat-products {
    background: linear-gradient(135deg, #dcfce7 0%, #f0fdf4 100%);
}

.dashboard-stat-customers {
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
}

.dashboard-stat-suppliers {
    background: linear-gradient(135deg, #fee2e2 0%, #fff1f2 100%);
}

.dashboard-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.dashboard-chart-card {
    min-height: 320px;
    border-radius: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.dashboard-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-card-meta {
    margin: 0.25rem 0 0;
    color: #64748b;
}

.dashboard-line-chart {
    width: 100%;
    display: block;
}

.dashboard-side-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.dashboard-side-grid > .card {
    border-radius: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.dashboard-table-wrap {
    overflow: auto;
}

.dashboard-link {
    font-weight: 600;
}

.dashboard-top-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-top-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 0.9rem;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.dashboard-top-rank {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0f766e 0%, #0ea5e9 100%);
}

.dashboard-top-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.dashboard-top-name {
    font-weight: 700;
    color: #0f172a;
}

.dashboard-top-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: #64748b;
}

.dashboard-top-empty {
    color: #64748b;
    padding: 0.5rem 0;
}

/* Card Styles */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border-radius: 0.25rem;
    box-shadow: 0 0 1px rgba(0,0,0,.125),0 1px 3px rgba(0,0,0,.2);
    padding: 1rem;
    overflow: hidden;
}

.chart-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Dialog Styles */
.dialog {
    min-width: 400px;
    max-width: min(calc(100vw - 2rem), 720px);
    border: solid 1px hsl(0, 0%, 80%);
    box-shadow: 1px 1px 5px hsl(0, 0%, 20%);
    padding: 1rem;
    overflow: visible;
}

.dialog:not([open]) {
    display: none;
}

.dialog::backdrop {
    background-color: rgba(0, 0, 0, .5);
}

.dialog[open] {
    display: block;
}

.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, .5);
    background-image: url(../images/loader.gif);
    background-repeat: no-repeat;
    background-position: center;
    z-index: 1000000;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 250px;
    margin-bottom: 10px;
    padding: 12px 16px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    animation: fadeIn 0.3s ease, fadeOut 0.3s ease 3.7s;
}

.toast.success {
    background-color: #28a745;
}

.toast.error {
    background-color: #dc3545;
}

.toast.info {
    background-color: #007bff;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* Responsive Styles */

@media (min-width:1000px) {
    .dashboard-side-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width:768px) {
    .main-sidebar {
        left: 0;
        box-shadow: 0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22)!important;
    }

    .menu-button {
        display: none;
    }

    .content-wrapper {
        margin-left: 250px;
    }

    .content-header > :first-child {
        margin-left: 0;
    }

    .page-title {
        margin-left: 0;
    }

    .document-header-meta {
        flex: 1 1 auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .document-meta-item {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .document-meta-select {
        width: auto;
    }

    .document-relation-select {
        width: 300px;
    }

    .document-print-action {
        flex: 0 0 auto;
        justify-content: flex-end;
        margin-left: auto;
    }

    .filter-toggle-button {
        display: none;
    }

    .report-form {
        flex: 1 1 auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .report-form-field {
        flex-direction: row;
        align-items: center;
        min-width: 140px;
    }

    .report-form input[type=date] {
        width: auto;
    }

    .report-form-type {
        min-width: 180px;
    }

    .report-form-actions input[type=submit] {
        width: auto;
    }
}

@media (max-width:767.98px) {
    .collapsible-filters {
        display: none;
    }

    .collapsible-filters.is-open {
        display: flex;
    }
}

/* Print Styles */
@media print {
    .dialog,
    .main-sidebar,
    .content-header,
    .button-group,
    button,
    .ss-arrow,
    input
    {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .main-sidebar {
        position: relative;
        height: unset;
        width: unset;
        left: 0;
    }

    .brand {
        color: black;
        font-size: 18pt;
        text-align: left;
    }

    .content-wrapper {
        margin-left: 0 !important;
        height: unset;
    }

    #entete {
        display: block;
    }

    .card {
        box-shadow: unset;
    }

    .ss-main {
        border: 0;
        width: unset;
        font-size: 1.7rem;
        font-weight: 500;
        padding: 0;
        color: #212529;
    }

    th, td {
        border: solid 1px #c2c7d0;
    }

    .bordereau th:nth-child(4),
    .bordereau th:nth-child(5),
    .bordereau td:nth-child(4),
    .bordereau td:nth-child(5),
    .bordereau tfoot,
    th:last-child,
    td:last-child  {
        display: none;
    }

    canvas {
        width: 100%;
        height: auto;
    }
}
