/* ===== BASE STYLES ===== */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.bg-orange {
    background-color: #fd7e14;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ===== BLAZOR ERROR UI ===== */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ===== LOADING PROGRESS ===== */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* ===== HOME PAGE ===== */
.home-container {
    padding: 0 0;
}

.home-heading {
    font-size: 2.5rem;
    font-weight: 300;
    color: #333;
}

.home-link {
    margin: 0;
    font-size: 1rem;
}

    .home-link a {
        color: #0071c1;
        text-decoration: underline;
    }

        .home-link a:hover {
            color: #005a9c;
        }

/* ===== CUSTOMER AUTOCOMPLETE ===== */
.autocomplete {
    position: relative;
    width: 100%;
}

.suggestions {
    position: absolute;
    background-color: white;
    border: 1px solid #ccc;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

    .suggestions li {
        padding: 10px;
        cursor: pointer;
        border-bottom: 1px solid #f1f1f1;
        display: flex;
        flex-direction: column;
    }

        .suggestions li:last-child {
            border-bottom: none;
        }

        .suggestions li:hover {
            background-color: #f9f9f9;
        }

    .suggestions .customer-name {
        font-weight: bold;
        font-size: 1rem;
        color: #333;
    }

    .suggestions .customer-phone {
        font-size: 0.9rem;
        color: #666;
    }

.add-customer-option {
    background-color: #f8f9fa;
    color: #007bff;
    font-weight: bold;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-top: 1px solid #e9ecef;
}

    .add-customer-option:hover {
        background-color: #e2e6ea;
        color: #0056b3;
    }

.add-customer-form {
    margin-top: 15px;
    padding: 20px;
    border: 2px solid #007bff;
    border-radius: 8px;
    background-color: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

    .add-customer-form h5 {
        margin-bottom: 20px;
        font-weight: bold;
        color: #0056b3;
        text-align: center;
    }

    .add-customer-form .form-group label {
        font-weight: bold;
        color: #333;
    }

    .add-customer-form .btn {
        min-width: 100px;
    }

    .add-customer-form .btn-primary {
        background-color: #007bff;
        border-color: #007bff;
    }

        .add-customer-form .btn-primary:hover {
            background-color: #0056b3;
            border-color: #0056b3;
        }

    .add-customer-form .btn-secondary {
        background-color: #6c757d;
        border-color: #6c757d;
    }

        .add-customer-form .btn-secondary:hover {
            background-color: #5a6268;
            border-color: #5a6268;
        }

/* ===== MODAL DIALOGS ===== */
.modal-content {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    background: #fff;
    overflow: hidden;
    border: none;
}

.modal-header {
    background: #1b6ec2;
    color: #fff;
    padding: 1.25rem 1rem 1rem 1rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.modal-title {
    margin: 0;
}

.modal-body {
    padding: 1.25rem 1rem;
    font-size: 1.05rem;
    color: #333;
    text-align: center;
}

.modal-footer {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* ===== BUTTONS ===== */
.btn-danger {
    background: #dc3545;
    border: none;
    color: #fff;
    font-weight: 500;
    border-radius: 4px;
    padding: 0.5rem 1.2rem;
    transition: background 0.2s;
}

    .btn-danger:hover {
        background: #b52a37;
    }

.btn-secondary {
    background: #6c757d;
    border: none;
    color: #fff;
    font-weight: 500;
    border-radius: 4px;
    padding: 0.5rem 1.2rem;
    transition: background 0.2s;
}

    .btn-secondary:hover {
        background: #565e64;
    }

.btn-success {
    background: #198754;
    border: none;
    color: #fff;
    font-weight: 500;
    border-radius: 4px;
    padding: 0.5rem 1.2rem;
    transition: background 0.2s;
}

    .btn-success:hover {
        background: #146c43;
    }

/* ===== SPINNER OVERLAY ===== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.page-heading {
    font-size: 1.8rem;
    font-weight: 700;
    padding-bottom: 4px;
}

/* ===== LOADING LOGO (Mobile Compatible) ===== */
.logo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    z-index: 10000;
}

.loader-circle {
    position: absolute;
    width: 230px;
    height: 230px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #007bff;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    -webkit-animation: spin 1.5s linear infinite;
    z-index: 1;
    will-change: transform;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@-webkit-keyframes spin {
    from {
        -webkit-transform: rotate(0deg);
    }

    to {
        -webkit-transform: rotate(360deg);
    }
}

.rounded-logo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* ===== LAYOUT ===== */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.top-row {
    height: 3.5rem;
    background-color: #f0f0f0;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    display: flex;
    align-items: center;
}

    .top-row a,
    .top-row .btn-link {
        white-space: nowrap;
        margin-left: 1.5rem;
        text-decoration: none;
    }

        .top-row a:hover,
        .top-row .btn-link:hover {
            text-decoration: underline;
        }

        .top-row a:first-child {
            overflow: hidden;
            text-overflow: ellipsis;
        }

/* ===== NAVBAR TOGGLER (Mobile Compatible) ===== */
.navbar-toggler {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    width: 3.5rem;
    height: 2.5rem;
    color: white;
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    z-index: 1000;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

    .navbar-toggler::before,
    .navbar-toggler::after {
        content: '';
        position: absolute;
        left: 0.5rem;
        right: 0.5rem;
        height: 2px;
        background-color: rgba(255, 255, 255, 0.75);
        transition: all 0.3s ease;
    }

    .navbar-toggler::before {
        top: 0.75rem;
        box-shadow: 0 0.5rem 0 rgba(255, 255, 255, 0.75);
    }

    .navbar-toggler::after {
        bottom: 0.75rem;
    }

    .navbar-toggler:checked {
        background-color: rgba(255, 255, 255, 0.5);
    }

        .navbar-toggler:checked::before {
            top: 50%;
            transform: translateY(-50%) rotate(45deg);
            box-shadow: none;
        }

        .navbar-toggler:checked::after {
            bottom: 50%;
            transform: translateY(50%) rotate(-45deg);
        }

.navbar-brand {
    font-size: 1.1rem;
}

/* ===== NAV ICONS ===== */
.bi {
    display: inline-block;
    position: relative;
    width: 1.25rem;
    margin-right: 0.75rem;
    vertical-align: middle;
}

/* ===== NAV ITEMS ===== */
.nav-item {
    font-size: 0.9rem;
    padding-bottom: 0.5rem;
}

    .nav-item:first-of-type {
        padding-top: 1rem;
    }

    .nav-item:last-of-type {
        padding-bottom: 1rem;
    }

    .nav-item .nav-link {
        color: #d7d7d7;
        background: none;
        border: none;
        border-radius: 4px;
        height: 3rem;
        display: flex;
        align-items: center;
        line-height: 3rem;
        width: 100%;
    }

    .nav-item a.active {
        background-color: rgba(255,255,255,0.37);
        color: white;
    }

    .nav-item .nav-link:hover {
        background-color: rgba(255,255,255,0.1);
        color: white;
    }

.nav-scrollable {
    display: none;
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.navbar-toggler:checked ~ .nav-scrollable {
    display: block;
}

/* ===== INVOICE/CREDIT NOTE STYLES ===== */
.invoice-wrapper,
.credit-note-wrapper {
    background-color: #f8f9fa;
    min-height: 100vh;
    padding: 20px;
}

.invoice-container,
.credit-note-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.company-logo {
    max-width: 115px;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.invoice-meta,
.credit-note-meta {
    margin-top: 8px;
    margin-bottom: 8px;
    max-width: 100%;
}

    .invoice-meta p,
    .credit-note-meta p {
        margin-bottom: 0.5rem;
    }

.company-info {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #495057;
    margin-top: 25px;
}

.address-docked {
    max-width: 340px;
    text-align: right;
}

.invoice-title {
    color: #0d6efd;
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.table-primary th {
    background-color: #0d6efd !important;
    color: white !important;
    font-weight: 600;
    border-color: #0a58ca !important;
}

.table-bordered td, .table-bordered th {
    border-color: #dee2e6;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.totals-table {
    margin-bottom: 0;
}

    .totals-table td {
        padding: 0.75rem;
        border-top: 1px solid #dee2e6;
    }

    .totals-table tbody tr:last-child {
        border-top: 2px solid #dee2e6;
    }

.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

.header-row,
.bottom-row {
    border-bottom: 2px solid #dee2e6;
}

/* ===== SEARCH RESULTS DROPDOWN ===== */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 2px;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease-in-out;
}

    .search-result-item:last-child {
        border-bottom: none;
    }

    .search-result-item:hover {
        background-color: #f8f9fa;
    }

/* ===== INVOICE/CREDIT NOTE LIST PAGES ===== */
.invoices-page h3,
.credit-notes-page h3 {
    margin-bottom: 0.25rem;
}

.invoices-table tbody tr.invoice-row:hover,
.credit-notes-table tbody tr.credit-note-row:hover {
    background: rgba(0, 123, 255, 0.03);
}

.invoice-card,
.credit-note-card {
    border-radius: 8px;
    overflow: hidden;
}

.invoices-grid .card {
    border-left: 4px solid var(--bs-primary);
}

.credit-notes-grid .card {
    border-left: 4px solid var(--bs-warning);
}

.invoices-table td, .invoices-table th,
.credit-notes-table td, .credit-notes-table th {
    vertical-align: middle;
}

.invoice-card .fw-bold,
.credit-note-card .fw-bold {
    color: var(--bs-dark);
}

.customer-dropdown {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.customer-dropdown-item {
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

    .customer-dropdown-item:hover {
        background-color: #f8f9fa;
    }

/* ===== MOBILE RESPONSIVE (< 768px) ===== */
@media (max-width: 767.98px) {
    /* General container adjustments */
    .invoice-wrapper,
    .credit-note-wrapper {
        padding: 10px;
    }

    .invoice-container,
    .credit-note-container {
        padding: 15px;
        border-radius: 5px;
    }

    /* Logo responsive sizing */
    .company-logo {
        max-width: 180px;
        margin-bottom: 1rem;
    }

    /* Invoice/Credit note meta: stack and left-align */
    .invoice-meta, 
    .credit-note-meta {
        text-align: left !important;
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    /* Customer info section: stack vertically */
    .col-12.justify-content-between {
        flex-direction: column !important;
        gap: 1rem;
    }

    /* Address section: stack and left-align */
    .address-docked {
        text-align: left !important;
        max-width: 100%;
        margin-top: 1rem;
    }

    /* Table responsiveness: enable horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

        .table-responsive table {
            font-size: 0.75rem;
            min-width: 600px;
        }

        .table-responsive th,
        .table-responsive td {
            padding: 0.4rem 0.25rem;
            white-space: nowrap;
        }

        .table-responsive .form-control-sm {
            font-size: 0.75rem;
            padding: 0.25rem 0.4rem;
        }

    /* Button groups: stack vertically */
    .d-flex.gap-2 {
        flex-direction: column !important;
        width: 100%;
    }

        .d-flex.gap-2 button,
        .d-flex.gap-2 .btn {
            width: 100% !important;
            max-width: 100% !important;
            margin-bottom: 0.5rem;
        }

    /* Generate/Save button */
    button[style*="width:420px"] {
        width: 100% !important;
    }

    /* Totals table: reduce font size */
    .totals-table {
        font-size: 0.85rem;
    }

        .totals-table td {
            padding: 0.5rem 0.25rem;
        }

        .totals-table .fw-bold.fs-5 {
            font-size: 1rem !important;
        }

    /* Bank info card: reduce padding */
    .card-body.bg-light {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* Alert/info boxes: reduce padding */
    .alert-info {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* Compact form controls */
    .invoice-composite .form-control,
    .credit-note-composite .form-control {
        font-size: 0.875rem;
    }

    /* Search and filter controls */
    .d-flex.gap-2.align-items-center {
        flex-direction: column;
        align-items: stretch !important;
    }

        .d-flex.gap-2.align-items-center .form-control,
        .d-flex.gap-2.align-items-center .form-select {
            width: 100%;
            margin-bottom: 0.5rem;
        }

        /* Date range inputs */
        .d-flex.gap-2.align-items-center.mb-3 {
            flex-wrap: wrap;
        }

            .d-flex.gap-2.align-items-center.mb-3 .form-control {
                flex: 1 1 calc(50% - 0.5rem);
                min-width: 120px;
            }

    /* Invoice/Credit Note title */
    .invoice-title {
        font-size: 1.75rem;
    }

    /* Page heading */
    .page-heading {
        font-size: 1.5rem;
    }

    /* Remarks/Reason textarea */
    .invoice-composite textarea,
    .credit-note-composite textarea {
        font-size: 0.875rem;
    }

    /* Customer dropdown */
    .customer-dropdown {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Paid Now and Remaining section */
    .col-md-5 .d-flex.gap-2 {
        flex-direction: column !important;
    }

        .col-md-5 .d-flex.gap-2 > div {
            width: 100% !important;
            max-width: 100% !important;
            text-align: left !important;
        }

    /* VAT radio buttons */
    .totals-table .small {
        font-size: 0.75rem;
    }
}

/* ===== TABLET RESPONSIVE (768px - 991px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .invoice-container,
    .credit-note-container {
        padding: 25px;
    }

    .company-logo {
        max-width: 220px;
    }

    .table-responsive table {
        font-size: 0.9rem;
    }

    .invoice-title {
        font-size: 2.25rem;
    }
}

/* ===== PRINT MEDIA QUERIES ===== */
/*@media print {
    body * {
        visibility: hidden;
    }

    #invoice-container,
    #invoice-container *,
    #credit-note-container,
    #credit-note-container * {
        visibility: visible;
    }

    #invoice-container,
    #credit-note-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .invoice-wrapper,
    .credit-note-wrapper {
        background-color: white;
        padding: 0;
    }

    .invoice-container,
    .credit-note-container {
        box-shadow: none;
        padding: 20px;
    }

    .btn,
    button,
    .no-print {
        display: none !important;
    }

    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
        .no-print {
            display: none !important;
        }
}*/

@media print {
    /*@page {
        size: A4 portrait;
        margin: 0;
    }*/


    body * {
        visibility: hidden;
    }

    #invoice-container,
    #invoice-container *,
    #credit-note-container,
    #credit-note-container * {
        visibility: visible;
    }

    #invoice-container,
    #credit-note-container {
        display: block !important;
        width: 700px !important; /* Fixed width for centering */
        max-width: 700px !important;
        margin-left: auto !important; /* Center horizontally */
        margin-right: auto !important;
        background: white !important;
        box-shadow: none !important;
        padding: 10px !important;
        border-radius: 0 !important;
        position: static !important; /* Ensure no absolute positioning */
    }
    .invoice-wrapper,
    .credit-note-wrapper {
        background-color: white !important;
        padding: 0 !important;
        min-height: auto !important;
        box-shadow: none !important;
    }

    .btn,
    button,
    .no-print {
        display: none !important;
    }

    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }

    .company-logo {
        max-width: 100px !important;
        height: auto !important;
        margin-bottom: 10px !important;
    }

    .table, .table th, .table td {
        font-size: 12px !important;
        padding: 2px 4px !important;
        border-color: #dee2e6 !important;
    }

    .totals-table td {
        padding: 2px 4px !important;
        font-size: 12px !important;
    }

    .table-primary th {
        background-color: #e9ecef !important;
        color: #222 !important;
        border-color: #dee2e6 !important;
    }

    .header-row,
    .bottom-row {
        border-bottom: 1px solid #dee2e6 !important;
    }

    .alert,
    .alert-info {
        display: none !important;
    }

    html, body, .invoice-container, .credit-note-container {
        font-size: 12px !important;
        background: white !important;
    }

    .sidebar,
    .top-row,
    nav,
    header,
    footer {
        display: none !important;
    }

    * {
        box-shadow: none !important;
        border-radius: 0 !important;
    }
}
/* ===== DESKTOP RESPONSIVE (> 640px) ===== */
@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

        .top-row.auth a:first-child {
            flex: 1;
            text-align: right;
            width: 0;
        }

    .top-row, article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }

    .navbar-toggler {
        display: none;
    }

    .nav-scrollable {
        display: block;
        height: calc(100vh - 3.5rem);
        overflow-y: auto;
    }
}

/* ===== MOBILE LAYOUT (< 641px) ===== */
@media (max-width: 640.98px) {
    .top-row {
        justify-content: space-between;
    }

        .top-row a,
        .top-row .btn-link {
            margin-left: 0;
        }
}

/* ===== RESPONSIVE MODAL DIALOGS ===== */
.modal.show {
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
}

@media (max-width: 576px) {
    .modal-dialog {
        max-width: calc(100% - 1rem);
        margin: 0.5rem;
    }

    .modal-dialog-centered {
        min-height: calc(100% - 1rem);
    }

    .modal-header {
        padding: 0.75rem 0.75rem 0.6rem 0.75rem;
        font-size: 1rem;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-header svg {
        width: 18px;
        height: 18px;
    }

    .modal-body {
        padding: 0.875rem 0.75rem;
        font-size: 0.9rem;
    }

        .modal-body p {
            margin-bottom: 0;
        }

    .modal-footer {
        padding: 0.625rem 0.75rem;
        gap: 0.375rem;
    }

        .modal-footer .btn {
            padding: 0.4rem 1rem;
            font-size: 0.875rem;
            min-width: 70px;
        }
}

@media (min-width: 577px) and (max-width: 768px) {
    .modal-dialog {
        max-width: 90%;
    }

    .modal-header {
        padding: 1rem;
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1rem;
        font-size: 1rem;
    }

    .modal-footer .btn {
        padding: 0.45rem 1.1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .modal-footer .btn {
        min-height: 44px;
        touch-action: manipulation;
    }
}

body:has(.modal.show) {
    overflow: hidden;
}

/* ===== UTILITY CLASSES ===== */
.btn-compact {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

@media (max-width: 576px) {
    .btn-compact {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* ===== TABLE COLUMN WIDTH FIXES FOR MOBILE ===== */
@media (max-width: 767.98px) {
    .table-responsive th[style*="width"],
    .table-responsive td[style*="width"] {
        min-width: auto !important;
    }

    .table-responsive th[style*="12%"],
    .table-responsive td[style*="12%"] {
        min-width: 60px !important;
    }

    .table-responsive th[style*="38%"],
    .table-responsive td[style*="38%"] {
        min-width: 120px !important;
    }

    .table-responsive th[style*="10%"],
    .table-responsive td[style*="10%"] {
        min-width: 70px !important;
    }

    .table-responsive th[style*="13%"],
    .table-responsive td[style*="13%"] {
        min-width: 80px !important;
    }

    .table-responsive th[style*="7%"],
    .table-responsive td[style*="7%"] {
        min-width: 50px !important;
    }
}
