/* Shared with Dictionary Check: meanings + Cambridge modals from dictionary_lookup.js */

.meanings-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  box-sizing: border-box;
}

.cambridge-modal.meanings-modal {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
}

.meanings-modal-body {
  text-align: left;
  width: 100%;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.cambridge-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  cursor: pointer;
  font-size: 1.25em;
  border: none;
  background: transparent;
  line-height: 1;
  padding: 4px;
  color: #333;
  z-index: 1;
}

.meanings-desktop {
  display: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
}

.meanings-mobile {
  display: block;
}

@media (min-width: 768px) {
  .meanings-desktop {
    display: block;
  }
  .meanings-mobile {
    display: none;
  }
}

table.meanings-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  min-width: 560px;
}

table.meanings-table thead th {
  text-align: left;
  padding: 8px;
  font-size: 0.9em;
  color: #444;
}

table.meanings-table thead th:first-child {
  font-size: 1.05em;
  font-weight: 800;
  color: #222;
}

table.meanings-table tbody tr {
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

table.meanings-table tbody tr:hover {
  background-color: #eef6ff;
}

table.meanings-table td {
  padding: 12px;
  vertical-align: top;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: normal;
  overflow-wrap: normal;
}

table.meanings-table td.action-cell {
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  vertical-align: middle;
}

table.meanings-table tbody td:first-child {
  font-size: 1.12rem;
  font-weight: 700;
  color: #111;
  line-height: 1.35;
}

button.row-edit-btn {
  padding: 6px 12px;
  font-size: 14px;
  background: #5c6bc0;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button.row-edit-btn:hover {
  background: #3f51b5;
}

button.row-sentence-btn {
  padding: 6px 12px;
  font-size: 14px;
  background: linear-gradient(90deg, #7e57c2, #5c6bc0);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button.row-sentence-btn:hover {
  filter: brightness(1.06);
}

button.row-save-btn {
  padding: 6px 12px;
  font-size: 14px;
  background: #66bb6a;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button.row-save-btn:hover {
  filter: brightness(1.05);
}

button.row-delete-btn {
  padding: 6px 12px;
  font-size: 14px;
  background: #c62828;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button.row-delete-btn:hover {
  filter: brightness(1.06);
}

.meaning-card {
  background: #f9f9f9;
  border-radius: 10px;
  padding: 14px 14px 12px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e8e8e8;
  text-align: left;
}

.meaning-field .mf-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin-bottom: 5px;
}

.meaning-field .mf-value {
  font-size: 0.95rem;
  line-height: 1.45;
  color: #222;
  word-break: normal;
  overflow-wrap: normal;
}

.meaning-card .meaning-field:first-child .mf-label {
  font-size: 0.8rem;
  color: #333;
}

.meaning-card .meaning-field:first-child .mf-value {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.35;
  color: #111;
}

.meaning-field + .meaning-field {
  margin-top: 12px;
}

.meaning-card-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meaning-card-actions .row-edit-btn,
.meaning-card-actions .row-save-btn,
.meaning-card-actions .row-sentence-btn,
.meaning-card-actions .row-delete-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  touch-action: manipulation;
}

/* Cambridge modal (dictionary check parity) */
.cambridge-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  box-sizing: border-box;
}

.cambridge-modal {
  position: relative;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.cambridge-modal table {
  width: 100%;
  border-collapse: collapse;
}

.cambridge-modal th,
.cambridge-modal td {
  border: 1px solid #ccc;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

/* Edit phrase overlay (from meanings row) */
.dl-meanings-edit-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10060;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.dl-meanings-edit-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.dl-meanings-edit-box h2 {
  margin: 0 0 16px 0;
  font-size: 1.25em;
}

.dl-modal-form label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  font-size: 0.9em;
}

.dl-modal-form input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95em;
  box-sizing: border-box;
}

.dl-modal-form .list-section {
  margin-top: 16px;
}

.dl-modal-form .list-section h3 {
  margin: 0 0 8px 0;
  font-size: 1em;
}

.dl-modal-form .list-section .list-hint {
  margin: 0 0 10px 0;
  font-size: 0.85em;
  font-weight: 400;
  color: #666;
}

.dl-modal-form .sentence-block {
  position: relative;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 12px 40px 12px 12px;
  margin-bottom: 12px;
  background: #fafafa;
}

.dl-modal-form .sentence-block .remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: #ffcdd2;
  color: #b71c1c;
  cursor: pointer;
  font-size: 0.85em;
}

.dl-modal-form .sentence-field {
  margin-bottom: 10px;
}

.dl-modal-form .sentence-field label {
  display: block;
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 0.8em;
  font-weight: 600;
  color: #444;
}

.dl-modal-form .sentence-field input {
  width: 100%;
  margin-top: 0;
}

.dl-modal-form .add-btn {
  margin-top: 6px;
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: #c5e1a5;
  color: #2e4730;
  cursor: pointer;
  font-size: 0.85em;
}

.dl-modal-form .modal-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dl-modal-form .modal-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 0.9em;
  cursor: pointer;
}

.dl-modal-form .modal-actions .save-btn {
  background: #66bb6a;
  color: #fff;
}

.dl-modal-form .modal-actions .cancel-btn {
  background: #e0e0e0;
  color: #333;
}

.dl-modal-form .inline-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.dl-modal-form .inline-radio-group label {
  font-weight: 400;
  margin-top: 0;
}

.dl-type-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.dl-type-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #ccc;
  padding: 4px 10px;
  font-size: 0.9em;
  cursor: pointer;
  background: #ffffff;
  color: #333;
}

.dl-type-pill input {
  display: none;
}

.dl-type-pill span {
  white-space: nowrap;
}

.dl-type-pill input:checked + span {
  background: linear-gradient(90deg, #42a5f5, #7e57c2);
  color: #ffffff;
  border-radius: 999px;
  padding: 2px 8px;
}
