/* Mithila VATPro — mirrors react-project/src/index.css component layer */

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.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."
}

#blazor-error-ui {
    background: #ffe8e8;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* —— React @layer components equivalents —— */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.btn-primary {
    background-color: #4B89DC;
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-success {
    background-color: #4ADE80;
    color: #fff;
}

.btn-danger {
    background-color: #FFCDD2;
    color: #1f2937;
}

.btn-secondary {
    background-color: #D5DCE5;
    color: #374151;
}

.card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    border: 1px solid #D5DCE5;
}

.input,
textarea.input,
select.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #D5DCE5;
    border-radius: 0.5rem;
    background: #fff;
    outline: none;
}

.input:focus,
textarea.input:focus,
select.input:focus {
    box-shadow: 0 0 0 2px rgba(75, 137, 220, 0.35);
    border-color: transparent;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid #D5DCE5;
    background: #fff;
}

.table {
    min-width: 100%;
    background: #fff;
    border-collapse: collapse;
}

.table th {
    padding: 0.75rem 1.5rem;
    background: #E5F1FF;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4B89DC;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #D5DCE5;
}

.table td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: #1f2937;
    border-bottom: 1px solid rgba(213, 220, 229, 0.35);
    white-space: nowrap;
}

/* Tailwind text-right on th/td loses to .table th { text-align: left } without higher specificity */
.table th.text-right,
.table td.text-right {
    text-align: right;
}

.table th.text-center,
.table td.text-center {
    text-align: center;
}

.table tbody tr:hover {
    background: rgba(229, 241, 255, 0.35);
    transition: background 0.15s;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(74, 222, 128, 0.2);
    color: #166534;
    border: 1px solid #4ADE80;
}

.badge-secondary {
    background: rgba(229, 231, 235, 0.9);
    color: #374151;
    border: 1px solid #d1d5db;
}

.badge-warning {
    background: #FFDBA4;
    color: #9a3412;
    border: 1px solid #FFDBA4;
}

.badge-danger {
    background: #FFCDD2;
    color: #991b1b;
    border: 1px solid #FFCDD2;
}

/* Blazor NavLink sidebar (React sidebar link styles) */
.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    text-decoration: none;
    color: #1f2937;
    transition: background 0.2s, color 0.2s;
}

.sidebar-link:hover {
    background: #E5F1FF;
}

.sidebar-link.active {
    background: #4B89DC !important;
    color: #fff !important;
}

.sidebar-link-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    text-decoration: none;
    font-size: 0.875rem;
    color: #374151;
    transition: background 0.2s;
}

.sidebar-link-child:hover {
    background: #f3f4f6;
}

.sidebar-link-child.active {
    background: #4B89DC !important;
    color: #fff !important;
}

/* Sticky top bar (company/date/page) */
.main-header-bar {
    position: sticky;
    top: 0;
    z-index: 450;
}

/* —— Auth pages (login / forgot / reset) ——
   Tailwind CDN does not always emit custom theme colors (e.g. bg-primary) during Blazor static
   render, while utilities like text-white still apply → white-on-white buttons. Use real CSS here. */

.auth-page-bg {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 0;
    background: linear-gradient(to bottom right, #e5f1ff, #f8faff 42%, #ffffff);
}

.auth-card-shell {
    width: 100%;
    max-width: 28rem;
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid #d5dce5;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
}

.auth-icon-circle {
    width: 4rem;
    height: 4rem;
    border-radius: 9999px;
    background-color: #4b89dc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
}

.auth-icon-circle svg {
    color: #fff;
}

.auth-banner {
    background-color: #e5f1ff;
    border: 1px solid #d5dce5;
    border-radius: 0.5rem;
    padding: 1rem;
}

.auth-banner-error {
    background-color: #fecaca;
    border: 1px solid #f87171;
    border-radius: 0.5rem;
    padding: 1rem;
}

.auth-btn-submit {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: #4b89dc;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(75, 137, 220, 0.35);
    transition: opacity 0.2s, box-shadow 0.2s;
}

.auth-btn-submit:hover {
    opacity: 0.92;
    box-shadow: 0 4px 14px rgba(75, 137, 220, 0.4);
}

.auth-link {
    color: #4b89dc;
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-link-muted {
    font-size: 0.875rem;
}

.auth-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #4b89dc;
}

/* Nepali (Bikram Sambat) Miti picker — calendar popover */
.nepali-miti-picker .relative {
    position: relative;
}

.nepali-miti-input {
    padding-right: 2.5rem !important;
}

.nepali-miti-input:focus {
    outline: none;
    border-color: #4b89dc;
    box-shadow: 0 0 0 1px #4b89dc;
}

.nepali-miti-icon-btn {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0.375rem;
    line-height: 0;
}

.nepali-miti-icon-btn:hover {
    background-color: #f3f4f6;
}

.nepali-miti-icon-btn--compact {
    right: 0.2rem;
    padding: 0.2rem;
}

.nepali-miti-backdrop {
    background: transparent;
}

.nepali-miti-popover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.nepali-miti-nav {
    min-width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 0.875rem;
    line-height: 1;
    border-radius: 0.25rem;
    cursor: pointer;
    padding: 0.125rem;
}

.nepali-miti-nav:hover {
    background: #f3f4f6;
    color: #4b5563;
}

/* Calendar day cells — plain CSS so “today” is visible without Tailwind JIT (Blazor + CDN). */
.nepali-miti-popover button.nepali-miti-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    background: transparent;
}

