/* ================================================
   Glossary Pages
================================================ */

.lmat-glossary {
    width: calc(100% - 4rem);
    margin-inline: 2rem;
    margin-top: 25px;
    flex: 2;
  }

  .lmat-glossary *{
    position: relative;
    box-sizing: border-box;
    font-family: Inter, Roboto, Helvetica, Arial, sans-serif;
  }
  
  .lmat-glossary-container {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
  }
  
  .lmat-header h1 {
    font-size: 24px;
    margin-bottom: 30px;
  }
  
  .lmat-header p {
    margin-bottom: 10px;
  }
  
  .lmat-header ul {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 10px;
  }
  
  .lmat-header a {
    color: #0073aa;
    text-decoration: none;
  }
  
  .lmat-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 46px 0 20px;
  }
  
  .lmat-search,
  .lmat-glossary-type {
    padding: 8px;
  }
  
  .lmat-update-btn,
  .lmat-add-btn,
  .lmat-import-btn,
  .lmat-export-btn {
    padding: 8px 12px;
    background-color: #007cba;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
  }
  
  .lmat-update-btn:hover,
  .lmat-add-btn:hover,
  .lmat-import-btn:hover,
  .lmat-export-btn:hover {
    background-color: #005a8c;
  }
  
  .lmat-status {
    font-size: 14px;
    color: #555;
  }
  
  .lmat-alphabet {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
    border-top: 1px solid rgba(51, 135, 158, 0.2);
    border-bottom: 1px solid rgba(51, 135, 158, 0.2);
    padding: 10px 0;
  }
  
  .lmat-alphabet button {
    min-width: 32px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: not-allowed;
    text-transform: uppercase;
    transition: all 0.3s ease;
    background-color: #fff;
  }
  
  .lmat-alphabet button:not([disabled]) {
    color: #007cba;
    cursor: pointer;
  }
  
  .lmat-alphabet button.active:not([disabled]) {
    color: #0073aa;
    font-weight: bold;
    background-color: rgba(51, 135, 158, 0.15);
    border-radius: 100%;
  }
  
  /* ================================================
     Glossary Modal Styles
  ================================================ */
  
  .lmat-glossary-modal.lmat-hidden {
    display: none;
  }
  
  .lmat-glossary-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1005001;
  }
  
  .lmat-glossary-modal-content-wrapper {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 4px;
    max-width: 600px;
    width: 90%;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-height: 85vh;
  }
  
  .lmat-glossary-modal-content {
    padding: 5px 5px 0px 5px;
    border: 35px solid white;
    overflow-y: auto;
  }
  
  .lmat-glossary-modal-actions {
    display: flex;
    justify-content: space-between;
    background: #fff;
    padding: 33px 25px 0px 0px;
    border-top: 1px solid #eee;
    position: sticky;
    bottom: 0;
    left: 0;
    z-index: 2;
  }

  .lmat-glossary-modal-actions #add-glossary-term-btn {
    margin: 5px;
  }
  
  .lmat-glossary-modal-content h2 {
    margin-top: 4px;
    margin-bottom: 20px;
    font-size: 22px;
  }
  
  .lmat-glossary-modal-content label {
    display: block;
    font-weight: 500;
  }
  
  .lmat-glossary-modal-content textarea,
  .lmat-glossary-modal-content select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
  }

  .lmat-glossary-modal-content label {
    margin-top: 16px;
  }
  
  .lmat-glossary-modal-actions .lmat-glossary-modal-actions-left {
    cursor: pointer;
    text-decoration: underline;
  }
  
  /* ================================================
     Import Glossary Section (Modal Content)
  ================================================ */
  
  .lmat-import-glossary {
    font-family: Arial, sans-serif;
    margin: auto;
  }
  
  .lmat-title {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
  }
  
  .lmat-upload-box {
    display: block;
    cursor: pointer;
    margin-bottom: 20px;
  }
  
  .lmat-upload-area {
    border: 2px dashed #c2c2c2;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    background-color: #f9f9f9;
  }
  
  .lmat-upload-area img {
    width: 30px;
    height: 30px;
    margin-bottom: 10px;
  }
  
  .lmat-upload-area span {
    display: block;
    color: #007baf;
    font-weight: 600;
  }
  
  
  .lmat-help-text {
    font-size: 13px;
    color: #666;
  }
  
  .lmat-download-link {
    color: #007baf;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
  }
  
  .lmat-import-success {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid rgb(71, 165, 191);
    background: rgb(245, 245, 245);
    border-radius: 8px;
    text-align: center;
  }
  
  .lmat-hidden {
    display: none;
  }
  
  .lmat-close-button {
    margin-top: 15px;
    padding: 8px 16px;
    background: #007baf;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
  }
  
  .lmat-import-success-message {
    color: rgb(39, 173, 149);
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    margin: 24px 0 12px 0;
    letter-spacing: 0.01em;
  }
  
  .lmat-import-close-btn {
    display: block;
    margin: 20px auto 0 auto;
    padding: 8px 24px;
    background: #fff;
    color: #007baf;
    border: 1px solid #007baf;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  
  .lmat-import-close-btn:hover {
    background: #007baf;
    color: #fff;
  }
  
  .lmat-import-success-icon {
    margin-bottom: 18px;
  }
  
  .lmat-import-success-file {
    font-size: 15px;
    color: #222;
    margin-bottom: 10px;
  }
  
  #lmat-importing-file-label {
    color: #222;
    margin-right: 4px;
  }
  
  #lmat-importing-file-name {
    color: #222;
    font-weight: 500;
    word-break: break-all;
  }
  
  .lmat-glossary-table-wrapper {
    overflow-x: auto;
    width: 100%;
    position: relative;
  }
  
  .lmat-glossary-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Segoe UI', Arial, sans-serif;
  }
  
  .lmat-glossary-table thead tr:first-child th {
    border-bottom: none;
    text-align: center;
    font-size: 1.2em;
    padding: 13px 0;
  }
  
  .lmat-glossary-table thead tr:nth-child(2) th {
    background: #222;
    color: #fff;
    font-weight: 600;
    text-align: left;
    padding: 12px 8px;
  }
  
