/* KFL Shared Styles — form, grid, and component CSS used across all 3 web apps */
/* Matches legacy S3GStyle.css Navy/Blue theme via CSS gradients */

/* ─── Form label styles matching legacy ASP.NET styling ─── */
.form-lbl {
    font-size: 12px;
    white-space: nowrap;
}

/* Required field label indicator */
.styleReqFieldLabel {
    font-weight: 600;
}
.required-lbl::after {
    content: " *";
    color: red;
    font-weight: bold;
}

/* Grid search row */
.grid-search td {
    padding: 2px 4px;
}

/* Modal backdrop fix for Blazor-managed modals */
.modal.d-block {
    display: block !important;
}

/* LOV popup grid rows */
.lov-grid tr:hover {
    background-color: #e3f2fd;
    cursor: pointer;
}

/* ─── Layout ─── */
.page-container {
    padding: 10px;
}

.breadcrumb-bar {
    font-size: 11px;
    color: #336699;
    padding: 5px 0;
}

.breadcrumb-bar a {
    color: #336699;
    text-decoration: underline;
}

.page-heading {
    background: linear-gradient(to bottom, #d6e4f0, #bdd3ea);
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid #a0b8cc;
}

.heading-label {
    font-size: 14px;
    font-weight: bold;
    color: #1a3f6f;
}

/* ─── Search Bar (2-column layout matching legacy 4-col table) ─── */
.search-bar {
    display: flex;
    gap: 30px;
    padding: 8px 10px;
    margin-bottom: 5px;
    align-items: flex-start;
}

.search-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-field label {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    min-width: 150px;
}

.search-field select,
.search-field input {
    min-width: 180px;
    padding: 3px 5px;
    font-size: 11px;
    border: 1px solid #99b;
}

.search-field .radio-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
}

