/* --- BEGIN AI-GENERATED CODE ---
 * Some or all of the code below was generated by AI.
 * Source: Claude Code
 * Model Used: Claude Sonnet 4.5
 * Human reviewed and approved on 2026-02-17 by Anubha
 */
/**
 * ItemsTable Modal CSS - Theme-Independent Styles
 * Used by itemsTable-custom-editor.js for Add/Edit modal dialogs
 *
 * Design Principles:
 * - Neutral colors that work with all DocuShare themes
 * - Consistent with DocuShare's existing form styles
 * - XSS-safe (no user data in CSS)
 *
 * @author DocuShare Development Team
 * @version 1.0.0
 * @date 2026-02-16
 */

/* Modal Overlay */
.itemsTable-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10002;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Modal Container */
.itemsTable-modal {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

/* Modal Header */
.itemsTable-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    border-radius: 6px 6px 0 0;
}

.itemsTable-modal-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.itemsTable-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.itemsTable-modal-close:hover {
    color: #333;
}

/* Modal Body */
.itemsTable-modal-body {
    padding: 10px 15px;
    overflow-y: auto;
    flex: 1;
}

/* Modal Form */
.itemsTable-modal-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Form Field */
.itemsTable-modal-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.itemsTable-modal-field label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.itemsTable-modal-input {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.itemsTable-modal-input:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

textarea.itemsTable-modal-input {
    resize: vertical;
    min-height: 50px;
}

/* Modal Footer */
.itemsTable-modal-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 4px 15px;
    background: #f9f9f9;
    border-top: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
}

/* Button Styles - Consistent with DocuShare .bs class */
.itemsTable-modal-save,
.itemsTable-modal-cancel {
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    line-height: 1.4;
    vertical-align: middle;
}

.itemsTable-modal-save {
    background-color: #4a90d9;
    border: 1px solid #3a7bc8;
    color: #fff;
}

.itemsTable-modal-save:hover {
    background-color: #3a7bc8;
    border-color: #2a6bb8;
}

.itemsTable-modal-cancel {
    background-color: #fff;
    border: 1px solid #ccc;
    color: #333;
}

.itemsTable-modal-cancel:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
}

/* DataTable Button Layout */
.dataTables_wrapper .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: nowrap;
    gap: 8px;
}

.dataTables_wrapper .top-left {
    flex-shrink: 1;
    min-width: 0;
}

/* DataTable Toolbar - Search left, icon buttons right, single row */
.itemsTable-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.itemsTable-toolbar .dt-search,
.itemsTable-toolbar .dataTables_filter {
    flex-shrink: 1;
    min-width: 0;
}
.itemsTable-toolbar .dt-buttons {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    align-items: center;
    margin-left: auto;
}
.itemsTable-toolbar .itemsTableCloseWrapper {
    flex-shrink: 0;
    margin-left: 2px;
}

/* Icon buttons for Add/Edit/Delete */
.itemsTable-icon-btn {
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    padding: 4px 6px !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: #383e42;
    transition: background 0.2s, color 0.2s;
    min-width: 28px;
    height: 28px;
}
.itemsTable-icon-btn:hover {
    background: #e0e0e0 !important;
    color: #000;
}
.itemsTable-icon-btn.disabled,
.itemsTable-icon-btn[disabled] {
    opacity: 0.35;
    cursor: default;
}
.itemsTable-icon-btn-delete:hover {
    color: #d32f2f;
}
.itemsTable-icon-btn svg {
    display: block;
}

.dataTables_wrapper .top-right {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-shrink: 0;
}

.dataTables_wrapper .bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.dataTables_wrapper .bottom-left {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* DataTable Select Styling */
table.dataTable tbody tr.selected {
    background-color: #e3f2fd !important;
}

table.dataTable tbody tr.selected td {
    background-color: #e3f2fd !important;
}

table.dataTable tbody tr:hover {
    background-color: #f5f5f5 !important;
    cursor: pointer;
}

table.dataTable tbody tr:hover:has(td.dt-empty) {
    cursor: default;
    background-color: transparent !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .itemsTable-modal {
        min-width: 95%;
        max-width: 95%;
        margin: 10px;
    }

    .itemsTable-modal-header,
    .itemsTable-modal-body,
    .itemsTable-modal-footer {
        padding: 12px 15px;
    }

    .itemsTable-modal-footer {
        flex-direction: column;
    }

    .itemsTable-modal-save,
    .itemsTable-modal-cancel {
        width: 100%;
    }
}
/* --- END AI-GENERATED CODE --- */


/* =========================================================================
   Required Field & Validation Error Styles
   ========================================================================= */

/* Red asterisk on required field labels */
.itemsTable-required-star {
    color: #d32f2f;
    margin-left: 2px;
    font-weight: bold;
}

/* Input error state in modal */
.itemsTable-modal-input.itemsTable-input-error {
    border-color: #d32f2f !important;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.15) !important;
}

/* Per-field inline error message (below input in modal) */
.itemsTable-field-error {
    color: #d32f2f;
    font-size: 11px;
    margin-top: 2px;
    display: none;
}
.itemsTable-field-error.visible {
    display: block;
}

/* Error panel shown below the DataTable on outer form submit */
.itemsTable-form-error-panel {
    color: #c62828;
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: 3px;
    padding: 7px 12px;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.7;
}

/* Inline cell-edit error state */
.itemsTable-inline-input.itemsTable-inline-input-error {
    border-color: #d32f2f !important;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2) !important;
}

/* Inline cell-edit error message (below input) */
.itemsTable-inline-error-msg {
    color: #d32f2f;
    font-size: 11px;
    display: none;
    white-space: nowrap;
}

/* .itemsTable-ac-mismatch style moved to itemsTable-ui.css (shared by editor + viewer) */

/* Autocomplete-enabled fields - matches existing DocuShare autocomplete styling */
/* Existing autocomplete uses inline: style="box-shadow: 0 0 3px #FFCC00;" */
.itemsTable-modal-input.itemstable-autocomplete-field {
    box-shadow: 0 0 3px #FFCC00 !important;
}

.itemsTable-modal-input.itemstable-autocomplete-field:focus {
    box-shadow: 0 0 5px #FFCC00 !important;
}

/* jQuery UI autocomplete dropdown styling */
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10003 !important;
}