.lmat-glossary-table th, .lmat-glossary-table td {
    padding: 12px 8px;
    vertical-align: middle;
    position: relative;
}
  
  .lmat-entry-title {
    font-weight: 500;
    font-size: 1.1em;
  }
  
  .lmat-entry-desc {
    color: #888;
    font-size: 0.95em;
    margin-top: 2px;
  }
  
  .lmat-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 500;
}

.lmat-type-badge.general {
    background: #eaf6fa;
}

.lmat-type-badge.name {
    background: #eafaf0;
    color: #1a7f37;
}

/* Edit and Delete button styles */
.lmat-edit-btn {
    background: #2271b1;
    border: none;
    color: white;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 4px;
    text-decoration: none;
}

.lmat-edit-btn:hover {
    text-decoration: underline;
}

.lmat-delete-btn {
    background: #dc3232;
    border: none;
    color: white;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    border-radius: 4px;
}

.lmat-delete-btn:hover {
    text-decoration: underline;
}

/* Delete button loading state */
.lmat-delete-btn.lmat-delete-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
    background: #dc3232;
    color: white;
    border: none;
    padding: 7px 12px;
    cursor: not-allowed;
    font-size: 13px;
    border-radius: 4px;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lmat-delete-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: lmat-delete-spin 0.8s linear infinite;
}

