/**
 * Word.Chat Admin Styles
 * Aligned with Word.Chat Visual Style Guide
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Admin Container */
.wordchat-admin-wrap {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  max-width: 1200px;
  margin: 0;
}

.wordchat-admin-wrap h1 {
  font-size: 32px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
  line-height: 1.3;
}

.wordchat-admin-wrap > p {
  font-size: 16px;
  color: #374151;
  line-height: 1.6;
  margin-bottom: 32px;
}

/* Cards */
.wordchat-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: box-shadow 200ms ease;
}

.wordchat-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.wordchat-card h2 {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 16px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid #E5E7EB;
}

/* Form Table */
.wordchat-admin-wrap .form-table {
  background: transparent;
}

.wordchat-admin-wrap .form-table th {
  font-weight: 600;
  color: #374151;
  font-size: 14px;
  padding: 12px 0;
}

.wordchat-admin-wrap .form-table td {
  padding: 12px 0;
}

.wordchat-admin-wrap .form-table input[type="text"].regular-text {
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 15px;
  color: #111827;
  background: #F9FAFB;
  font-family: 'Inter', monospace;
  letter-spacing: 0.5px;
}

/* Buttons */
.wordchat-admin-wrap .button-primary {
  background: #1A73E8 !important;
  border-color: #1A73E8 !important;
  color: white !important;
  font-weight: 600;
  padding: 10px 20px !important;
  height: auto !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  box-shadow: none !important;
  text-shadow: none !important;
  transition: background 200ms ease, transform 150ms ease !important;
}

.wordchat-admin-wrap .button-primary:hover,
.wordchat-admin-wrap .button-primary:focus {
  background: #1557B0 !important;
  border-color: #1557B0 !important;
  transform: translateY(-1px);
}

.wordchat-admin-wrap .button-primary:active {
  transform: translateY(0);
}

.wordchat-admin-wrap .button-secondary {
  background: white !important;
  border: 1px solid #E5E7EB !important;
  color: #374151 !important;
  font-weight: 600;
  padding: 10px 20px !important;
  height: auto !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  box-shadow: none !important;
  transition: all 200ms ease !important;
}

.wordchat-admin-wrap .button-secondary:hover {
  background: #F9FAFB !important;
  border-color: #1A73E8 !important;
  color: #1A73E8 !important;
}

/* Sync Table */
.wordchat-admin-wrap .widefat {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: none;
}

.wordchat-admin-wrap .widefat thead th {
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
  color: #374151;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 16px;
}

.wordchat-admin-wrap .widefat tbody tr {
  background: white;
  transition: background 150ms ease;
}

.wordchat-admin-wrap .widefat tbody tr:hover {
  background: #F9FAFB;
}

.wordchat-admin-wrap .widefat td {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
  color: #111827;
  font-size: 14px;
}

.wordchat-admin-wrap .widefat tbody tr:last-child td {
  border-bottom: none;
}

/* Checkboxes */
.wordchat-admin-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border: 2px solid #D1D5DB;
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  position: relative;
  background: white;
  transition: all 200ms ease;
}

.wordchat-admin-wrap input[type="checkbox"]:hover {
  border-color: #1A73E8;
}

.wordchat-admin-wrap input[type="checkbox"]:checked {
  background: #1A73E8;
  border-color: #1A73E8;
}

.wordchat-admin-wrap input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Status Indicators */
.wordchat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.wordchat-status.synced {
  background: #D1FAE5;
  color: #065F46;
}

.wordchat-status.not-synced {
  background: #F3F4F6;
  color: #6B7280;
}

.wordchat-status.needs-resync {
  background: #FEF3C7;
  color: #92400E;
}

.wordchat-status.error {
  background: #FEE2E2;
  color: #991B1B;
}

/* Plan Badge */
.wordchat-plan-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}

.wordchat-plan-badge.free {
  background: #F3F4F6;
  color: #6B7280;
}

