/* =====================================================
   RESOURCE ATTRIBUTES DIALOG
   ===================================================== */

md-dialog.resource-attributes-dialog {
  width: 95vw !important;
  max-width: 1600px !important;
  min-width: 1000px !important;
  height: 90vh !important;
  max-height: 90vh !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

/* =====================================================
   GLOBAL BUTTON RULE (excludes chip internals)
   ===================================================== */

.resource-attributes-dialog md-button:not(.md-chip-remove):not(.md-chip-trailing-icon),
.resource-attributes-dialog .md-button:not(.md-chip-remove):not(.md-chip-trailing-icon) {
  min-width: 100px !important;
  height: 40px !important;
  padding: 0 20px !important;
  margin: 0 !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  line-height: 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
}

.resource-attributes-dialog md-button md-icon,
.resource-attributes-dialog .md-button md-icon {
  font-size: 18px !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* =====================================================
   TOOLBAR
   ===================================================== */

:where(.resource-attributes-dialog) .attributes-toolbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-height: 72px !important;
  flex-shrink: 0 !important;
}

:where(.resource-attributes-dialog) .attributes-toolbar .md-toolbar-tools {
  padding: 0 24px !important;
  min-height: 72px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

:where(.resource-attributes-dialog) .attributes-toolbar .attributes-icon {
  color: white !important;
  font-size: 28px !important;
  width: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

:where(.resource-attributes-dialog) .attributes-toolbar .attributes-header-info {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  min-width: 0 !important;
}

:where(.resource-attributes-dialog) .attributes-toolbar .attributes-header-info h2 {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: white !important;
  margin: 0 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

:where(.resource-attributes-dialog) .attributes-toolbar .attributes-subtitle {
  font-size: 13px !important;
  color: rgba(255,255,255,0.9) !important;
  font-weight: 400 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

:where(.resource-attributes-dialog) .attributes-toolbar .md-toolbar-tools > span[flex] { flex: 1 1 auto !important; }

:where(.resource-attributes-dialog) .attributes-toolbar .md-icon-button {
  color: white !important;
  margin: 0 !important;
  width: 40px !important;
  height: 40px !important;
  flex-shrink: 0 !important;
  border-radius: 4px !important;
}

:where(.resource-attributes-dialog) .attributes-toolbar .md-icon-button:hover { background: rgba(255,255,255,0.15) !important; }

/* =====================================================
   CONTENT
   ===================================================== */

:where(.resource-attributes-dialog) .attributes-content {
  flex: 1 !important;
  padding: 32px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  background: #fafafa !important;
}

:where(.resource-attributes-dialog) .attributes-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

:where(.resource-attributes-dialog) .attributes-title {
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
}

:where(.resource-attributes-dialog) .attributes-description {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* =====================================================
   TABLE
   ===================================================== */

:where(.resource-attributes-dialog) .table-wrapper {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

:where(.resource-attributes-dialog) .attributes-table {
  width: 100%;
  min-width: 1400px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

:where(.resource-attributes-dialog) .attributes-table thead {
  background: #f5f5f5;
  position: sticky;
  top: 0;
  z-index: 10;
}

:where(.resource-attributes-dialog) .attributes-table th {
  padding: 14px 10px;
  text-align: left;
  font-weight: 600;
  color: #333;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e0e0e0;
  white-space: nowrap;
}

/* Column widths */
:where(.resource-attributes-dialog) .attributes-table th:nth-child(1), :where(.resource-attributes-dialog) .attributes-table td:nth-child(1) { width: 60px !important; min-width: 60px !important; text-align: center !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(2), :where(.resource-attributes-dialog) .attributes-table td:nth-child(2),
:where(.resource-attributes-dialog) .attributes-table th:nth-child(3), :where(.resource-attributes-dialog) .attributes-table td:nth-child(3),
:where(.resource-attributes-dialog) .attributes-table th:nth-child(4), :where(.resource-attributes-dialog) .attributes-table td:nth-child(4) { width: 50px !important; min-width: 50px !important; text-align: center !important; padding: 8px 4px !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(5), :where(.resource-attributes-dialog) .attributes-table td:nth-child(5) { width: 60px !important; min-width: 60px !important; text-align: center !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(6), :where(.resource-attributes-dialog) .attributes-table td:nth-child(6) { width: 150px !important; min-width: 150px !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(7), :where(.resource-attributes-dialog) .attributes-table td:nth-child(7) { width: 180px !important; min-width: 180px !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(8), :where(.resource-attributes-dialog) .attributes-table td:nth-child(8) { width: 140px !important; min-width: 140px !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(9), :where(.resource-attributes-dialog) .attributes-table td:nth-child(9) { width: 140px !important; min-width: 140px !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(10), :where(.resource-attributes-dialog) .attributes-table td:nth-child(10) { width: 120px !important; min-width: 120px !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(11), :where(.resource-attributes-dialog) .attributes-table td:nth-child(11),
:where(.resource-attributes-dialog) .attributes-table th:nth-child(12), :where(.resource-attributes-dialog) .attributes-table td:nth-child(12) { width: 70px !important; min-width: 70px !important; text-align: center !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(13), :where(.resource-attributes-dialog) .attributes-table td:nth-child(13) { width: 80px !important; min-width: 80px !important; text-align: center !important; }
:where(.resource-attributes-dialog) .attributes-table th:nth-child(14), :where(.resource-attributes-dialog) .attributes-table td:nth-child(14) { width: 80px !important; min-width: 80px !important; text-align: center !important; padding-right: 16px !important; }

:where(.resource-attributes-dialog) .attributes-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
  cursor: pointer;
}
:where(.resource-attributes-dialog) .attributes-table tbody tr:hover        { background: #f9f9f9; }
:where(.resource-attributes-dialog) .attributes-table tbody tr.selected-row { background: #e3f2fd !important; border-left: 4px solid #2196f3; }
:where(.resource-attributes-dialog) .attributes-table tbody tr.row-disabled { opacity: 0.5; background: #fafafa; }
:where(.resource-attributes-dialog) .attributes-table td { padding: 10px; vertical-align: middle; }

/* =====================================================
   TYPE CELL / JSON ACTIONS
   ===================================================== */

:where(.resource-attributes-dialog) .type-cell-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

:where(.resource-attributes-dialog) .json-type-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}

:where(.resource-attributes-dialog) .btn-json-path-rn,
:where(.resource-attributes-dialog) .btn-json-path-rd {
  min-width: 32px !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  transition: all 0.2s ease !important;
}

:where(.resource-attributes-dialog) .btn-json-path-rn md-icon { color: #4caf50 !important; font-size: 18px !important; width: 18px !important; height: 18px !important; }
:where(.resource-attributes-dialog) .btn-json-path-rn:hover:not([disabled]) { background: rgba(76,175,80,0.1) !important; }
:where(.resource-attributes-dialog) .btn-json-path-rn:hover:not([disabled]) md-icon { color: #388e3c !important; }

:where(.resource-attributes-dialog) .btn-json-path-rd md-icon { color: #2196f3 !important; font-size: 18px !important; width: 18px !important; height: 18px !important; }
:where(.resource-attributes-dialog) .btn-json-path-rd:hover:not([disabled]) { background: rgba(33,150,243,0.1) !important; }
:where(.resource-attributes-dialog) .btn-json-path-rd:hover:not([disabled]) md-icon { color: #1976d2 !important; }

:where(.resource-attributes-dialog) .type-locked-hint {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  font-style: italic;
}

/* =====================================================
   INPUTS
   ===================================================== */

:where(.resource-attributes-dialog) .regex-input { font-family: 'Courier New', Consolas, monospace; font-size: 12px; }
:where(.resource-attributes-dialog) .number-input { text-align: right; }

:where(.resource-attributes-dialog) .not-applicable { color: #bdbdbd; font-size: 16px; display: block; text-align: center; }

.resource-attributes-dialog .empty-state { text-align: center !important; padding: 60px 20px !important; color: #999; }
.resource-attributes-dialog .empty-state md-icon { font-size: 48px !important; color: #e0e0e0; margin-bottom: 16px; }
.resource-attributes-dialog .empty-state p { font-size: 15px; margin: 0; }

/* =====================================================
   SWITCHES & RADIOS
   ===================================================== */


/* Disabled sensitive switch */
.attributes-table md-switch[disabled].md-warn .md-container { opacity: 0.4 !important; cursor: not-allowed !important; }
.attributes-table md-switch[disabled].md-warn .md-bar   { background-color: #e0e0e0 !important; }
.attributes-table md-switch[disabled].md-warn .md-thumb  { background-color: #bdbdbd !important; }

/* =====================================================
   ENUM CHIPS
   ===================================================== */

:where(.resource-attributes-dialog) .enum-wrapper { min-width: 120px; max-width: 220px; }

:where(.resource-attributes-dialog) .enum-wrapper md-chips,
.enum-wrapper .md-chips { box-shadow: none !important; border: none !important; padding: 2px 4px !important; background: transparent !important; }

:where(.resource-attributes-dialog) .enum-wrapper md-chip {
  margin: 3px 2px !important;
  height: 28px !important;
  max-height: 28px !important;
  line-height: 28px !important;
  padding: 0 10px !important;
  border-radius: 14px !important;
  background: #eef5ff !important;
  border: 1px solid #c7ddff !important;
  box-shadow: none !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  flex-direction: row-reverse !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
}

:where(.resource-attributes-dialog) .enum-wrapper md-chip:hover {
  background: #e0edff !important;
  border-color: #9ec5fe !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important;
}

.enum-wrapper md-chip .md-chip-content {
  padding: 0 !important; margin: 0 !important;
  height: 26px !important; line-height: 26px !important;
  display: inline-flex !important; align-items: center !important;
  max-width: 140px !important; float: none !important;
}

:where(.resource-attributes-dialog) .enum-chip-value {
  font-weight: 600 !important;
  color: #0b5ed7 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 120px !important;
  display: inline-block !important;
  line-height: 26px !important;
}

.enum-wrapper md-chip .md-chip-remove-container {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 26px !important;
  margin: 0 !important;
  float: none !important;
}

.enum-wrapper md-chip .md-chip-remove,
.enum-wrapper button.md-chip-remove {
  width: 18px !important; height: 18px !important;
  min-width: 18px !important; min-height: 18px !important;
  padding: 0 !important; margin: 0 !important;
  border-radius: 50% !important;
  background: rgba(0,0,0,0.18) !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.enum-wrapper md-chip .md-chip-remove md-icon,
.enum-wrapper button.md-chip-remove md-icon {
  font-size: 14px !important; width: 14px !important; height: 14px !important;
  color: white !important; margin: 0 !important;
}

.enum-wrapper md-chip .md-chip-remove:hover,
.enum-wrapper button.md-chip-remove:hover { background: #d32f2f !important; }

:where(.resource-attributes-dialog) .enum-wrapper md-chip[disabled] {
  opacity: 0.55 !important; background: #f5f5f5 !important; border-color: #e0e0e0 !important;
}
:where(.resource-attributes-dialog) .enum-wrapper md-chip[disabled] .enum-chip-value { color: #999 !important; }

:where(.resource-attributes-dialog) .enum-wrapper md-chips-wrap { box-shadow: none !important; padding: 4px !important; }

:where(.resource-attributes-dialog) .enum-wrapper md-chips input[type="text"] {
  height: 28px !important; font-size: 12px !important; padding: 0 10px !important;
  border: 1px dashed #c7ddff !important; border-radius: 14px !important;
  margin: 3px 2px !important; min-width: 90px !important; background: transparent !important;
}
:where(.resource-attributes-dialog) .enum-wrapper md-chips input[type="text"]:focus { border-color: #667eea !important; border-style: solid !important; outline: none !important; }

/* =====================================================
   TABLE ICON BUTTONS
   ===================================================== */

:where(.resource-attributes-dialog) .btn-delete-pending md-icon { color: #f44336 !important; }

/* =====================================================
   FOOTER ACTIONS
   ===================================================== */

.attributes-actions {
  background: white !important;
  border-top: 2px solid #e0e0e0 !important;
  padding: 16px 24px !important;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05) !important;
  flex-shrink: 0 !important;
  min-height: 74px !important;
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
}


:where(.resource-attributes-dialog) .btn-add  { background: #2196f3 !important; color: white !important; box-shadow: 0 2px 8px rgba(33,150,243,0.2) !important; }
:where(.resource-attributes-dialog) .btn-add md-icon { color: white !important; }
:where(.resource-attributes-dialog) .btn-add:hover { background: #1976d2 !important; box-shadow: 0 4px 12px rgba(33,150,243,0.4) !important; transform: translateY(-1px) !important; }

.resource-attributes-dialog .btn-cancel { background: #f5f5f5 !important; color: #666 !important; border: 1px solid #e0e0e0 !important; }
.resource-attributes-dialog .btn-cancel:hover { background: #e0e0e0 !important; transform: translateY(-1px) !important; }

.resource-attributes-dialog .btn-save { background: #4caf50 !important; color: white !important; box-shadow: 0 2px 8px rgba(76,175,80,0.2) !important; }
.resource-attributes-dialog .btn-save md-icon { color: white !important; }
.resource-attributes-dialog .btn-save:hover:not([disabled]) { background: #388e3c !important; box-shadow: 0 4px 12px rgba(76,175,80,0.4) !important; transform: translateY(-1px) !important; }
.resource-attributes-dialog .btn-save-disabled, .resource-attributes-dialog .btn-save[disabled] { opacity: 0.5 !important; cursor: not-allowed !important; background: #e0e0e0 !important; color: #999 !important; }

:where(.resource-attributes-dialog) .btn-close-tooltip {
  min-width: 100px !important; height: 36px !important; line-height: 36px !important;
  background: #757575 !important; color: white !important;
}
:where(.resource-attributes-dialog) .btn-close-tooltip:hover { background: #616161 !important; transform: translateY(-1px) !important; }

/* =====================================================
   JSON SCHEMA FLOATING TOOLTIP
   ===================================================== */

:where(.resource-attributes-dialog) .json-schema-tooltip {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  border: 2px solid #667eea;
  position: fixed;
  width: 700px;
  max-width: 90vw;
  max-height: 500px;
  z-index: 10000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.json-schema-tooltip.ng-hide { opacity: 0; transform: scale(0.95); }

:where(.resource-attributes-dialog) .json-schema-tooltip .tooltip-header {
  padding: 16px 20px;
  border-bottom: 2px solid #e3f2fd;
  background: linear-gradient(135deg, #e8eaf6 0%, #e3f2fd 100%);
  flex-shrink: 0;
}

:where(.resource-attributes-dialog) .json-schema-tooltip .tooltip-content {
  overflow-y: auto;
  flex: 1;
  background: #1e1e1e;
}

:where(.resource-attributes-dialog) .json-schema-display {
  margin: 0;
  padding: 20px;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

:where(.resource-attributes-dialog) .json-schema-tooltip .tooltip-footer {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
}

/* =====================================================
   JSON PATH SELECTOR OVERLAY
   ===================================================== */

:where(.resource-attributes-dialog) .bjps-overlay-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

:where(.resource-attributes-dialog) .bjps-overlay-backdrop > div {
  width: 90vw;
  max-width: 860px;
  height: 88vh;
  max-height: 88vh;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}

:where(.resource-attributes-dialog) .bjps-overlay-backdrop > div > biz-json-path-selector {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* =====================================================
   SCROLLBARS
   ===================================================== */

:where(.resource-attributes-dialog) .attributes-content::-webkit-scrollbar,
:where(.resource-attributes-dialog) .table-wrapper::-webkit-scrollbar,
:where(.resource-attributes-dialog) .json-schema-display::-webkit-scrollbar { width: 10px; height: 10px; }

:where(.resource-attributes-dialog) .attributes-content::-webkit-scrollbar-track,
:where(.resource-attributes-dialog) .table-wrapper::-webkit-scrollbar-track { background: #f5f5f5; border-left: 1px solid #e0e0e0; }

:where(.resource-attributes-dialog) .json-schema-display::-webkit-scrollbar-track { background: #2d2d2d; }

:where(.resource-attributes-dialog) .attributes-content::-webkit-scrollbar-thumb,
:where(.resource-attributes-dialog) .table-wrapper::-webkit-scrollbar-thumb { background: #bdbdbd; border-radius: 5px; border: 2px solid #f5f5f5; }

:where(.resource-attributes-dialog) .json-schema-display::-webkit-scrollbar-thumb { background: #555; border-radius: 5px; }

:where(.resource-attributes-dialog) .attributes-content::-webkit-scrollbar-thumb:hover,
:where(.resource-attributes-dialog) .table-wrapper::-webkit-scrollbar-thumb:hover { background: #9e9e9e; }

:where(.resource-attributes-dialog) .json-schema-display::-webkit-scrollbar-thumb:hover { background: #666; }

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1400px) {
  md-dialog.resource-attributes-dialog { width: 98vw !important; min-width: 900px !important; }
  :where(.resource-attributes-dialog) .attributes-table { min-width: 1300px; }
}

@media (max-width: 768px) {
  md-dialog.resource-attributes-dialog { width: 100% !important; height: 100vh !important; max-height: 100vh !important; min-width: auto !important; }
  :where(.resource-attributes-dialog) .attributes-toolbar .md-toolbar-tools { padding: 0 16px !important; }
  :where(.resource-attributes-dialog) .attributes-content { padding: 20px 16px !important; }
  :where(.resource-attributes-dialog) .attributes-table { min-width: 1200px; }
  :where(.resource-attributes-dialog) .json-schema-tooltip { width: 95vw !important; max-height: 70vh !important; }
}