/* Multi Table Plugin - Styles */
/* All classes prefixed with mt- */

/* ===== Row Number Column - Fixed Width ===== */
.mt-excel-table thead th.mt-row-number,
.mt-excel-table tbody td.mt-row-number {
  width: 15px !important;
  min-width: 15px !important;
  max-width: 15px !important;
  padding: 0 !important;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}

.mt-excel-table thead th.mt-row-number {
  background: #1e4080 !important;
  pointer-events: none;
}

.mt-row-number {
  background: #f0f0f0;
  color: #666;
  font-weight: 500;
  cursor: pointer;
}

/* ===== Variables ===== */
:root {
  --mt-primary: #7590b5;
  --mt-primary-dark: #5a7ba3;
  --mt-success: #2e7d32;
  --mt-warning: #f57c00;
  --mt-danger: #c62828;
  --mt-info: #0288d1;
  --mt-bg: #f5f5f5;
  --mt-border: #ddd;
  --mt-text: #333;
  --mt-text-light: #666;
}

/* ===== Base ===== */
.mt-container {
  padding: 16px;
}

.mt-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ===== Table Header ===== */
.mt-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--mt-border);
  border-radius: 4px;
}

.mt-table-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--mt-text);
}

.mt-table-actions {
  display: flex;
  gap: 8px;
}

/* ===== Table Grid ===== */
.mt-grid-wrapper {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--mt-border);
  border-radius: 4px;
}

.mt-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* ===== Column Headers ===== */
.mt-grid th {
  position: sticky;
  top: 0;
  background: var(--mt-bg);
  border: 1px solid var(--mt-border);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  z-index: 10;
}

.mt-grid th.mt-column-required::after {
  content: ' *';
  color: var(--mt-danger);
}

.mt-column-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mt-column-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mt-column-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.mt-grid th:hover .mt-column-actions {
  opacity: 1;
}

/* ===== Cells ===== */
.mt-grid td {
  border: 1px solid var(--mt-border);
  padding: 8px 12px;
  vertical-align: top;
}

.mt-cell {
  min-height: 32px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 3px;
  transition: background-color 0.15s;
}

.mt-cell:hover {
  background-color: #e3f2fd;
}

.mt-cell.mt-cell-editing {
  padding: 0;
}

.mt-cell-empty {
  color: var(--mt-text-light);
  font-style: italic;
}

.mt-cell-readonly {
  background-color: var(--mt-bg);
  cursor: default;
}

.mt-cell-readonly:hover {
  background-color: var(--mt-bg);
}

/* ===== Cell Input Styles ===== */
.mt-cell-input {
  width: 100%;
  min-width: 2px;
  padding: 6px 8px;
  border: 2px solid var(--mt-primary);
  border-radius: 3px;
  font-size: 14px;
  outline: none;
}

.mt-cell-input:focus {
  border-color: var(--mt-primary-dark);
  box-shadow: 0 0 0 2px rgba(117, 144, 181, 0.2);
}

.mt-cell-textarea {
  min-height: 60px;
  resize: vertical;
}

.mt-cell-number {
  width: 120px;
}

.mt-cell-checkbox {
  width: auto;
  cursor: pointer;
}

/* ===== Row Styles ===== */
.mt-row-checkbox {
  cursor: pointer;
}

.mt-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

tr:hover .mt-row-actions {
  opacity: 1;
}

.mt-row-locked {
  background-color: #fff3e0;
}

.mt-row-selected {
  background-color: #e8f5e9;
}

/* ===== Icons ===== */
.mt-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.mt-icon-checked {
  background: url('../images/check.png') no-repeat center;
  background-size: contain;
}

.mt-icon-unchecked {
  background: url('../images/unchecked.png') no-repeat center;
  background-size: contain;
}

.mt-icon-edit::before {
  content: '✎';
}

.mt-icon-delete::before {
  content: '✕';
}

.mt-icon-lock::before {
  content: '🔒';
}

.mt-icon-unlock::before {
  content: '🔓';
}

/* ===== Rating ===== */
.mt-rating {
  color: #ffc107;
  letter-spacing: 2px;
}

/* ===== Links ===== */
.mt-link {
  color: var(--mt-primary);
  text-decoration: none;
}

.mt-link:hover {
  text-decoration: underline;
}

/* ===== Buttons ===== */
.mt-btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.mt-btn:hover {
  text-decoration: none;
}

.mt-btn-primary {
  background-color: var(--mt-primary);
  color: white;
}

.mt-btn-primary:hover {
  background-color: var(--mt-primary-dark);
}

.mt-btn-success {
  background-color: var(--mt-success);
  color: white;
}

.mt-btn-danger {
  background-color: var(--mt-danger);
  color: white;
}

.mt-btn-secondary {
  background-color: var(--mt-bg);
  color: var(--mt-text);
  border: 1px solid var(--mt-border);
}

.mt-btn-secondary:hover {
  background-color: #e0e0e0;
}

.mt-btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* ===== Forms ===== */
.mt-form-group {
  margin-bottom: 16px;
}

.mt-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--mt-text);
}

.mt-label-required::after {
  content: ' *';
  color: var(--mt-danger);
}