@keyframes lmat-delete-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No translation edit button */
.lmat-edit-btn-svg {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

.lmat-edit-btn-svg img {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

/* Save/Cancel buttons in edit mode */
.lmat-save-edit-btn {
    background: #2496b8;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 5px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    transition: background 0.2s;
}

.lmat-save-edit-btn:hover {
    background: #1b7a97;
}

.lmat-cancel-edit-btn {
    background-color: transparent;
    color: #666;
    border: none;
    border-radius: 4px;
    padding: 5px 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    text-decoration: underline;
    transition: background 0.2s;
}

.lmat-cancel-edit-btn:hover {
    color: #414141;
}
  
.lmat-icon-doc {
    display: inline-block;
    width: 22px;
    height: 22px;
    background: url('doc-icon.svg') center/contain no-repeat;
    vertical-align: middle;
}
  
.lmat-lang-header img {
    width: 16px;
    height: 11px;
    vertical-align: middle;
}
  
@media (max-width: 900px) {
    .lmat-glossary-table-wrapper {
      max-width: 100%;
      font-size: 0.95em;
    }
    .lmat-glossary-table th, .lmat-glossary-table td {
      padding: 8px 4px;
    }
}
  
.lmat-language-filters {
    display: flex;
    gap: 16px;
    margin: 18px 0 18px 0;
    flex-wrap:wrap;
}
  
.lmat-lang-filter-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 11px;
    border-radius: 18px;
    border: 1.5px solid #cce3e3;
    background: #f8f8f8;
    color: #1a3a4a;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
  
.lmat-lang-filter-btn img {
    background: #fff;
    border: 1px solid #e0e0e0;
}
  
.lmat-lang-filter-btn.active,
.lmat-lang-filter-btn:hover {
    background: #eaf6fa;
    border-color: #7ed6df;
    color: #0073aa;
}
  
/* ================================================
     Improved Glossary Table Editor Row Styles
=============================================== */
.lmat-glossary-edit-row {
    background: #eaf2f5 !important;
    border-bottom: 1px solid #dde6ea;
    border-left: none;
    box-shadow: none;
}
  
.lmat-glossary-edit-row td {
    padding: 18px 12px 12px 12px !important;
    vertical-align: top !important ;
}
  
.lmat-glossary-edit-row textarea,
.lmat-glossary-edit-row select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 0;
    box-sizing: border-box;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}
  
.lmat-glossary-edit-row textarea:focus,
.lmat-glossary-edit-row select:focus {
    border: 1px solid rgb(51, 135, 158) !important;
    box-shadow: rgb(51, 135, 158) 0px 0px 3px !important;
    border-radius: 2px !important;
}
  
.lmat-glossary-edit-row .lmat-edit-type {
    width: auto;
    min-width: 71px;
    padding: 3px 20px 3px 10px;
    border-radius: 10px;
    border: 1.5px solid #7ed6bf;
    color: #1ca97c;
    font-weight: 600;
    font-size: 0.9em;
    position: relative;
    margin-bottom: 0;
    margin-top: 8px;
    box-shadow: none;
    appearance: none;
    cursor: pointer;
    text-align: center;
}
  
.lmat-glossary-edit-row .lmat-edit-type {
    background-image: url("data:image/svg+xml;utf8,<svg fill='none' stroke='%231ca97c' stroke-width='2' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'><path d='M6 8l4 4 4-4'/></svg>");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 18px 18px;
}
  
.lmat-glossary-edit-row .lmat-edit-type::-ms-expand {
    display: none;
}
.lmat-glossary-edit-row .lmat-edit-type:focus {
    border-color: #1ca97c;
    outline: none;
    box-shadow: 0 0 0 2px #1ca97c22;
    background: #eafaf0;
}
  
.lmat-glossary-edit-row .lmat-save-edit-btn {
    background: #2496b8;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    margin-bottom: 0;
    box-shadow: 0 2px 8px #2496b81a;
    transition: background 0.2s;
    display: block;
}
  
.lmat-glossary-edit-row .lmat-save-edit-btn:hover {
    background: #1b7a97;
}
  
.lmat-glossary-edit-row .lmat-cancel-edit-link {
    color: #666;
    text-decoration: underline;
    font-size: 1em;
    margin-left: 0;
    cursor: pointer;
    display: block;
    transition: color 0.2s;
}
  
.lmat-glossary-edit-row .lmat-cancel-edit-link:hover {
    text-decoration: underline;
}
  
.lmat-glossary-edit-row td textarea:last-child {
    margin-bottom: 0;
}
  
.lmat-glossary-edit-row td:last-child,
.lmat-glossary-edit-row td:nth-last-child(2) {
    vertical-align: middle;
}
  
/* Fix: Only stripe visible, non-edit data rows in tbody
.lmat-glossary-table tbody tr:not(.lmat-glossary-edit-row):nth-of-type(even) {
  background: #f7f7f7;
} */
  
.lmat-glossary-table td:first-child,
.lmat-glossary-table th:first-child {
    max-width: 270px;
    width: 270px;
    min-width: 180px;
    word-break: break-word;
    white-space: normal;
}
  
.lmat-glossary-table td:not(:first-child),
.lmat-glossary-table th:not(:first-child) {
    text-align: center !important;
    vertical-align: middle !important;
}
  
.lmat-alphabet button.active:not([disabled]) {
    color: #0073aa;
    font-weight: bold;
    background-color: rgba(51, 135, 158, 0.15);
    border-radius: 100%;
}
  
.lmat-add-translations label {
    display: block;
}
.lmat-add-translation {
    width: 100%;
    min-height: 32px;
    margin-top: 4px;
}
  
.lmat-add-translations {
    display: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s, max-height 0.4s;
}
.lmat-add-translations.lmat-show {
    display: flex !important;
    opacity: 1;
    max-height: 2000px;
    overflow: visible;
    transition: opacity 0.3s, max-height 0.4s;
}
  
.lmat-add-translations.lmat-translations-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 20px;
    margin-top: 20px;
}
  
