/* Custom Table Manager - Admin Styles */

/* 버튼 스타일 개선 */
.youelblocks-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  line-height: 1.4;
  white-space: nowrap;
}

.youelblocks-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.youelblocks-btn-primary {
  background-color: #007cba;
  color: white;
}

.youelblocks-btn-primary:hover:not(:disabled) {
  background-color: #005a87;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.youelblocks-btn-secondary {
  background-color: #6c757d;
  color: white;
}

.youelblocks-btn-secondary:hover:not(:disabled) {
  background-color: #545b62;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.youelblocks-btn-danger {
  background-color: #dc3545;
  color: white;
}

.youelblocks-btn-danger:hover:not(:disabled) {
  background-color: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.youelblocks-btn-success {
  background-color: #28a745;
  color: white;
}

.youelblocks-btn-success:hover:not(:disabled) {
  background-color: #218838;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.youelblocks-btn-warning {
  background-color: #ffc107;
  color: #212529;
}

.youelblocks-btn-warning:hover:not(:disabled) {
  background-color: #e0a800;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.youelblocks-btn-info {
  background-color: #17a2b8;
  color: white;
}

.youelblocks-btn-info:hover:not(:disabled) {
  background-color: #138496;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.youelblocks-btn-icon {
  font-size: 14px;
  line-height: 1;
}

.youelblocks-btn-small {
  padding: 4px 8px;
  font-size: 12px;
}

.youelblocks-btn-large {
  padding: 12px 24px;
  font-size: 16px;
}

/* 버튼 그룹 스타일 */
.youelblocks-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.youelblocks-btn-group .youelblocks-btn {
  margin: 0;
}

/* 버튼 로딩 상태 */
.youelblocks-btn-loading {
  position: relative;
  color: transparent !important;
}

.youelblocks-btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: youelblocks-spin 1s linear infinite;
}

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

/* 토스트 메시지 스타일 */
.youelblocks-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  max-width: 350px;
  transform: translateX(400px);
  transition: transform 0.3s ease-in-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

.youelblocks-toast-show {
  transform: translateX(0);
}

.youelblocks-toast-icon {
  font-size: 16px;
  font-weight: bold;
  flex-shrink: 0;
}

.youelblocks-toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.youelblocks-toast-success {
  border-left: 4px solid #46b450;
  background: #f7fcf7;
}

.youelblocks-toast-success .youelblocks-toast-icon {
  color: #46b450;
}

.youelblocks-toast-error {
  border-left: 4px solid #dc3232;
  background: #fef7f7;
}

.youelblocks-toast-error .youelblocks-toast-icon {
  color: #dc3232;
}

.youelblocks-toast-warning {
  border-left: 4px solid #ffb900;
  background: #fefcf7;
}

.youelblocks-toast-warning .youelblocks-toast-icon {
  color: #ffb900;
}

.youelblocks-toast-info {
  border-left: 4px solid #0073aa;
  background: #f7f9fc;
}

.youelblocks-toast-info .youelblocks-toast-icon {
  color: #0073aa;
}

/* 모달 아이콘 스타일 */
.youelblocks-modal-icon {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px;
}

.youelblocks-modal-message {
  text-align: center;
  line-height: 1.5;
}

.youelblocks-admin-dashboard {
  margin: 20px 0;
}

.youelblocks-admin-section {
  background: #fff;
  border: 1px solid #ccd0d4;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.youelblocks-admin-section h2 {
  margin-top: 0;
  color: #23282d;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.youelblocks-features ul {
  list-style: none;
  padding: 0;
}