/* =========================================================================
   Inline Cell Editing Styles
   ========================================================================= */

.itemsTable-inline-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.itemsTable-inline-input {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border: 1px solid #4a90d9;
    border-radius: 3px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
    text-align: left !important;
}

input[type="number"].itemsTable-inline-input {
    text-align: left !important;
    -moz-appearance: textfield;
}

.itemsTable-inline-input.itemstable-autocomplete-field {
    box-shadow: 0 0 3px #FFCC00 !important;
}

.itemsTable-inline-save {
    cursor: pointer;
    color: #4CAF50;
    font-size: 16px;
    font-weight: bold;
    padding: 2px;
    flex-shrink: 0;
    user-select: none;
}

.itemsTable-inline-save:hover {
    color: #2E7D32;
}

.itemsTable-inline-cancel {
    cursor: pointer;
    color: #F44336;
    font-size: 16px;
    font-weight: bold;
    padding: 2px;
    flex-shrink: 0;
    user-select: none;
}

.itemsTable-inline-cancel:hover {
    color: #C62828;
}

table.dataTable tbody td.itemsTable-inline-editing {
    padding: 4px 6px !important;
    background-color: #fff !important;
}

table.dataTable tbody tr.selected td.itemsTable-inline-editing {
    background-color: #fff !important;
}

/* =========================================================================
   Autocomplete Lookup Popup Styles
   ========================================================================= */

.itemsTable-lookup-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10004;
    display: flex;
    justify-content: center;
    align-items: center;
}

.itemsTable-lookup-popup {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 500px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

.itemsTable-lookup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    border-radius: 6px 6px 0 0;
}

.itemsTable-lookup-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.itemsTable-lookup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.itemsTable-lookup-close:hover { color: #333; }

.itemsTable-lookup-body {
    padding: 15px 20px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.itemsTable-lookup-search-wrapper {
    margin-bottom: 12px;
}

.itemsTable-lookup-search {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}
.itemsTable-lookup-search:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.itemsTable-lookup-table-wrapper {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.itemsTable-lookup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.itemsTable-lookup-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.itemsTable-lookup-table thead th {
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.itemsTable-lookup-table thead th:hover { background: #eaeaea; }

.itemsTable-lookup-table thead th.itemsTable-lookup-radio-header {
    width: 40px;
    cursor: default;
}
.itemsTable-lookup-table thead th.itemsTable-lookup-radio-header:hover {
    background: #f5f5f5;
}

.itemsTable-lookup-sort-indicator {
    font-size: 10px;
    margin-left: 4px;
    color: #666;
}

.itemsTable-lookup-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.itemsTable-lookup-table tbody tr:hover {
    background-color: #e3f2fd;
    cursor: pointer;
}

/* Bug 81592: highlight the currently-selected row (the one whose radio is checked),
   matching the String-property autocomplete lookup popup. */
.itemsTable-lookup-table tbody tr.itemsTable-lookup-row-selected {
    background-color: #e3f2fd;
}
.itemsTable-lookup-table tbody tr.itemsTable-lookup-row-selected:hover {
    background-color: #d0e8fb;
}

.itemsTable-lookup-radio-cell {
    text-align: center;
    width: 40px;
}

.itemsTable-lookup-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Browse icon (redirect glyph) in inline editing wrapper */
.itemsTable-inline-browse {
    cursor: pointer;
    color: #000;
    font-size: 18px;
    font-weight: bold;
    padding: 2px;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
}
.itemsTable-inline-browse:hover { color: #555; }

@media (max-width: 600px) {
    .itemsTable-lookup-popup {
        min-width: 95%;
        max-width: 95%;
        margin: 10px;
    }
}