.search-field .radio-group label {
    min-width: unset;
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ─── Data Grid ─── */
.data-grid {
    border-collapse: collapse;
    font-size: 11px;
    width: 100%;
}

.data-grid th {
    background: linear-gradient(to bottom, #5882a8, #3d6d94);
    color: white;
    padding: 6px 8px;
    text-align: left;
    border: 1px solid #2c5a7c;
    font-size: 11px;
}

.data-grid td {
    padding: 4px 8px;
    border: 1px solid #ccd;
}

.data-grid tbody tr:nth-child(even) {
    background-color: #eef3f8;
}

.data-grid tbody tr:hover {
    background-color: #d0e0f0;
}

.text-center {
    text-align: center;
}

.text-end {
    text-align: right;
}

.grid-icon {
    color: #336699;
    text-decoration: none;
    font-size: 14px;
}

.grid-icon:hover {
    color: #1a3f6f;
}

/* ─── Pagination ─── */
.paging-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 5px;
    font-size: 11px;
    flex-wrap: wrap;
}

.record-count {
    font-weight: bold;
    color: #333;
}

.page-nav {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-nav button {
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid #99b;
    background: #e8eef5;
    color: #336699;
    font-weight: bold;
}

.page-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-nav button:hover:not(:disabled) {
    background: #d0e0f0;
}

.page-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-input label {
    font-weight: bold;
}

.page-input input {
    padding: 2px;
    font-size: 11px;
    border: 1px solid #99b;
    text-align: center;
}

.page-input button {
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid #99b;
    background: #e8eef5;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-size-selector label {
    font-weight: bold;
}

.page-size-selector select {
    padding: 2px;
    font-size: 11px;
    border: 1px solid #99b;
}

/* ─── Action Buttons ─── */
.button-container-center {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 12px 0;
}

.btn-action {
    padding: 5px 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid #99b;
    color: #336699;
    background: linear-gradient(to bottom, #e8eef5, #d0d8e5);
}

.btn-action:hover {
    background: linear-gradient(to bottom, #f0f5fa, #e0e8f0);
    color: #1a3f6f;
}

.btn-save {
    background: linear-gradient(to bottom, #6699cc, #4477aa);
    color: white;
    border-color: #336699;
}

.btn-save:hover {
    background: linear-gradient(to bottom, #7799dd, #5588bb);
    color: white;
}

.btn-create {
    background: linear-gradient(to bottom, #e8eef5, #d0d8e5);
}

.btn-showall {
    background: linear-gradient(to bottom, #e8eef5, #d0d8e5);
}

.btn-excel {
    background: linear-gradient(to bottom, #e8eef5, #d0d8e5);
}

.btn-clear {
    background: linear-gradient(to bottom, #e8eef5, #d0d8e5);
}

.btn-cancel {
    background: linear-gradient(to bottom, #dd8888, #cc6666);
    color: white;
    border-color: #aa5555;
}

.btn-cancel:hover {
    background: linear-gradient(to bottom, #ee9999, #dd7777);
    color: white;
}

/* ─── Tabs ─── */
.tab-container {
    border: 1px solid #99b;
    background-color: #fff;
}

.tab-headers {
    display: flex;
    background-color: #e0e8f0;
    border-bottom: 1px solid #99b;
}

.tab-header {
    padding: 6px 15px;
    border: 1px solid #99b;
    border-bottom: none;
    background: linear-gradient(to bottom, #e8eef5, #d0d8e5);
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    color: #336699;
    margin-right: -1px;
}

.tab-header:hover {
    background: linear-gradient(to bottom, #f0f5fa, #e0e8f0);
}

.tab-header.active {
    background: #fff;
    border-bottom: 1px solid #fff;
    color: #1a3f6f;
}

.tab-content {
    padding: 5px;
    min-height: 200px;
}

/* ─── Form Sections (matches legacy .stylePanel fieldset+legend) ─── */
.form-section {
    border: 1px solid #336699;
    padding: 8px;
    margin-bottom: 10px;
}

.form-section-title {
    font-variant: small-caps;
    font-weight: bold;
    color: #003d9e;
    font-size: 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid #99b;
    padding-bottom: 3px;
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 20px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.form-row label {
    font-size: 12px;
    font-weight: bold;
    color: navy;
    min-width: 150px;
    white-space: nowrap;
}

.form-row input,
.form-row select,
.form-row textarea {
    font-size: 11px;
    border: 1px solid #99b;
    padding: 3px 5px;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    background-color: #ffffcc;
    outline: 1px solid #336699;
}

.form-row input[readonly],
.form-row select[disabled] {
    background-color: #eef;
}

/* ─── Error/Status ─── */
.error-message {
    color: red;
    font-size: 11px;
    padding: 8px;
    background-color: #ffe0e0;
    border: 1px solid #ff9999;
    margin-top: 10px;
}

.status-message-success {
    color: green;
    font-size: 11px;
    padding: 8px;
    background-color: #e0ffe0;
    border: 1px solid #99cc99;
    margin-top: 10px;
}

/* ─── Legacy .stylePanel (kept for backward compatibility until all screens migrated) ─── */
.stylePanel {
    border: 1px solid #99b;
    padding: 8px;
}

.stylePanel legend {
    font-variant: small-caps;
    font-weight: bold;
    color: navy;
    font-size: 14px;
    padding: 0 5px;
}

/* ─── Pagination bar (legacy PaginationControl compat) ─── */
.pagination-bar {
    margin-top: 8px;
    padding: 4px 0;
}

/* ─── Grid header row (legacy compat) ─── */
.grid-header {
    background-color: #e9ecef;
    font-weight: bold;
    font-size: 11px;
}

/* ─── Typeahead dropdown (replaces HTML5 datalist for Blazor Server compat) ─── */
.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    box-shadow: 0 4px 6px rgba(0,0,0,.15);
}
.typeahead-item {
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.typeahead-item:hover,
.typeahead-item.active {
    background-color: #0d6efd;
    color: #fff;
}

/* ─── MDI Tab Navigation ─── */
.mdi-tab-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.mdi-tab-strip {
    background: linear-gradient(to bottom, #e8ecf1, #d0d7e2);
    border-bottom: 1px solid #9ca9b8;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.mdi-tab-list {
    list-style: none;
    margin: 0;
    padding: 0 4px;
    display: flex;
    gap: 2px;
    align-items: flex-end;
    min-height: 30px;
}

.mdi-tab-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: linear-gradient(to bottom, #d5dce6, #b8c2d0);
    border: 1px solid #9ca9b8;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 11px;
    color: #333;
    max-width: 200px;
    min-width: 60px;
    user-select: none;
    transition: background 0.15s;
}

.mdi-tab-item:hover {
    background: linear-gradient(to bottom, #e8ecf1, #cdd4de);
}

.mdi-tab-item.active {
    background: #fff;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
    font-weight: 600;
    color: #1a3a5c;
}

.mdi-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.mdi-tab-close {
    border: none;
    background: none;
    color: #666;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0;
}

.mdi-tab-close:hover {
    background: #e04040;
    color: #fff;
}

.mdi-tab-content {
    flex: 1;
    overflow: auto;
    padding: 4px;
}

.mdi-tab-pane {
    height: 100%;
}

.mdi-tab-hidden {
    display: none !important;
}

.mdi-tab-error {
    padding: 20px;
    color: #c00;
    font-size: 13px;
}

.mdi-tab-warning {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    margin-left: 8px;
    font-size: 11px;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 3px;
    white-space: nowrap;
}