.lmat-translations-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.lmat-translation-field {
  flex: 1 1 0;
  min-width: 160px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lmat-translation-label-row{
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
  
.lmat-translation-label-row img{
  width: 18px;
}

@media (max-width: 700px) {
    .lmat-add-translations.lmat-translations-grid {
        grid-template-columns: 1fr !important;
    }
}

.lmat-modal-close-btn {
    position: absolute;
    top: 8px;
    right: 17px;
    z-index: 10;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}
.lmat-modal-close-btn:hover {
    color: #2496b8;
}

.lmat-translation-field.lmat-hidden {
    display: none !important;
}

.lmat-language-filters:empty {
    display: none;
}

.lmat-controls .lmat-glossary-type {
    vertical-align: middle;
}

.lmat-alphabet-btn.active:not([disabled]) {
    color: #0073aa;
    font-weight: bold;
    background-color: rgba(51, 135, 158, 0.15);
    border-radius: 100%;
}

.lmat-glossary-table thead th {
    text-align: center;
    padding: 12px 8px;
    vertical-align: middle;
    z-index: 3;
    position: relative;
}

.lmat-glossary-table thead th .lmat-lang-flag {
    width: 20px;
    height: auto;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
}

.lmat-glossary-table thead th[data-lang] {
    font-size: 14px;
    white-space: nowrap;
}

.lmat-action-buttons {
    position: sticky;
    right: 0;
    background: transparent;
    padding: 8px 8px;
    z-index: 2;
    display: flex;
    gap: 25px;
    justify-content: center;
    min-width: 100px;
}

.lmat-action-buttons-header  {
    position: sticky;
    right: 0;
    background: transparent;
    padding: 8px 8px;
    z-index: 2;
    display: flex;
    justify-content: center;
    min-width: 100px;
}

.lmat-action-buttons-header .lmat-actions-header-btn {
    margin: 0 10px !important;
}

.lmat-action-buttons::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    bottom: 0;
    width: 10px;
}

.lmat-edit-btn,
.lmat-delete-btn {
    position: relative;
    z-index: 3;
}

.lmat-actions-cell {
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 10;
  min-width: 120px;
  padding: 0;
}
.lmat-action-buttons {
  display: flex;
  gap: 32px;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 8px 8px;
  background: transparent;
}

/* Sticky Actions header and cell */
.lmat-glossary-table th.lmat-actions-cell,
.lmat-glossary-table td.lmat-actions-cell {
    position: sticky;
    right: 0;
    background: #fff;
    z-index: 20;
    min-width: 120px;
    box-shadow: -2px 0 4px -2px rgba(0,0,0,0.04);
}

.lmat-glossary-table thead tr:nth-child(2) th:last-child {
    position: sticky;
    right: 0;
    background: #222;
    z-index: 19;
    min-width: 120px;
    box-shadow: -2px 0 4px -2px rgba(0,0,0,0.04);
}

/* Sticky actions cell matches row background */
.lmat-glossary-table td.lmat-actions-cell {
    background: #fff !important;
}

/* .lmat-add-translation, */
.lmat-edit-translation {
    min-width: 145px;
    max-width: 220px;
    width: 100%;
    height: 170px;
    min-height: 36px;
    max-height: 170px;
    padding: 5px 6px;
    border-radius: 6px;
    font-size: 1em;
    resize: vertical;
    box-sizing: border-box;
    line-height: 1.4;
    margin: 0 auto;
    display: block;
    transition: height 0.2s ease-in-out;
}

/* Widen language columns */
.lmat-glossary-table th[data-lang],
.lmat-glossary-table td[data-lang] {
    min-width: 120px;
    max-width: 180px;
    width: 140px;
    text-align: center;
    vertical-align: middle;
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
}

/* Make translation textareas fit the column */
/* .lmat-edit-translation, */
.lmat-add-translations.lmat-translations-grid,
.lmat-add-translations.lmat-translations-grid.lmat-show .lmat-add-translation {
    width: 100%;
    min-width: 100px;
    box-sizing: border-box;
    margin-top: 20px;
}

/* Add this to your CSS */
.lmat-row-striped {
    background: #f7f7f7 !important;
}

/* Sticky actions cell matches row background */
.lmat-glossary-table td.lmat-actions-cell {
    background: #fff !important;
}
.lmat-glossary-table tbody tr.lmat-row-striped td.lmat-actions-cell {
    background: #f7f7f7 !important;
}

.lmat-glossary-table th.lmat-actions-cell button,
.lmat-glossary-table th.lmat-actions-cell .lmat-actions-header-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #eaf2f5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: none;
    transition: background 0.2s;
    cursor: pointer;
    padding: 0;
}