.youelblocks-features li {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.youelblocks-features li:last-child {
  border-bottom: none;
}

.youelblocks-quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.youelblocks-quick-links .button {
  margin: 0;
}

/* 가이드 페이지 스타일 */
.youelblocks-guide-content {
  max-width: 800px;
}

.youelblocks-guide-section {
  background: #fff;
  border: 1px solid #ccd0d4;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.youelblocks-guide-section h2 {
  color: #0073aa;
  margin-top: 0;
}

.youelblocks-guide-section h3 {
  color: #23282d;
  margin-top: 20px;
}

.youelblocks-guide-section ol,
.youelblocks-guide-section ul {
  padding-left: 20px;
}

.youelblocks-guide-section li {
  margin-bottom: 8px;
}

.youelblocks-guide-section code {
  background: #f1f1f1;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
}

.youelblocks-guide-section pre {
  background: #f1f1f1;
  padding: 15px;
  border-radius: 4px;
  overflow-x: auto;
}

.youelblocks-guide-section pre code {
  background: none;
  padding: 0;
}

/* 숏코드 페이지 스타일 */
.youelblocks-shortcodes-content {
  max-width: 1000px;
}

.youelblocks-shortcodes-section {
  background: #fff;
  border: 1px solid #ccd0d4;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.youelblocks-shortcode-guide table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

.youelblocks-shortcode-guide th,
.youelblocks-shortcode-guide td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
}

.youelblocks-shortcode-guide th {
  background-color: #f2f2f2;
  font-weight: bold;
}

.youelblocks-table-shortcode {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 15px;
}

.youelblocks-table-shortcode h3 {
  margin-top: 0;
  color: #0073aa;
}

.youelblocks-table-shortcode pre {
  background: #fff;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 3px;
  overflow-x: auto;
}

/* 데이터 관리 페이지 스타일 */
.youelblocks-data-content {
  max-width: 1200px;
}

.youelblocks-data-section {
  background: #fff;
  border: 1px solid #ccd0d4;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.youelblocks-data-section ul {
  list-style: none;
  padding: 0;
}

.youelblocks-data-section li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.youelblocks-data-section li:last-child {
  border-bottom: none;
}

.youelblocks-data-section a {
  text-decoration: none;
  color: #0073aa;
}

.youelblocks-data-section a:hover {
  color: #005a87;
}

/* 매핑 관리 페이지 스타일 */
.youelblocks-mapping-container {
  max-width: 1200px;
}

.youelblocks-mapping-container .card {
  background: #fff;
  border: 1px solid #ccd0d4;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.youelblocks-mapping-container h2 {
  margin-top: 0;
  color: #23282d;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.youelblocks-mapping-container .widefat {
  margin-top: 10px;
}

.youelblocks-mapping-container .widefat th {
  font-weight: bold;
  background-color: #f2f2f2;
}

.youelblocks-mapping-container .widefat td {
  vertical-align: middle;
}

.youelblocks-mapping-container .widefat code {
  background: #f1f1f1;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}

#youelblocks-add-mapping-form {
  display: flex;
  gap: 15px;
  align-items: end;
  flex-wrap: wrap;
}

#youelblocks-add-mapping-form > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#youelblocks-add-mapping-form label {
  font-weight: bold;
  color: #23282d;
}

#youelblocks-add-mapping-form input[type="text"] {
  width: 200px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

#youelblocks-add-mapping-form input[type="text"]:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
  outline: none;
}

.youelblocks-mapping-status {
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.youelblocks-mapping-status.normal {
  background: #d4edda;
  color: #155724;
}

.youelblocks-mapping-status.error {
  background: #f8d7da;
  color: #721c24;
}

.youelblocks-mapping-status.warning {
  background: #fff3cd;
  color: #856404;
}

/* 테이블 스타일 */
.widefat {
  margin-top: 10px;
}

.widefat th {
  font-weight: bold;
  background-color: #f2f2f2;
}

.widefat td {
  vertical-align: middle;
}

/* 데이터 관리 작업 버튼 스타일 */
.youelblocks-action-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.youelblocks-action-buttons .button {
  margin: 0;
  font-size: 12px;
  padding: 4px 8px;
  line-height: 1.2;
}

.youelblocks-action-buttons .button-link-delete {
  color: #a00;
  border-color: #a00;
}

.youelblocks-action-buttons .button-link-delete:hover {
  color: #dc3232;
  border-color: #dc3232;
  background: #dc3232;
  color: white;
}

/* 수정 모달 스타일 */
#edit-modal {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#edit-modal > div {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#edit-modal h2 {
  margin-top: 0;
  color: #23282d;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

#edit-modal label {
  color: #23282d;
  font-weight: 600;
}

#edit-modal input[type="text"] {
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 8px;
  font-size: 14px;
  line-height: 1.4;
}

#edit-modal input[type="text"]:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
  outline: none;
}

#edit-modal .button {
  margin-left: 10px;
}

#edit-modal .button-primary {
  background: #0073aa;
  border-color: #0073aa;
  color: white;
}

#edit-modal .button-primary:hover {
  background: #005a87;
  border-color: #005a87;
}

.widefat code {
  background: #f1f1f1;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
}

/* 알림 스타일 */
.notice {
  margin: 15px 0;
  padding: 10px 15px;
  border-left: 4px solid #0073aa;
  background: #f7f7f7;
}

.notice-info {
  border-left-color: #0073aa;
}

.notice-warning {
  border-left-color: #ffb900;
}

.notice-error {
  border-left-color: #dc3232;
}

/* 테이블 구조 정보 스타일 */
.youelblocks-table-structure-info {
  background: #fff;
  border: 1px solid #ccd0d4;
  border-radius: 4px;
  padding: 20px;
  margin-top: 15px;
}

.youelblocks-table-structure-info h3 {
  color: #0073aa;
  margin-top: 0;
  border-bottom: 2px solid #0073aa;
  padding-bottom: 10px;
}

.youelblocks-table-structure-info h4 {
  color: #23282d;
  margin-top: 25px;
  margin-bottom: 15px;
}

.youelblocks-table-structure-info .description {
  background: #f7f7f7;
  padding: 10px 15px;
  border-left: 4px solid #0073aa;
  margin: 15px 0;
  font-style: italic;
}

.youelblocks-table-structure-info table {
  margin-bottom: 20px;
}

.youelblocks-table-structure-info th {
  background-color: #f2f2f2;
  font-weight: bold;
  width: 150px;
}

