/* ===== 1. CSS VARIABLES & CONSTANTS ===== */
.abre-crud {
  --crud-border-color: #ddd;
  --crud-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
  --crud-border-radius: 4px;
  --crud-spacing: 20px;
  /* Consolidated spacing variable */
}

/* ===== 2. BASE LAYOUT & UTILITIES ===== */
.abre-crud .initially-hidden,
.abre-crud .crud-search-clear,
.abre-crud .crud-hidden-button,
.abre-crud .create-form-loader {
  display: none;
}

.abre-crud .crud-loader-full-width {
  width: 100%;
}

/* ===== 3. TABLE & TABS ===== */

/* Table Container */
.abre-crud table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #fff;
}

.abre-crud table thead th {
  background-color: #fff;
  box-shadow: var(--crud-shadow);
}

/* Table Body */
.abre-crud #crud-table-body>tr>td {
  padding: 5px;
}

.abre-crud #crud-table-body>tr>td input {
  margin: 0;
}

/* Table Navigation Tabs */
.abre-crud .table-tabs {
  margin-bottom: 15px;
  border-bottom: 1px solid var(--crud-border-color);
  padding-bottom: 0;
}

.abre-crud .table-tab {
  cursor: pointer;
  padding: 10px var(--crud-spacing);
  margin: 0 5px;
  border: 1px solid var(--crud-border-color);
  border-bottom: none;
  background-color: #f5f5f5;
  border-radius: var(--crud-border-radius) var(--crud-border-radius) 0 0;
  display: inline-block;
  user-select: none;
  transition: background-color 0.2s ease;
}

.abre-crud .table-tab:hover {
  background-color: #e9e9e9;
}

.abre-crud .table-tab.active {
  background-color: #fff;
  border-bottom: 1px solid #fff;
  margin-bottom: -1px;
  font-weight: bold;
}

/* ===== 4. ACTIONS & CONTROLS ===== */

/* CRUD Action Bar */
.abre-crud .crud-actions {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 8px;
}

/* Table action buttons use .table-icon class from abre.css */

/* ===== 5. INLINE EDITING ===== */

/* Inline Edit Field Container */
.abre-crud .field-saving {
  position: relative;
}

/* Loading Indicator for Inline Edit */
.abre-crud .save-loader {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-size: 11px;
  color: #757575;
  font-style: italic;
  display: none;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}

/* Inline Edit States */
.abre-crud .saving-input {
  background-color: #fff9c4 !important;
  border-bottom: 1px solid #f9a825 !important;
}

.abre-crud .inline-edit {
  border-bottom: 1px solid #757575;
  background: transparent;
  width: 100%;
  padding: 3px 5px;
  box-sizing: border-box;
  outline: none;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.abre-crud .inline-edit:focus {
  background-color: #f9f9f9;
  box-shadow: inset 0 0 0 1px #2196f3;
}

/* ===== 6. MODAL SYSTEM ===== */

/* Modal Base Structure */
.abre-crud.modal .modal-content {
  padding: 0 !important;
}

/* Button spacing handled by Materialize CSS */

.abre-crud .modal-footer .btn[disabled] {
  background-color: #dfdfdf !important;
}

/* Modal Z-Index Management */
#modal-create-record,
#modal-delete-confirm {
  overflow: hidden;
}

/* Modal Responsive Sizing */
.abre-crud .modal-mobile-full {
  width: 85%;
  max-width: 600px;
}

/* Modal Headers */
.abre-crud .modal-header-create,
.abre-crud .modal-header-delete {
  padding: var(--crud-spacing);
}

.abre-crud .modal-header-delete {
  background-color: #f44336;
}

.abre-crud .modal-header-row {
  margin: 0;
}

.abre-crud .modal-header-title {
  color: #fff;
  font-weight: 500;
  font-size: 24px;
  line-height: 26px;
}

.abre-crud .modal-header-close {
  color: #fff;
}

.abre-crud .modal-header-warning-icon {
  margin-right: 10px;
}

/* Modal Body */
.abre-crud .abre-modal-body-container {
  padding: 10px var(--crud-spacing) var(--crud-spacing) var(--crud-spacing);
}

/* ===== 7. FORMS ===== */

/* Form Fields */
.abre-crud .create-form-field {
  margin-bottom: 15px;
}

.abre-crud .create-form-field label {
  font-weight: 500;
  color: #333;
  display: block;
  margin-bottom: 10px;
}

.abre-crud .create-form-field input {
  border: 1px solid var(--crud-border-color);
  border-radius: var(--crud-border-radius);
  padding: 12px;
  width: 100%;
  font-size: 14px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.abre-crud .create-form-field input:focus {
  border-color: #26a69a;
  outline: none;
  box-shadow: 0 0 0 2px rgba(38, 166, 154, 0.2);
}

/* Form Validation - using Materialize card-panel styling */

/* Delete Modal Content */
.abre-crud .delete-confirmation-text {
  font-size: 16px;
  margin-bottom: 15px;
}

.abre-crud .delete-details-header {
  margin-bottom: 12px;
  color: #666;
}

.abre-crud .delete-record-details {
  border-left: 4px solid #f44336;
}

.abre-crud .abre-modal-body-container {
  padding: 0 16px 16px 16px;
}