.lmat-glossary-table th.lmat-actions-cell button:hover,
.lmat-glossary-table th.lmat-actions-cell .lmat-actions-header-btn:hover {
    background: #e6eef3;
}

tr.lmat-glossary-edit-row > td.lmat-actions-cell {
    background-color: #eaf2f5 !important
}

#lmat-no-results {
    text-align:center;
    margin: 32px 0; 
    color: #888;
    font-size: 1.2em;
}

.lmat-translation-error {
    color: rgb(219, 85, 43);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.lmat-edit-translation.error,
.lmat-add-translation.error,
.lmat-edit-term.error,
.lmat-add-term.error,
.lmat-edit-desc.error,
.lmat-add-desc.error {
    height: 126px !important;
    border-color: rgb(219, 85, 43) !important;
}

.lmat-edit-term.error,
.lmat-add-term.error,
.lmat-edit-desc.error,
.lmat-add-desc.error {
    height: auto !important;
    min-height: 32px;
}

/* Glossary Loader Styles */
.lmat-glossary-loader {
    position: absolute;
    display: flex;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    z-index: 1005002;
    justify-content: center;
    align-items: center;
}

.lmat-glossary-loader.active {
    display: flex;
}

.lmat-glossary-loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: lmat-spin 1s linear infinite;
}

@keyframes lmat-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}