.mt-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--mt-border);
  border-radius: 4px;
  font-size: 14px;
}

.mt-input:focus {
  border-color: var(--mt-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(117, 144, 181, 0.2);
}

.mt-textarea {
  min-height: 80px;
  resize: vertical;
}

.mt-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--mt-border);
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
}

/* ===== Edit/New form layout ===== */
.mt-edit-container {
  max-width: 1600px;
  margin: 20px auto;
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mt-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8e8e8;
}

.mt-edit-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.mt-edit-subtitle {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

.mt-edit-form-group {
  margin-bottom: 20px;
}

.mt-edit-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.mt-edit-required {
  color: #dc3545;
  margin-left: 4px;
}

.mt-edit-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.mt-edit-input:focus {
  outline: none;
  border-color: #2c5aa0;
  box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.mt-edit-textarea {
  min-height: 80px;
  resize: vertical;
}

.mt-edit-select {
  background: #fff;
  cursor: pointer;
}

.mt-edit-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.mt-edit-checkbox {
  margin-right: 8px;
  width: 16px;
  height: 16px;
}

.mt-edit-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #e8e8e8;
}

.mt-edit-btn {
  padding: 8px 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.mt-edit-btn-primary {
  background: #2c5aa0;
  color: #fff;
  border-color: #2c5aa0;
}

.mt-edit-btn-primary:hover {
  background: #1e4080;
  border-color: #1e4080;
}

.mt-edit-btn-secondary {
  background: #fff;
  color: #666;
}

.mt-edit-btn-secondary:hover {
  background: #f5f5f5;
}

.mt-edit-link {
  color: #2c5aa0;
  text-decoration: none;
}

.mt-edit-link:hover {
  text-decoration: underline;
}

/* ===== Tables List ===== */
.mt-table-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mt-table-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--mt-border);
  border-radius: 4px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}

.mt-table-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mt-table-info {
  flex: 1;
}

.mt-table-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--mt-text);
  margin-bottom: 4px;
}

.mt-table-meta {
  font-size: 12px;
  color: var(--mt-text-light);
}

.mt-table-category {
  display: inline-block;
  padding: 2px 8px;
  background: var(--mt-bg);
  border-radius: 3px;
  font-size: 12px;
  margin-right: 8px;
}

.mt-table-private {
  background: #fff3e0;
  color: var(--mt-warning);
}

.mt-table-locked {
  background: #ffebee;
  color: var(--mt-danger);
}

/* ===== Toast Messages ===== */
.mt-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 24px;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  z-index: 9999;
  animation: mt-toast-slide-in 0.3s ease-out;
}

.mt-toast-notice {
  background-color: var(--mt-success);
}

.mt-toast-error {
  background-color: var(--mt-danger);
}

.mt-toast-warning {
  background-color: var(--mt-warning);
}

.mt-toast-info {
  background-color: var(--mt-info);
}

@keyframes mt-toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== Modal ===== */
.mt-modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--mt-border);
}

.mt-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.mt-modal-body {
  padding: 16px;
}

.mt-modal-footer {
  padding: 16px;
  border-top: 1px solid var(--mt-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Recycle Bin ===== */
.mt-recycle-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mt-recycle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--mt-border);
  border-radius: 4px;
  margin-bottom: 8px;
}

.mt-recycle-info {
  flex: 1;
}

.mt-recycle-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.mt-recycle-meta {
  font-size: 12px;
  color: var(--mt-text-light);
}

.mt-recycle-actions {
  display: flex;
  gap: 8px;
}

/* ===== Templates ===== */
.mt-template-card {
  display: inline-block;
  width: 280px;
  padding: 16px;
  background: white;
  border: 1px solid var(--mt-border);
  border-radius: 4px;
  margin: 0 8px 8px 0;
  vertical-align: top;
}

.mt-template-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.mt-template-desc {
  font-size: 14px;
  color: var(--mt-text-light);
  margin-bottom: 8px;
}

.mt-template-meta {
  font-size: 12px;
  color: var(--mt-text-light);
}

/* ===== Pagination ===== */
.mt-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.mt-pagination-info {
  font-size: 14px;
  color: var(--mt-text-light);
}

/* ===== Empty State ===== */
.mt-empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--mt-text-light);
}

.mt-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.mt-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--mt-text);
  margin-bottom: 8px;
}

.mt-empty-desc {
  font-size: 14px;
  margin-bottom: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .mt-table-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .mt-table-actions {
    flex-wrap: wrap;
  }

  .mt-grid {
    font-size: 12px;
  }

  .mt-grid th,
  .mt-grid td {
    padding: 6px 8px;
  }

  .mt-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

.mt-card-action-btn {
  background: none;
  border: none;
  color: var(--mt-primary);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.mt-card-action-btn:hover {
  color: var(--mt-primary-dark);
  text-decoration: none;
}

.mt-card-action-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.mt-text-center {
  text-align: center;
}

.mt-text-right {
  text-align: right;
}

.mt-mt-0 {
  margin-top: 0;
}

.mt-mb-0 {
  margin-bottom: 0;
}

.mt-ml-8 {
  margin-left: 8px;
}

.mt-mr-8 {
  margin-right: 8px;
}

.mt-p-8 {
  padding: 8px;
}
