/**
 * TranslateSense - Unified Common Modal Design System
 * File: assets/css/common.css
 *
 * Professional, modern UI design tokens and shared modal components
 * with crisp, classic minimal border-radius for an enterprise-grade aesthetic.
 */

:root {
  --ts-primary: #2563eb;
  --ts-primary-hover: #1d4ed8;
  --ts-primary-active: #1e40af;
  --ts-surface: #ffffff;
  --ts-bg-subtle: #f8fafc;
  --ts-border: #e2e8f0;
  --ts-border-dark: #cbd5e1;
  --ts-text-main: #0f172a;
  --ts-text-muted: #64748b;
  --ts-radius-xs: 2px;
  --ts-radius-sm: 3px;
  --ts-radius-md: 4px;
  --ts-radius-lg: 4px;
  --ts-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --ts-shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.08);
  --ts-shadow-modal:
    0 20px 50px -10px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(226, 232, 240, 0.85);
}

.ts-footer-string-counter,
.ts-footer-info {
  font-size: 13px;
  color: var(--ts-text-muted, #64748b);
  font-weight: 500;
}

/* ==========================================================================
   Common Modal Action Buttons (Minimal Border Radius 3px)
   ========================================================================== */
.ts-btn {
  padding: 8px 18px!important;
  border-radius: 3px!important;
  font-size: 13px!important;
  font-weight: 600;
  cursor: pointer;
  gap: 6px;
  transition: all .15s ease;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  line-height: 1.4 !important;
  text-decoration: none;
  box-sizing: border-box;
  min-height: 30px !important;
  display: inline-flex !important;
}

.ts-btn .dashicons{
  line-height: 1 !important;
  margin-right: 4px;
}

/* Primary Button (Solid Vivid Blue with Minimal 3px Radius) */
.ts-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px) !important;
}

.ts-btn-primary:active:not(:disabled) {
  transform: translateY(0) !important;
}

/* Secondary Button (Clean White with Border and Minimal 3px Radius) */
.ts-btn-secondary {
  background: #ffffff !important;
  border: 1px solid var(--ts-border-dark, #cbd5e1) !important;
  color: #334155 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03) !important;
}

.ts-btn-secondary:hover:not(:disabled) {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  transform: translateY(-1px) !important;
}

/* Disabled Button */
.ts-btn-disabled,
:disabled {
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 0.7 !important;
}

/* ==========================================================================
   Common Provider Selection Cards (4px Radius)
   ========================================================================== */
.ts-provider-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
  margin-top: 4px;
  max-height: 380px;
  overflow-y: auto;
  padding: 2px;
}

@media (max-width: 560px) {
  .ts-provider-list {
    grid-template-columns: 1fr;
  }
}

.ts-provider-row {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--ts-border, #e2e8f0);
  border-radius: 4px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  position: relative;
  user-select: none;
  min-height: 98px;
  box-sizing: border-box;
}

.ts-provider-row:hover:not(.disabled):not(.selected) {
  border-color: var(--ts-border-dark, #cbd5e1);
  background: #ffffff;
}

.ts-provider-row.selected {
  border: 1.5px solid #2563eb !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.ts-provider-row.disabled {
  background: #ffffff;
  border: 1px solid var(--ts-border, #e2e8f0);
  cursor: not-allowed;
}

.ts-provider-row.disabled:hover:not(.ts-provider-error-btn) {
  border-color: #cbd5e1;
  background: #ffffff;
}

.ts-provider-row.disabled.ts-provider-error-btn {
  cursor: pointer;
}

.ts-provider-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.ts-provider-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid var(--ts-border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 4px;
}

.ts-provider-logo-img {
  width: 36px;
  object-fit: contain;
  display: block;
}

.ts-provider-header-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ts-provider-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-provider-badge-wrap {
  display: flex;
  align-items: center;
}

.ts-provider-badge {
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.3;
  text-decoration: none !important;
  box-sizing: border-box;
}

.ts-provider-badge:focus{
  box-shadow: unset;
  outline: unset;
}

.ts-provider-badge.on-device {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.ts-provider-badge.api-required {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.ts-provider-badge.api-required:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.ts-provider-badge.core-connector {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
}

.ts-provider-badge.ready {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #d1fae5;
}

.ts-provider-badge.error-badge,
.ts-add-api-key-btn.ts-provider-error-btn {
  background: #fef2f2;
  color: #b91c1c !important;
  border: 1px solid #fecaca;
  cursor: pointer;
}

.ts-provider-badge.error-badge:hover,
.ts-add-api-key-btn.ts-provider-error-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.ts-add-api-key-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #475569 !important;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  text-decoration: none !important;
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}

.ts-add-api-key-btn:hover {
  background: #e2e8f0;
  color: #0f172a !important;
  border-color: #cbd5e1;
}

/* Custom Radio Circle */
.ts-provider-radio-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.ts-provider-radio-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  margin: 0 !important;
}

.ts-provider-custom-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  background: #ffffff;
  box-sizing: border-box;
}

.ts-provider-row.selected .ts-provider-custom-radio {
  border-color: #2563eb;
  background: #ffffff;
}

.ts-provider-row.selected .ts-provider-custom-radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
  display: block;
}