.youelblocks-table-structure-info code {
  background: #f1f1f1;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  color: #d63638;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .youelblocks-quick-links {
    flex-direction: column;
  }

  .youelblocks-quick-links .button {
    text-align: center;
  }

  .youelblocks-shortcode-guide table {
    font-size: 12px;
  }

  .youelblocks-shortcode-guide th,
  .youelblocks-shortcode-guide td {
    padding: 5px;
  }

  .youelblocks-table-structure-info {
    padding: 15px;
  }

  .youelblocks-table-structure-info h3 {
    font-size: 18px;
  }
}

/* 모달 스타일 */
.youelblocks-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.youelblocks-modal-content {
  background: #fff;
  border-radius: 8px;
  max-width: 700px;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  position: relative;
  display: flex;
  flex-direction: column;
}

.youelblocks-modal-header {
  background-color: #f1f1f1;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.youelblocks-modal-header h3 {
  margin: 0;
  color: #23282d;
}

.youelblocks-modal-close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.youelblocks-modal-close:hover,
.youelblocks-modal-close:focus {
  color: #000;
}

.youelblocks-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 70vh;
}

/* 추가 관리자 스타일 개선 */
.youelblocks-table-actions {
  display: flex;
  gap: 10px;
  margin: 15px 0;
  flex-wrap: wrap;
}

.youelblocks-table-actions .button {
  margin: 0;
}

.youelblocks-table-actions .button-primary {
  background: #0073aa;
  border-color: #0073aa;
}

.youelblocks-table-actions .button-primary:hover {
  background: #005a87;
  border-color: #005a87;
}

.youelblocks-table-actions .button-secondary {
  background: #f7f7f7;
  border-color: #ccc;
  color: #555;
}

.youelblocks-table-actions .button-secondary:hover {
  background: #eee;
  border-color: #999;
}

.youelblocks-table-actions .button-link-delete {
  color: #a00;
  border-color: #a00;
}

.youelblocks-table-actions .button-link-delete:hover {
  color: #dc3232;
  border-color: #dc3232;
}

/* 테이블 상태 표시 */
.youelblocks-table-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.youelblocks-table-status.active {
  background: #d4edda;
  color: #155724;
}

.youelblocks-table-status.inactive {
  background: #f8d7da;
  color: #721c24;
}

.youelblocks-table-status.warning {
  background: #fff3cd;
  color: #856404;
}

/* 데이터 테이블 개선 */
.youelblocks-data-table {
  margin-top: 20px;
}

.youelblocks-data-table .widefat {
  border-collapse: collapse;
  width: 100%;
}

.youelblocks-data-table .widefat th {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  padding: 12px 8px;
  font-weight: 600;
  color: #495057;
}

.youelblocks-data-table .widefat td {
  border: 1px solid #dee2e6;
  padding: 12px 8px;
  vertical-align: top;
}

.youelblocks-data-table .widefat tr:nth-child(even) {
  background: #f8f9fa;
}

.youelblocks-data-table .widefat tr:hover {
  background: #e9ecef;
}

/* 검색 및 필터 */
.youelblocks-search-filter {
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.youelblocks-search-filter input[type="text"] {
  width: 300px;
  max-width: 100%;
  margin-right: 10px;
}

.youelblocks-search-filter .button {
  margin: 0 5px 0 0;
}

/* 페이지네이션 */
.youelblocks-pagination {
  margin: 20px 0;
  text-align: center;
}

.youelblocks-pagination .page-numbers {
  display: inline-block;
  padding: 8px 12px;
  margin: 0 2px;
  border: 1px solid #ddd;
  text-decoration: none;
  color: #0073aa;
  border-radius: 3px;
}

.youelblocks-pagination .page-numbers.current {
  background: #0073aa;
  color: white;
  border-color: #0073aa;
}

.youelblocks-pagination .page-numbers:hover {
  background: #f0f0f0;
}

/* 로딩 상태 */
.youelblocks-loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.youelblocks-loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #0073aa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 10px;
}

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

/* 반응형 개선 */
@media (max-width: 768px) {
  .youelblocks-table-actions {
    flex-direction: column;
    gap: 8px;
  }

  .youelblocks-table-actions .button {
    width: 100%;
    text-align: center;
  }

  .youelblocks-search-filter input[type="text"] {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
  }

  .youelblocks-data-table {
    overflow-x: auto;
  }

  .youelblocks-data-table .widefat {
    min-width: 600px;
  }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
  .youelblocks-loading::after {
    animation: none;
  }
}

/* 고대비 모드 */
@media (prefers-contrast: high) {
  .youelblocks-table-status.active {
    background: #000;
    color: #fff;
  }

  .youelblocks-table-status.inactive {
    background: #fff;
    color: #000;
    border: 1px solid #000;
  }

  .youelblocks-data-table .widefat th {
    background: #000;
    color: #fff;
  }

  .youelblocks-data-table .widefat td {
    border: 1px solid #000;
  }
}
