/* Global UI overrides */

/* Brand primary color */
:root {
  /* Base brand color */
  --bs-primary: #AAD044;
  --bs-primary-rgb: 89,188,181;
  --bs-primary-active: #AAD044;
  --bs-info: #AAD044;
  --bs-info-rgb: 89,188,181;
  /* Metronic/KT variables */
  --kt-primary: #AAD044;
  --kt-primary-active: #AAD044; /* hover/active shade */
  --kt-primary-light: rgba(89,188,181,.12);
}


.btn-info {
  --bs-btn-color: #fff;
  --bs-btn-bg: #AAD044;
  --bs-btn-border-color: #AAD044;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #AAD044 !important;
  --bs-btn-hover-border-color: #AAD044;
  --bs-btn-focus-shadow-rgb: 170,208,68;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #AAD044;
  --bs-btn-active-border-color: #AAD044;
  --bs-btn-disabled-bg: #AAD044;
  --bs-btn-disabled-border-color: #AAD044;
  background-color: #AAD044 !important;
  border-color: #AAD044 !important;
}

.btn.btn-info:hover {
  background-color: #AAD044 !important;
}
/* Also override primary button to match brand */
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: #AAD044;
  --bs-btn-border-color: #AAD044;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #6a802b;
  --bs-btn-hover-border-color: #6a802b;
  --bs-btn-focus-shadow-rgb: 170,208,68;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #6a802b;
  --bs-btn-active-border-color: #6a802b;
  --bs-btn-disabled-bg: #AAD044;
  --bs-btn-disabled-border-color: #AAD044;
  background-color: #AAD044 !important;
  border-color: #AAD044 !important;
}

/* Light primary variant buttons */
.btn-light-primary {
  color: #AAD044 !important;
  background-color: rgba(170,208,68,.12) !important;
  border-color: rgba(170,208,68,.12) !important;
}
.btn-light-primary:hover, .btn-light-primary.active, .btn-light-primary:active {
  color: #fff !important;
  background-color: #6a802b !important;
  border-color: #6a802b !important;
}

/* Outline primary variant */
.btn-outline-primary {
  color: #AAD044 !important;
  border-color: #AAD044 !important;
}
.btn-outline-primary:hover, .btn-outline-primary:active, .btn-outline-primary.active {
  color: #fff !important;
  background-color: #6a802b !important;
  border-color: #6a802b !important;
}

/* Success buttons (often used for Save) aligned to brand */
.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: #AAD044;
  --bs-btn-border-color: #AAD044;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #6a802b;
  --bs-btn-hover-border-color: #6a802b;
  --bs-btn-focus-shadow-rgb: 170,208,68;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #6a802b;
  --bs-btn-active-border-color: #6a802b;
  --bs-btn-disabled-bg: #AAD044;
  --bs-btn-disabled-border-color: #AAD044;
  background-color: #AAD044 !important;
  border-color: #AAD044 !important;
}

/* Ensure any dark-styled buttons also follow brand color */
.btn-dark {
  --bs-btn-color: #fff;
  --bs-btn-bg: #AAD044;
  --bs-btn-border-color: #AAD044;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #6a802b;
  --bs-btn-hover-border-color: #6a802b;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #6a802b;
  --bs-btn-active-border-color: #6a802b;
  background-color: #AAD044 !important;
  border-color: #AAD044 !important;
}

.btn-dark:hover {
  background-color: #6a802b !important;
  border-color: #6a802b !important;
}

.btn.btn-dark:hover {
  background-color: #6a802b !important;
  border-color: #6a802b !important;
}

/* Metronic active-light primary state */
.btn-active-light-primary.active, .btn-active-light-primary:active, .btn-active-light-primary:hover {
  color: #fff !important;
  background-color: #6a802b !important;
  border-color: #6a802b !important;
}

/* Also align primary color accents where needed */
.text-primary { color: #AAD044 !important; }
.text-hover-primary:hover { color: #AAD044 !important; }
.link-primary { color: #AAD044 !important; }
.link-primary:hover { color: #6a802b !important; }

/* Badge/link helpers potentially used with primary tone */
.badge-light-primary {
  color: #AAD044 !important;
  background-color: #AAD044 !important;
}

/* Badges colors remain as is; if needed, define custom utilities here */

/* Print styles for invoices - applied to .print-styles class for download */
.print-styles {
    /* Page setup equivalent */
}

.print-styles .card {
    box-shadow: none !important;
    border: none !important;
    page-break-inside: avoid;
}

.print-styles .btn-light-success {
    display: none !important;
}

.print-styles .gap-7 {
    gap: 0.5rem !important;
}

.print-styles .row {
    display: flex !important;
    flex-wrap: wrap !important;
}

.print-styles .row {
    display: flex !important;
    flex-wrap: nowrap !important;
}

.print-styles .col-md-6 {
    flex: 1 !important;
    max-width: 50% !important;
}

.print-styles .customer-info.row {
    flex-wrap: nowrap !important;
}

.print-styles .customer-info .col-md-6 {
    flex: 1 !important;
    max-width: 50% !important;
}

.print-styles .mt-9 .row {
    display: flex !important;
    flex-wrap: wrap !important;
}

.print-styles .mt-9 .col-md-6 {
    width: 50% !important;
    flex: none !important;
}

.print-styles table {
    page-break-inside: auto;
}

.print-styles tr {
    page-break-inside: avoid;
    page-break-after: auto;
}

.print-styles thead {
    display: table-header-group;
}

.print-styles .badge {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

/* Print styles for invoices */
@media print {
    /* Page setup */
    @page {
        size: A4;
        margin: 12mm;
    }

    html, body {
        width: 100%;
        height: auto;
        overflow: visible !important;
        background: #fff !important;
    }

    /* Hide everything */
    body * {
        visibility: hidden !important;
    }

    /* Show only invoice */
    #print-area,
    #print-area * {
        visibility: visible !important;
    }

    /* Position print area */
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    /* Hide UI elements */
    #kt_app_toolbar,
    .btn,
    .breadcrumb,
    nav,
    footer {
        display: none !important;
    }

    /* Preserve card look */
    .card {
        box-shadow: none !important;
        border: none !important;
        page-break-inside: avoid;
    }

    /* Prevent table row splitting */
    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    thead {
        display: table-header-group;
    }

    /* Fix flex overflow */
    .row {
        display: flex !important;
        flex-wrap: nowrap !important;
    }

    .col-md-6 {
        width: 50% !important;
        flex: 1 !important;
    }

    /* Colors + badges */
    .badge {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Additional transaction information layout */
    .mt-9 .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .mt-9 .col-md-6 {
        width: 50% !important;
        flex: none !important;
    }

    /* Reduce gap before Dear Customer */
    .gap-7 {
        gap: 0.5rem !important;
    }
}