.ts-provider-caption {
  font-size: 12px;
  color: var(--ts-text-muted, #64748b);
  margin: 10px 0 0 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Common Provider Error Modals & Guidance UI
   ========================================================================== */
.ts-error-container {
  display: flex;
  flex-direction: column;
}

.ts-error-message {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: #1e293b;
}

.ts-error-container *{
  margin: 0;
  line-height: 1;
  font-size: 16px;
}

.ts-guidance-container {
  font-size: 13.5px;
  line-height: 1.6;
  color: #1e293b;
}

.ts-guidance-list {
  list-style: disc !important;
  margin: 8px 0 0 0 !important;
  padding-left: 20px !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ts-guidance-step {
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
}

.ts-guidance-step strong {
  color: #0f172a;
}

.ts-code-pill {
  display: inline-block;
  padding: 2px 7px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  word-break: break-all;
  user-select: all;
  cursor: pointer;
  transition: all 0.15s ease;
  margin: 1px 2px;
}

.ts-code-pill:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.ts-doc-link {
  color: #2563eb !important;
  font-weight: 600;
  text-decoration: underline !important;
  text-underline-offset: 2.5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s ease;
}

.ts-doc-link:hover {
  color: #1d4ed8 !important;
}

/* ==========================================================================
   Common Callout & Notice Banners (Minimal 4px Radius)
   ========================================================================== */
.ts-modal-notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 15px;
  border-radius: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.ts-modal-notice-banner.warning {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 4px solid #f59e0b;
  color: #92400e;
}

.ts-modal-notice-banner.info {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-left: 4px solid #3b82f6;
  color: #1e40af;
}

.ts-modal-notice-banner.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #10b981;
  color: #166534;
}

.ts-modal-notice-banner .ts-notice-icon {
  font-size: 17px;
  flex-shrink: 0;
  line-height: 1.2;
}

.ts-modal-notice-banner .ts-notice-text {
  flex: 1;
}

.ts-modal-notice-banner .ts-notice-title {
  font-weight: 700;
  margin-bottom: 2px;
  font-size: 13px;
}

/* ==========================================================================
   Common Slim Custom Scrollbars
   ========================================================================== */
.ts-bulk-body::-webkit-scrollbar,
.ts-review-body::-webkit-scrollbar,
.ts-provider-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.ts-bulk-body::-webkit-scrollbar-track,
.ts-review-body::-webkit-scrollbar-track,
.ts-provider-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.ts-bulk-body::-webkit-scrollbar-thumb,
.ts-review-body::-webkit-scrollbar-thumb,
.ts-provider-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.ts-bulk-body::-webkit-scrollbar-thumb:hover,
.ts-review-body::-webkit-scrollbar-thumb:hover,
.ts-provider-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}


/* ==========================================================================
   Copy to Clipboard Tooltip & Smooth Translation Effect
   ========================================================================== */
.ts-copy-clipboard {
  position: relative !important;
  cursor: pointer;
  user-select: none;
}

.ts-copy-tooltip {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translate(-50%, -6px);
  opacity: 0;
  visibility: hidden;
  background: #0f172a;
  color: #ffffff;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  z-index: 999999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}

.ts-copy-tooltip.ts-tooltip-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.ts-copy-tooltip.ts-tooltip-hiding {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -6px);
  transition: opacity 0.18s cubic-bezier(0.4, 0, 1, 1), transform 0.18s cubic-bezier(0.4, 0, 1, 1), visibility 0.18s;
}

.ts-tooltip-arrow {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid #0f172a;
  pointer-events: none;
}

.ts-copy-spinner {
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  animation: tsCopySpin 0.65s linear infinite;
}

@keyframes tsCopySpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ts-copy-text {
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}


/* Source Prompt & Editor Guidance Modal Styles */
.ts-prompt-intro-text {
  font-size: 15px;
  line-height: 1.5;
  color: #334155;
  text-align: center;
  margin: 0 0 22px 0;
}

.ts-prompt-languages-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 24px 0;
  flex-wrap: wrap;
}

.ts-prompt-lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  box-sizing: border-box;
}

.ts-prompt-lang-pill.source {
  background-color: #fef2f2;
  border: 1.5px solid #fecaca;
}

.ts-prompt-lang-pill.target {
  background-color: #f0fdf4;
  border: 1.5px solid #bbf7d0;
}

.ts-prompt-lang-pill .ts-lang-flag-img {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.ts-prompt-arrow-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.ts-prompt-arrow-wrap svg {
    fill: currentColor;
    width: 16px;
}

.ts-prompt-steps-banner {
  background-color: #f0f7ff;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
}

.ts-prompt-steps-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #334155;
  line-height: 1.4;
}

.ts-prompt-badge-auto-translate {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  display: inline-block;
  white-space: nowrap;
}

.ts-prompt-step-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
}

.ts-prompt-step-num {
  background-color: #0284c7;
  color: #ffffff;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  font-family: Arial, Helvetica, sans-serif;
}

.ts-prompt-step-separator {
  color: #94a3b8;
  margin: 0 4px;
  font-size: 12px;
  font-weight: 400;
}
