@font-face {
    font-family: 'Open Sans';
    src: url('../fonts/OpenSans.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-color: #279e00;
    --primary-dark: #1f7d00;
    --primary-soft: #eaf8e6;
    --secondary-color: #0f766e;
    --danger-color: #dc3545;
    --warning-color: #f59e0b;
    --info-color: #0d6efd;
    --bg-body: #f4f7f3;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-soft: #f8faf7;
    --text-main: #172018;
    --text-muted: #6b7280;
    --border-color: #e1e7df;
    --shadow-soft: 0 10px 25px rgba(15, 23, 42, .07);
    --shadow-card: 0 14px 35px rgba(15, 23, 42, .09);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --lightGray-color: #e8e8e8;
    --darkGray-color: #a9a9a9;
    --pink-color: #ff0047;
    --green-color: #c9df25;
    --orange-color: #ff9900;
}

/* Base */
html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Open Sans', Arial, sans-serif;
    color: var(--text-main);
    background: radial-gradient(circle at top right, rgba(39, 158, 0, .08), transparent 35%), linear-gradient(180deg, #f7faf6 0%, var(--bg-body) 100%);
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

    a:hover {
        color: var(--primary-dark);
    }

/* Header / Navbar */
body header {
    background: var(--bg-header) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.navbar {
    min-height: 72px;
    border-bottom: 0 !important;
}

.navbar-brand img {
    max-height: 54px;
}

.navbar-nav {
    gap: .25rem;
}

.nav-link {
    border-radius: 999px;
    padding: .55rem .85rem !important;
    transition: .2s ease;
    font-weight: 600;
}

    .nav-link:hover {
        background: var(--primary-soft);
        color: var(--primary-dark) !important;
    }

    .nav-link.active {
        font-weight: 800;
        color: var(--primary-dark) !important;
        background: var(--primary-soft);
    }

    .nav-link i {
        margin-left: .25rem;
    }

body header .dropdown:not(.nav-item) {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #fff;
}

.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.dropdown-item {
    padding: .7rem 1rem;
}

    .dropdown-item:hover {
        background: var(--primary-soft);
        color: var(--primary-dark);
    }

/* Mobile drawer */
#mobileNav.offcanvas {
    width: 280px;
    border-left: 0;
    box-shadow: var(--shadow-card);
}

#mobileNav .offcanvas-header {
    border-bottom: 1px solid var(--border-color);
}

#mobileNav .list-group-item {
    border: 0;
    padding: .9rem 1.1rem;
    font-weight: 700;
}

    #mobileNav .list-group-item:hover,
    #mobileNav .list-group-item.active {
        color: var(--primary-dark);
        background: var(--primary-soft);
    }

#mobileNav .collapse .list-group-item {
    padding-right: 2rem;
}

[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform .2s;
}