.nepali-miti-popover button.nepali-miti-day:disabled {
    cursor: default;
}

.nepali-miti-popover button.nepali-miti-day--empty {
    visibility: hidden;
    pointer-events: none;
}

.nepali-miti-popover button.nepali-miti-day--muted {
    color: #d1d5db;
}

.nepali-miti-popover button.nepali-miti-day--plain {
    color: #111827;
    border-color: transparent;
}

.nepali-miti-popover button.nepali-miti-day--plain:hover:not(:disabled) {
    background-color: #f3f4f6;
}

.nepali-miti-popover button.nepali-miti-day--today {
    color: #1e3a5f !important;
    font-weight: 700 !important;
    background-color: #e5f1ff !important;
    border: 2px solid #4b89dc !important;
    box-shadow: inset 0 0 0 1px rgba(75, 137, 220, 0.2);
}

.nepali-miti-popover button.nepali-miti-day--today:hover:not(:disabled) {
    background-color: #d4e8fc !important;
}

.nepali-miti-popover button.nepali-miti-day--selected {
    color: #4b89dc !important;
    font-weight: 700 !important;
    background-color: rgba(229, 241, 255, 0.65) !important;
    border: 2px solid #4b89dc !important;
}

.nepali-miti-popover button.nepali-miti-day--selected.nepali-miti-day--today {
    background-color: #cfe4fb !important;
}

/* Gregorian (AD) date picker — match Nepali Miti compact field look on quotation form */
.nepali-style-date-field .ant-picker {
    width: 100%;
    border: 1px solid #d5dce5 !important;
    border-radius: 0.5rem !important;
    background: #fff !important;
    box-shadow: none !important;
    padding: 0.125rem 0.35rem 0.125rem 0.5rem !important;
    min-height: 2.25rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nepali-style-date-field .ant-picker:hover,
.nepali-style-date-field .ant-picker.ant-picker-focused {
    border-color: #4b89dc !important;
    box-shadow: 0 0 0 1px #4b89dc !important;
}

.nepali-style-date-field .ant-picker.ant-picker-disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.nepali-style-date-field .ant-picker-input {
    flex: 1;
    min-width: 0;
}

.nepali-style-date-field .ant-picker-input > input {
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    color: #111827 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0.125rem 0 !important;
    height: auto !important;
}

.nepali-style-date-field .ant-picker-input > input::placeholder {
    color: #9ca3af !important;
}

.nepali-style-date-field .ant-picker-suffix {
    color: #6b7280 !important;
    margin-inline-start: 0.125rem;
}

.nepali-style-date-field .ant-picker-suffix .anticon {
    font-size: 0.875rem !important;
}

/* Quotation — searchable customer Select (Ant Design), closer to native .input */
.quotation-customer-select .ant-select .ant-select-selector {
    border: 1px solid #d5dce5 !important;
    border-radius: 0.5rem !important;
    min-height: 2.25rem !important;
    /* Explicit padding; must stay in sync with .ant-select-selection-search inset below */
    padding: 0.125rem 2rem 0.125rem 0.75rem !important;
    box-shadow: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quotation-customer-select .ant-select:not(.ant-select-disabled):hover .ant-select-selector,
.quotation-customer-select .ant-select-focused:not(.ant-select-disabled) .ant-select-selector {
    border-color: #4b89dc !important;
    box-shadow: 0 0 0 1px #4b89dc !important;
}

/* Ant Design uses absolute inset (px) for the search field; realign to our padding (Tailwind loads after antd). */
.quotation-customer-select .ant-select-single .ant-select-selector .ant-select-selection-search {
    left: 0.75rem !important;
    right: 0.75rem !important;
}

.quotation-customer-select .ant-select-single.ant-select-show-arrow .ant-select-selector .ant-select-selection-search {
    right: 1.75rem !important;
}

.quotation-customer-select .ant-select-selection-item,
.quotation-customer-select .ant-select-selection-placeholder {
    font-size: 0.875rem !important;
    line-height: 1.35rem !important;
}

.quotation-customer-select .ant-select-selection-search-input {
    font-size: 0.875rem !important;
}

/* Tax invoice — print (hide app chrome & preview-only UI) */
@media print {
    @page {
        margin: 12mm;
    }

    aside {
        display: none !important;
    }

    .main-header-bar {
        display: none !important;
    }

    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    main {
        margin-left: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    /* MainLayout uses ml-72 for the content pane; remove it for print. */
    .ml-72 {
        margin-left: 0 !important;
    }

    .no-print,
    .tax-inv-preview-watermark {
        display: none !important;
    }

    .tax-inv-print-shell {
        box-shadow: none !important;
        border-radius: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 1rem !important;
    }

    .tax-inv-signatures,
    .tax-inv-print-footer {
        break-inside: avoid;
    }
}