.wordchat-plan-badge.pro {
  background: #DBEAFE;
  color: #1E40AF;
}

/* Notices */
.wordchat-admin-wrap .notice {
  border-left-width: 4px;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.wordchat-admin-wrap .notice-success {
  background: #D1FAE5;
  border-left-color: #34A853;
  color: #065F46;
}

.wordchat-admin-wrap .notice-error {
  background: #FEE2E2;
  border-left-color: #EF4444;
  color: #991B1B;
}

.wordchat-admin-wrap .notice-warning {
  background: #FEF3C7;
  border-left-color: #F59E0B;
  color: #92400E;
}

.wordchat-admin-wrap .notice p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

/* Divider */
.wordchat-admin-wrap hr {
  border: none;
  border-top: 1px solid #E5E7EB;
  margin: 32px 0;
}

/* Helper Text */
.wordchat-helper-text {
  font-size: 14px;
  color: #6B7280;
  margin-top: 8px;
  line-height: 1.5;
}

/* Loading State */
.wordchat-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6B7280;
  font-size: 14px;
}

.wordchat-spinner-admin {
  width: 16px;
  height: 16px;
  border: 2px solid #E5E7EB;
  border-top-color: #1A73E8;
  border-radius: 50%;
  animation: wordchat-spin-admin 0.8s linear infinite;
}

@keyframes wordchat-spin-admin {
  to { transform: rotate(360deg); }
}

/* Refresh button spin animation */
@keyframes wordchat-spin-refresh {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 782px) {
  .wordchat-admin-wrap {
    margin: 16px 0;
  }

  .wordchat-card {
    padding: 16px;
  }

  .wordchat-admin-wrap h1 {
    font-size: 24px;
  }

  .wordchat-admin-wrap .widefat {
    font-size: 13px;
  }

  .wordchat-admin-wrap .widefat th,
  .wordchat-admin-wrap .widefat td {
    padding: 8px 12px;
  }
}

/* WordPress Admin Integration */
.wrap.wordchat-admin-wrap {
  background: #F3F4F6;
  margin-left: -20px;
  margin-right: -20px;
  padding: 32px 32px 64px 32px;
  min-height: calc(100vh - 32px);
}

.wrap.wordchat-admin-wrap > * {
  background: transparent;
}

/* Credentials Display */
.wordchat-credential-field {
  position: relative;
}

.wordchat-credential-field input[readonly] {
  padding-right: 100px;
}

.wordchat-copy-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  font-size: 12px;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  color: #374151;
  cursor: pointer;
  transition: all 150ms ease;
}

.wordchat-copy-button:hover {
  background: #E5E7EB;
  color: #111827;
}

.wordchat-copy-button.copied {
  background: #D1FAE5;
  color: #065F46;
  border-color: #34A853;
}

/* Tab Navigation - WordPress Style */
.wordchat-tabs {
  display: flex;
  gap: 0;
  margin: 24px 0 0 0;
  border-bottom: 1px solid #c3c4c7;
  padding: 0;
  background: transparent;
}

.wordchat-tab {
  background: #f0f0f1;
  border: 1px solid #c3c4c7;
  border-bottom: none;
  color: #2271b1;
  padding: 14px 14px;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  margin: 0 4px -1px 0;
  border-radius: 4px 4px 0 0;
  transition: all 200ms ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  text-decoration: none;
  outline: none;
  box-shadow: none;
}

.wordchat-tab:hover {
  background: #fff;
  color: #2271b1;
}

.wordchat-tab.active {
  background: #fff;
  color: #000;
  border-bottom: 1px solid #fff;
  margin-bottom: -1px;
  font-weight: 600;
}

.wordchat-tab-content {
  display: none;
}

.wordchat-tab-content.active {
  display: block;
  animation: wordchat-tab-fadein 200ms ease;
}

@keyframes wordchat-tab-fadein {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