[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Main content */
main {
    animation: pageFade .18s ease-in-out;
}

@keyframes pageFade {
    from {
        opacity: .65;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.btn {
    border-radius: 999px;
    font-weight: 700;
    padding: .55rem 1rem;
    transition: .18s ease;
}

    .btn:hover {
        transform: translateY(-1px);
    }

.btn-sm {
    padding: .35rem .75rem;
}

.btn-primary,
.bg-primary {
    color: white !important;
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

    .btn-primary:hover {
        background-color: var(--primary-dark) !important;
        border-color: var(--primary-dark) !important;
    }

.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

    .btn-outline-primary:hover {
        color: white !important;
        background-color: var(--primary-color) !important;
    }

.btn-success {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

    .btn-success:hover {
        background-color: var(--primary-dark);
        border-color: var(--primary-dark);
    }

.btn-white {
    color: #000 !important;
    background-color: #fff !important;
    border: 1px solid var(--border-color) !important;
}

    .btn-white:hover {
        background-color: #f8f9fa !important;
    }

.btn-circle {
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    text-decoration: none;
}

/* Focus */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(39, 158, 0, .18) !important;
    border-color: var(--primary-color) !important;
}

/* Forms */
.form-control,
.form-select {
    border-radius: var(--radius-md);
    border-color: var(--border-color);
    min-height: 42px;
}

    .form-control:focus,
    .form-select:focus {
        background-color: #fff;
    }

.form-label {
    font-weight: 700;
    color: #374151;
}

.form-text {
    color: var(--text-muted);
}

.form-select {
    background-position: left .75rem center;
    padding-right: .75rem;
    padding-left: 2rem;
    direction: rtl;
}

textarea.form-control {
    min-height: 100px;
}

input:disabled,
input:read-only {
    cursor: not-allowed;
    background-color: #f3f4f6;
}

input[type="checkbox"] {
    accent-color: var(--primary-color) !important;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

label.required:after {
    content: " *";
    color: var(--danger-color);
}

/* Validation */
input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error {
    border: 2px solid var(--danger-color) !important;
    background-color: #fff1f2;
}

.field-validation-error,
.text-danger {
    font-size: .85rem;
    font-weight: 700;
}

/* Select2 */
.select2-container {
    width: 100% !important;
}

    .select2-container .select2-selection--single {
        height: 42px !important;
        padding: .35rem .55rem;
    }

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    min-height: 42px;
}

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 30px;
        padding-right: .25rem;
        padding-left: 1.5rem;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 100%;
        top: 50%;
        transform: translateY(-50%);
        left: 10px;
        right: auto;
    }

.select2-dropdown {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-soft);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color);
}

.select2-container--default .select2-selection--single.input-validation-error,
.select2-container--default .select2-selection--multiple.input-validation-error {
    border: 2px solid var(--danger-color) !important;
    background-color: #fff1f2;
}

/* Tables */
.table {
    margin: 0;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.paint-table {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

    .paint-table table {
        min-width: 900px;
    }

    .paint-table thead tr th,
    .modal thead tr th {
        font-weight: 800;
        color: white !important;
        background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
        border-color: rgba(255,255,255,.18) !important;
        white-space: nowrap;
    }

thead tr th {
    font-weight: 800;
}

thead,
tbody,
td,
tfoot,
th,
thead,
tr {
    vertical-align: middle;
}

.table > :not(caption) > * > * {
    padding: .85rem .9rem;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #fbfdfb;
}

.table-hover tbody tr:hover,
tr[data-row-href]:hover {
    background-color: var(--primary-soft) !important;
}

tr[data-row-href] {
    cursor: pointer;
}

table tfoot tr,
table tfoot tr th {
    border: 0 !important;
    background-color: transparent !important;
    font-weight: normal;
}

/* Filters / lazy table */
.lazy-table-container {
    margin-top: 1rem;
}

.table-filters {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
}

.lazy-search-input {
    background-image: linear-gradient(transparent, transparent);
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    background-color: var(--bg-card);
    overflow: hidden;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    font-weight: 800;
}

.card-body {
    background: #fff;
}

.card .header {
    height: auto;
    color: white;
    padding: 15px;
    font-size: 18px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

    .card .header h1,
    .card .header h2,
    .card .header h3,
    .card .header h4,
    .card .header h5 {
        margin: 0;
    }

    .card .header h2 {
        font-size: 20px;
    }

.card .body {
    height: 100%;
    padding: 20px;
    display: flex;
    overflow-x: auto;
    align-items: center;
    background-color: var(--bg-soft);
}

/* Modal */
.modal-content {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    border: 0;
}

.modal-title {
    margin: 0;
    font-weight: 800;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: .9;
}

.modal-body {
    background: #fff;
    padding: 1.25rem;
}

.modal-lg {
    --bs-modal-width: 980px;
}

/* Alerts */
.alert {
    border-radius: var(--radius-md);
    border: 0;
    box-shadow: var(--shadow-soft);
}

#alertPlaceholder {
    z-index: 2000 !important;
}

/* Badges */
.badge {
    border-radius: 999px;
    padding: .45rem .65rem;
    font-weight: 800;
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-light-gray {
    color: black !important;
    background-color: var(--lightGray-color) !important;
}

.bg-dark-gray,
.btn-delay {
    color: black !important;
    background-color: var(--darkGray-color) !important;
}

.bg-green,
.btn-vacation {
    color: black !important;
    background-color: var(--green-color) !important;
}

.bg-orange,
.btn-sick {
    color: black !important;
    background-color: var(--orange-color) !important;
}

.bg-pink,
.btn-notcoming {
    color: white !important;
    background-color: var(--pink-color) !important;
}

.border-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* Dashboard helpers */
.dashboard-page {
    direction: rtl;
}

.dash-card {
    border-radius: var(--radius-lg);
    padding: 22px;
    min-height: 135px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: relative;
}

    .dash-card::before {
        content: "";
        position: absolute;
        inset-inline-start: -40px;
        bottom: -40px;
        width: 130px;
        height: 130px;
        border-radius: 50%;
        background: rgba(255,255,255,.16);
    }

.dash-label {
    font-size: .9rem;
    opacity: .9;
}

.dash-card h3 {
    margin: 8px 0 4px;
    font-weight: 900;
    font-size: 1.75rem;
}

.dash-card small {
    opacity: .88;
}

.dash-icon {
    font-size: 2.8rem;
    opacity: .85;
    z-index: 1;
}

.dash-card-blue {
    background: linear-gradient(135deg, #0d6efd, #084298);
}

.dash-card-green {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.dash-card-orange {
    background: linear-gradient(135deg, #fd7e14, #b45309);
}

.dash-card-red {
    background: linear-gradient(135deg, #dc3545, #842029);
}

.dashboard-panel {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin-bottom: 18px;
}

    .panel-header h5 {
        margin: 0;
        font-weight: 900;
    }

    .panel-header span {
        color: var(--text-muted);
        font-size: .9rem;
    }

.sales-chart {
    height: 260px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 10px 0;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #f8fafc, #fff);
}

.chart-col {
    height: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: end;
    gap: 8px;
}

    .chart-col span {
        width: 100%;
        max-width: 42px;
        display: block;
        border-radius: 12px 12px 4px 4px;
        background: linear-gradient(180deg, var(--primary-color), #b6f0a3);
        box-shadow: 0 8px 18px rgba(39, 158, 0, .22);
    }

    .chart-col small {
        color: var(--text-muted);
        font-weight: 800;
    }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

    .quick-actions a,
    .quick-actions button {
        border: 1px solid var(--border-color);
        background: #f8fafc;
        border-radius: var(--radius-md);
        padding: 18px 12px;
        text-decoration: none;
        color: var(--text-main);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        font-weight: 800;
        transition: .2s;
    }

        .quick-actions a:hover,
        .quick-actions button:hover {
            background: var(--primary-soft);
            border-color: rgba(39, 158, 0, .25);
            transform: translateY(-2px);
        }

    .quick-actions i {
        font-size: 1.8rem;
        color: var(--primary-color);
    }

.stock-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stock-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

    .stock-item strong {
        display: block;
    }

    .stock-item small {
        color: var(--text-muted);
    }

    .stock-item span {
        font-weight: 900;
    }

/* Images */
img {
    max-width: 100%;
}

.table-product-img,
.product-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Utilities */
.text-muted {
    color: var(--text-muted) !important;
}

.shadow-soft {
    box-shadow: var(--shadow-soft);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

/* Print */
@media print {
    body {
        background: #fff !important;
    }

        body header,
        .no-print,
        .btn,
        .table-filters,
        #alertPlaceholder,
        .modal {
            display: none !important;
        }

    .paint-table {
        box-shadow: none !important;
        border: 0 !important;
        overflow: visible !important;
    }

    .table {
        border-collapse: collapse !important;
    }

        .table th {
            color: #000 !important;
            background: #e9ecef !important;
        }
}

/* Mobile */
@media (max-width: 767px) {
    input,
    textarea,
    select {
        font-size: 16px;
    }

    table input,
    table select,
    table textarea {
        min-width: 100px;
    }

    table tr th,
    table tr td {
        text-wrap: nowrap;
    }

    .col-11.mx-auto {
        width: 96% !important;
    }

    .btn {
        width: auto;
        padding: .5rem .8rem;
    }

    .modal-dialog {
        margin: .75rem;
    }

    .panel-header {
        flex-direction: column;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .sales-chart {
        gap: 8px;
    }
}

/* =========================================
   GENERIC FORM TABS
========================================= */

.nav-tabs.custom-tabs {
    border-bottom: 1px solid #dee2e6;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding-bottom: 2px;
}

    .nav-tabs.custom-tabs::-webkit-scrollbar {
        height: 6px;
    }

    .nav-tabs.custom-tabs::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,.15);
        border-radius: 20px;
    }

    .nav-tabs.custom-tabs .nav-link {
        border: 1px solid transparent;
        border-radius: 14px 14px 0 0;
        color: #6c757d;
        font-weight: 600;
        padding: 12px 18px;
        transition: .2s ease-in-out;
        background: #f8f9fa;
        display: flex;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
        min-height: 48px;
    }

        .nav-tabs.custom-tabs .nav-link:hover {
            color: var(--bs-primary);
            background: #eef4ff;
        }

        .nav-tabs.custom-tabs .nav-link.active {
            background: #fff;
            color: var(--bs-primary);
            border-color: #dee2e6 #dee2e6 #fff;
            box-shadow: 0 -2px 10px rgba(0,0,0,.03);
        }

.custom-tabs-content {
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 18px 18px;
    padding: 24px;
    background: #fff;
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 768px) {

    .nav-tabs.custom-tabs .nav-link {
        padding: 10px 14px;
        font-size: .95rem;
    }

    .custom-tabs-content {
        padding: 18px;
    }
}

.delivery-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.delivery-toggle {
    position: relative;
    width: 42px;
    height: 22px;
    margin: 0;
    flex-shrink: 0;
}

    .delivery-toggle input {
        opacity: 0;
        width: 0;
        height: 0;
        position: absolute;
    }

.delivery-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    transition: .2s ease;
}

    .delivery-toggle-slider::before {
        content: "";
        position: absolute;
        width: 16px;
        height: 16px;
        right: 3px;
        top: 3px;
        border-radius: 50%;
        background: #fff;
        transition: .2s ease;
        box-shadow: 0 1px 4px rgba(0,0,0,.15);
    }

.delivery-toggle input:checked + .delivery-toggle-slider {
    background: linear-gradient(135deg, #198754, #20c997);
}

    .delivery-toggle input:checked + .delivery-toggle-slider::before {
        transform: translateX(-20px);
    }

.delivery-toggle input:disabled + .delivery-toggle-slider {
    opacity: .6;
    cursor: not-allowed;
}

.delivery-toggle-text {
    font-size: .82rem;
    font-weight: 600;
    transition: .2s ease;
    white-space: nowrap;
}

    .delivery-toggle-text.enabled {
        color: #198754;
    }

    .delivery-toggle-text.disabled {
        color: #6c757d;
    }