/* FMS Inventar - Custom Styles */

/* =========================================================
 *  FELD-LADEN ANIMATION (entfernt - Felder werden sofort angezeigt)
 * ======================================================= */
/* HINWEIS: Felder werden jetzt sofort angezeigt, da die Werte bereits beim Rendern geladen werden.
 * AJAX wird nur als Fallback verwendet, wenn Felder leer sind oder object_id nicht übereinstimmt. */

/* =========================================================
 *  GRUNDLAYOUT
 * ======================================================= */
.fms-object-form,
.fms-options-form,
.fms-inventory-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

/* =========================================================
 *  FORMULAR-FELDER
 * ======================================================= */
.fms-object-form {
    max-width: 1100px;
}

.fms-field {
    margin-bottom: 12px;
    width: 100% !important;
    display: block;
}

label {
    display: block;
    width: 100%;
}

.fms-field-label {
    display: inline-block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 15px;
    width: 100%;
}

.fms-field input[type="text"],
.fms-field input[type="number"],
.fms-field input[type="date"],
.fms-field textarea,
.fms-field select {
    width: 100%;
    max-width: 100%;
    padding: 3px 10px;
    border: 1px solid #c8ccd0;
    border-radius: 5px;
    font-size: 15px;
    box-sizing: border-box;
}

.fms-subcategory-format-hint {
    color: #ddd !important;
    font-size: 11px !important;
    font-weight: 300 !important;
    line-height: 1.2em !important;
    display: block;
    margin-top: 0px;
}

.fms-subcategory-category-hint {
    color: #ddd !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.2em !important;
    display: block;
    margin-top: 2px;
}


.fms-field textarea {
    min-height: 120px;
    resize: vertical;
}

.fms-field-Inventarnummer input {
    width: 250px !important;
}

.fms-field input[type="checkbox"] {
    width: auto;
    margin-right: 0.5em;
}

/* Bild-Upload */
.fms-image-upload {
    display: block;
    margin-top: 0.5em;
    padding: 0.5em;
    border: 2px dashed #ccc;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
}

.fms-image-upload:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.fms-image-hint {
    display: block;
    margin-top: 0.25em;
    color: #666;
    font-size: 0.9em;
}

.fms-image-preview {
    margin-top: 1em;
}

.fms-image-preview img {
    max-width: 150px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Buttons */
.fms-object-buttons,
.fms-options-buttons {
    margin-top: 2em;
    display: flex !important;
    gap: 1em;
    flex-wrap: wrap;
    visibility: visible !important;
    opacity: 1 !important;
}

.fms-object-buttons button,
.fms-options-buttons button {
    margin-right: 10px;
    padding: 3px 10px;
    font-size: 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Einheitliches Button-Design für ALLE Buttons - basierend auf .fms-object-buttons Layout */
.fms-btn,
.fms-object-buttons button,
.fms-options-buttons button,
.fms-btn-save,
.fms-btn-save-new,
.fms-btn-nav,
.fms-btn-delete,
.fms-btn-template,
.fms-btn-search,
.fms-btn-export,
.fms-btn-options-save,
.fms-inventory-search-button,
.fms-inventory-export-button,
.fms-btn-table-controls-search,
.fms-btn-table-controls-export,
.fms-csv-export-btn,
.fms-btn.fms-btn-search.fms-inventory-search-button,
.fms-btn-select-image,
.fms-btn-remove-image,
.fms-btn-edit,
a.fms-btn,
a.fms-btn-nav {
    padding: 3px 10px;
    font-size: 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
    background: #384b61;
    color: #fff;
    margin: 0;
}

/* Hover-Effekt für alle Buttons */
.fms-btn:hover,
.fms-object-buttons button:hover,
.fms-options-buttons button:hover,
.fms-btn-save:hover,
.fms-btn-save-new:hover,
.fms-btn-nav:hover,
.fms-btn-template:hover,
.fms-btn-search:hover,
.fms-btn-export:hover,
.fms-btn-options-save:hover,
.fms-inventory-search-button:hover,
.fms-inventory-export-button:hover,
.fms-btn-table-controls-search:hover,
.fms-btn-table-controls-export:hover,
.fms-csv-export-btn:hover,
.fms-btn.fms-btn-search.fms-inventory-search-button:hover,
.fms-btn-select-image:hover,
.fms-btn-remove-image:hover,
.fms-btn-edit:hover,
a.fms-btn:hover,
a.fms-btn-nav:hover {
    background: #9db1c6;
}

/* Hover-Effekt für alle Buttons */
.fms-btn:active,
.fms-object-buttons button:active,
.fms-options-buttons button:active,
.fms-btn-save:active,
.fms-btn-save-new:active,
.fms-btn-nav:active,
.fms-btn-template:active,
.fms-btn-search:active,
.fms-btn-export:active,
.fms-btn-options-save:active,
.fms-inventory-search-button:active,
.fms-inventory-export-button:active,
.fms-btn-table-controls-search:active,
.fms-btn-table-controls-export:active,
.fms-csv-export-btn:active,
.fms-btn.fms-btn-search.fms-inventory-search-button:active,
.fms-btn-select-image:active,
.fms-btn-remove-image:active,
.fms-btn-edit:active,
a.fms-btn:active,
a.fms-btn-nav:active {
    background: #9db1c6;
}

/* Disabled-Status für alle Buttons */
.fms-btn-disabled,
.fms-btn:disabled,
.fms-btn-nav.fms-btn-disabled,
.fms-btn-nav:disabled,
.fms-btn-template.fms-btn-disabled,
.fms-btn-template:disabled,
.fms-btn-delete.fms-btn-disabled,
.fms-btn-delete:disabled {
    background: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
}

.fms-btn-disabled:hover,
.fms-btn:disabled:hover,
.fms-btn-nav.fms-btn-disabled:hover,
.fms-btn-nav:disabled:hover,
.fms-btn-template.fms-btn-disabled:hover,
.fms-btn-template:disabled:hover,
.fms-btn-delete.fms-btn-disabled:hover,
.fms-btn-delete:disabled:hover {
    background: #ccc !important;
}

/* Delete-Button bleibt rot */
.fms-btn-delete {
    background: #dc3232;
}

.fms-btn-delete:hover {
    background: #a00;
}

.fms-btn-delete:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

.fms-save-message {
    margin-top: 5px;
    color: #46d846;
    font-size: 15px;
    font-weight: 500;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* =========================================================
 *  INVENTARLISTE / TABELLE
 * ======================================================= */
.fms-inventory-wrapper {
    margin: 2em 0;
}

.fms-inventory-controls {
    margin-bottom: 1.5em;
    padding: 1em;
    background: #2a4a66;
    border: 1px solid #3a5a7a;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    align-items: center;
    color: #d0d8e0;
}

.fms-per-page-form {
    display: inline-block;
}

.fms-per-page-select label {
    font-weight: 600;
    margin-right: 0.5em;
    color: #d0d8e0;
}

.fms-per-page {
    padding: 8px 10px;
    border: 1px solid #3a5a7a;
    border-radius: 5px;
    background: #1f354b;
    color: #d0d8e0;
    font-size: 15px;
    margin-top: 10px;
}
.fms-inventory-per-page-field, 
.fms-inventory-search-field {
    margin-top: 0px;
    padding: 3px 10px !important;
}

.fms-inventory-search-field {
    max-width: 65% !important;
    margin-right: 10px !important;
}

.fms-inventory-search-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fms-inventory-search-button,
.fms-btn-search {
    padding: 3px 10px !important;
    font-size: 15px !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    background: #384b61 !important;
    color: #fff !important;
    margin: 0 !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fms-inventory-search-button:hover,
.fms-btn-search:hover {
    background: #9db1c6 !important;
}

.fms-inventory-search-clear {
    margin-left: 10px !important;
}

.fms-inventory-export-wrapper {
    display: inline-block;
}

.fms-inventory-export-button,
.fms-btn-export,
.fms-csv-export-btn {
    padding: 3px 10px !important;
    font-size: 15px !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    background: #384b61 !important;
    color: #fff !important;
    margin: 0 !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fms-inventory-export-button:hover,
.fms-btn-export:hover,
.fms-csv-export-btn:hover {
    background: #9db1c6 !important;
}

/* Spaltenauswahl - Label und Checkboxen auf einer Zeile */
.fms-inventory-column-toggle-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.fms-inventory-column-toggle-item {
    margin-right: 25px !important;
}

.fms-inventory-column-toggle-checkbox {
    margin-right: 3px !important;
}

.fms-inventory-column-toggle-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

.fms-inventory-column-toggle-group label {
    width: auto !important;
}

/* Labels im Inventarliste-Header - gleiches Layout wie .fms-field-label */
.fms-inventory-per-page-label,
.fms-inventory-search-label,
.fms-inventory-count-label {
    display: inline-block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 15px;
    width: 100%;
}

.fms-inventory-column-toggle-label {
    display: inline-block;
    font-weight: 600;
    margin-bottom: 0;
    font-size: 15px;
    width: auto;
    margin-right: 10px;
}

.fms-inventory-count-wrapper {
    margin-bottom: 1px;
}
.fms-inventory-count-label {
    width: auto;
}
.elementor-widget-shortcode {
    margin-bottom: 0 !important;
}

/* Wert für "Anzahl Objekte" - gleiches Layout wie Label */
.fms-inventory-count-value {
    font-weight: 600;
    font-size: 15px;
}

/* Spaltennamen in der Spaltenauswahl - ähnliches Layout */
.fms-inventory-column-toggle-text {
    font-weight: 400;
    font-size: 15px;
}

.fms-column-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: center;
    margin-bottom: 15px;
}

.fms-column-toggle strong {
    margin-right: 0.5em;
}

.fms-column-toggle strong {
    color: #d0d8e0;
}

.fms-column-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
    padding: 0.25em 0.5em;
    border-radius: 4px;
    transition: background 0.2s;
    margin-right: 12px;
    color: #d0d8e0;
}

.fms-column-toggle label:hover {
    background: #315a7a;
}

.fms-column-toggle input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Tabelle - Dark Mode Design für #1f354b Hintergrund */
.fms-inventory-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    background: #2a4a66;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.fms-inventory-table thead {
    background: #1f354b;
}

.fms-inventory-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #3a5a7a;
    border-bottom: 2px solid #4a6a8a;
    position: relative;
    color: #e0e8f0;
    background: #1f354b;
}

.fms-inventory-table th.fms-sortable {
    cursor: pointer;
    user-select: none;
}

.fms-inventory-table th.fms-sortable:hover {
    background: #2a4a66;
}

.fms-sort-link {
    color: #e0e8f0;
    text-decoration: none;
    display: block;
    width: 100%;
}

.fms-sort-link:hover {
    color: #9db1c6;
}

.fms-inventory-table th.fms-sort-asc::after,
.fms-inventory-table th.fms-sort-desc::after {
    content: '';
    position: absolute;
    right: 0.5em;
    top: 50%;
    transform: translateY(-50%);
}

.fms-inventory-table td {
    padding: 10px;
    border: 1px solid #3a5a7a;
    text-align: left;
    color: #d0d8e0;
    background: #2a4a66;
    font-size: 13px; /* 2 Punkte kleiner als Standard (15px) */
}

.fms-inventory-table tbody tr {
    background: #2a4a66;
    transition: background 0.2s;
}

.fms-inventory-table tbody tr:nth-child(even) {
    background: #253d55;
}

.fms-inventory-table tbody tr:hover {
    background: #315a7a;
}

.fms-table-row-clickable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.fms-table-row-clickable:hover {
    background-color: #3a6a8a !important;
}

/* Pagination */
.fms-inventory-pagination {
    margin: 2em 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
}

.fms-pagination-link {
    padding: 0.5em 1em;
    border: 1px solid #3a5a7a;
    border-radius: 4px;
    text-decoration: none;
    color: #9db1c6;
    background: #2a4a66;
    transition: all 0.2s;
}

.fms-pagination-link:hover {
    background: #384b61;
    color: #fff;
    border-color: #4a6a8a;
}

.fms-pagination-current {
    padding: 0.5em 1em;
    background: #384b61;
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid #4a6a8a;
}

.fms-pagination-dots {
    padding: 0.5em;
    color: #666;
}

.fms-inventory-info {
    margin-top: 1em;
    padding: 0.75em;
    background: #2a4a66;
    border-radius: 4px;
    text-align: center;
    color: #9db1c6;
    border: 1px solid #3a5a7a;
}

/* Mobile Optimierung */
@media (max-width: 768px) {
    .fms-mobile-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .fms-inventory-table {
        min-width: 600px;
    }
    
    .fms-inventory-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .fms-column-toggle {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .fms-object-buttons {
        flex-direction: column;
    }
    
    .fms-btn-save,
    .fms-btn-save-new {
        width: 100%;
    }
}

/* =========================================================
 *  OBJEKT-NAVIGATION
 * ======================================================= */
.fms-object-nav {
    display: flex;
    justify-content: space-between;
    margin: 2em 0;
    padding: 1em;
    background: #2a4a66;
    border-radius: 4px;
    border: 1px solid #3a5a7a;
}

.fms-nav-prev,
.fms-nav-next {
    padding: 10px 18px;
    background: #384b61;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.2s;
    font-size: 15px;
}

.fms-nav-prev:hover,
.fms-nav-next:hover {
    background: #9db1c6;
}

/* =========================================================
 *  SUCHFUNKTION
 * ======================================================= */
.fms-object-search {
    margin: 1.5em 0;
    display: flex;
    gap: 0.5em;
    max-width: 600px;
}

.fms-object-search input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #c8ccd0;
    border-radius: 5px;
    font-size: 15px;
}

.fms-object-search button {
    padding: 10px 18px;
    background: #384b61;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 15px;
}

.fms-object-search button:hover {
    background: #9db1c6;
}

/* =========================================================
 *  AUSWAHLLISTEN-FORMULAR
 * ======================================================= */
.fms-options-form {
    max-width: 1100px;
}

.fms-options-field {
    margin-bottom: 18px;
}

.fms-options-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid #c8ccd0;
    border-radius: 5px;
    font-family: 'Roboto Condensed', sans-serif;
    line-height: 1.6;
    font-size: 15px;
    box-sizing: border-box;
}

/* =========================================================
 *  PREVIEW-SEITE
 * ======================================================= */
.fms-view-field {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
}

.fms-view-label,
.fms-view-value {
}

.fms-view-label {
    font-weight: 600;
    display: block;
}

.fms-view-value {
    font-weight: 400;
}

.fms-view-image {
    width: 400px;
    max-width: 400px;
    height: auto;
    display: block;
}
