/* Claude Code Companion Web Admin - Shared Styles */

/* Common log-related styles */
.log-body {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.log-body:hover {
  white-space: normal;
  word-break: break-all;
}

/* Button and form styles */
.save-file-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  margin-top: 0.25rem;
}

/* Content section styles */
.content-section {
  position: relative;
}
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* JSON display styles */
.json-pretty {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.5rem;
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
}

/* Content box with floating action overlay */
.json-pretty-container {
  position: relative;
  display: block;
}

.floating-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 10;
}

.json-pretty-container:hover .floating-actions {
  opacity: 1;
  visibility: visible;
}

.floating-action-btn {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: #495057;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.floating-action-btn:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #0d6efd;
  transform: translateY(-1px);
}

.floating-action-btn:active {
  transform: translateY(0);
}

.floating-action-btn i {
  font-size: 0.7rem;
}

/* Model rewrite related styles */
.model-rewritten {
  position: relative;
  display: inline-block;
}
.model-rewritten::after {
  content: "🔄";
  font-size: 0.7em;
  color: #28a745;
  margin-left: 3px;
}
.model-original {
  color: #6c757d;
}

/* Tab styles */
.before-after-tabs {
  margin-bottom: 1rem;
}
.before-after-tabs .nav-item {
  flex: 1;
}
.before-after-tabs .nav-link {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  text-align: center;
  width: 100%;
}
.comparison-badge {
  font-size: 0.7em;
  vertical-align: super;
  margin-left: 0.25rem;
}

/* Endpoints page specific styles */
.sortable-ghost {
  opacity: 0.4;
  background-color: #e3f2fd !important;
}
.sortable-drag {
  opacity: 0.8;
  background-color: #f5f5f5 !important;
}
.drag-handle {
  cursor: grab;
  user-select: none;
}
.drag-handle:active {
  cursor: grabbing;
}
.endpoint-row {
  transition: background-color 0.2s ease;
  cursor: move;
  user-select: none;
}
.endpoint-row:hover {
  background-color: #f8f9fa;
}
.endpoint-row.sortable-chosen {
  background-color: #e3f2fd;
}
.auth-value {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.priority-badge {
  width: 30px;
  text-align: center;
}
.endpoint-row * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
input,
textarea,
select {
  user-select: auto !important;
  -webkit-user-select: auto !important;
  -moz-user-select: auto !important;
  -ms-user-select: auto !important;
}
.action-buttons {
  cursor: default;
}
.action-buttons button {
  cursor: pointer;
}
.btn-group .btn:not(:last-child) {
  margin-right: 4px;
}
.url-display,
.path-display {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.path-display {
  max-width: 150px;
}
.url-display:hover,
.path-display:hover {
  overflow: visible;
  white-space: normal;
  background-color: #f8f9fa;
  border-radius: 3px;
  padding: 2px 4px;
  position: relative;
  z-index: 10;
}

/* Alert positioning */
.alert-positioned {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 300px;
}

/* Collapsible section styles */
.collapsible-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 0.5rem;
  user-select: none;
  background-color: #f8f9fa;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease;
}

.collapsible-header:hover {
  background-color: #e9ecef;
}

.collapsible-toggle {
  transition: transform 0.2s ease;
  margin-right: 0.5rem;
  color: #6c757d;
  font-size: 0.8rem;
}

.collapsible-toggle.collapsed {
  transform: rotate(-90deg);
}

.collapsible-content {
  transition: all 0.3s ease;
  overflow: hidden;
  padding: 0.5rem 0;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Expanded state styles */
.collapsible-content:not(.collapsed) {
  max-height: none;
  opacity: 1;
  padding: 0.5rem 0;
}

/* Log details modal improvements */
.modal-body .card {
  margin-bottom: 1rem;
}

.modal-body .card:last-child {
  margin-bottom: 0;
}

.content-section {
  margin-bottom: 0.75rem;
}

.content-section:last-child {
  margin-bottom: 0;
}

/* Additional modal spacing controls */
.modal-body {
  padding: 1rem;
}

.modal-body > div:last-child {
  margin-bottom: 0 !important;
}

/* Tab content spacing */
.tab-content {
  margin-top: 0.75rem !important;
}

/* Remove extra spacing from Bootstrap row/col when not needed */
.modal-body .row {
  margin-left: 0;
  margin-right: 0;
}

.modal-body .row > [class*="col-"] {
  padding-left: 0;
  padding-right: 0;
}

/* Language dropdown styles */
.flag-text,
#currentLanguageFlag {
  display: inline-block;
  width: 24px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  color: white;
  font-size: 0.7em;
  font-weight: bold;
  border-radius: 2px;
  margin-right: 0.5rem;
  letter-spacing: -0.5px;
}

.flag-text {
  margin-right: 0.5rem;
}

#languageDropdown {
  white-space: nowrap;
}

#currentLanguageText {
  margin-left: 0.25rem;
}

/* Different colors for different countries */
.dropdown-item .flag-text:first-child {
  background-color: #dc3545; /* Red for CN */
}

.dropdown-item[onclick*="'en'"] .flag-text {
  background-color: #007bff; /* Blue for US */
}

.dropdown-item[onclick*="'ja'"] .flag-text {
  background-color: #28a745; /* Green for JP */
}

/* Thinking badge styles */
.thinking-badge {
  font-weight: bold;
  font-size: 0.8rem;
  min-width: 20px;
  text-align: center;
  cursor: help;
  transition: all 0.2s ease;
}

.thinking-badge:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Specific thinking level colors */
.thinking-badge.bg-success {
  background-color: #28a745 !important; /* Low thinking - Green */
}

.thinking-badge.bg-warning {
  background-color: #ffc107 !important; /* Medium thinking - Yellow */
}

.thinking-badge.bg-warning.text-dark {
  background-color: #fd7e14 !important; /* High thinking - Orange */
}

.thinking-badge.bg-danger {
  background-color: #dc3545 !important; /* Ultra thinking - Red */
}

/* Request ID cell with hover copy button */
.request-id-cell {
  position: relative;
}

.request-id-cell small {
  position: relative;
  display: inline-block;
}

.copy-request-id-btn {
  position: absolute;
  right: 0;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 1px 3px;
  font-size: 0.7rem;
  color: #6c757d;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 10;
  width: 16px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.request-id-cell:hover .copy-request-id-btn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.copy-request-id-btn:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #0d6efd;
  transform: scale(1.1);
}

.copy-request-id-btn:active {
  transform: scale(1);
}

/* Version update badge styles */
.update-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: #ffeb3b; /* Bright yellow background */
  color: #212529; /* Dark text for contrast */
  border-radius: 50%;
  width: 9px;
  height: 9px;
  font-size: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  z-index: 100;
  animation: updatePulse 2s infinite;
}

.update-badge i {
  font-size: 0.35rem;
  margin: 0;
  padding: 0;
}

/* Pulsing animation for update badge */
@keyframes updatePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.7);
  }
  70% {
    box-shadow: 0 0 0 4px rgba(255, 235, 59, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 235, 59, 0);
  }
}

/* Session ID badge styles */
.session-id-badge {
  display: inline-block;
  padding: 3px 7px;
  font-size: 0.75rem;
  font-weight: bold;
  text-align: center;
  border-radius: 4px;
  color: #ffffff;
  background-color: transparent;
  min-width: 26px;
  font-family: monospace;
  /* 优化文字对比度：深色背景用白色文字 + 黑色边框阴影 */
  text-shadow: -0.5px -0.5px 0 rgba(0, 0, 0, 0.5),
    0.5px -0.5px 0 rgba(0, 0, 0, 0.5), -0.5px 0.5px 0 rgba(0, 0, 0, 0.5),
    0.5px 0.5px 0 rgba(0, 0, 0, 0.5);
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.session-id-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.session-id-cell {
  text-align: center;
  vertical-align: middle;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

/* Rewritten session badge styles，保持与原 badge 完全一致 */
.rewritten-session-id-badge {
  display: inline-block;
  padding: 3px 7px;
  font-size: 0.75rem;
  font-weight: bold;
  text-align: center;
  border-radius: 4px;
  color: #ffffff;
  background-color: transparent;
  min-width: 26px;
  font-family: monospace;
  /* 与原 badge 完全相同的文字对比度处理 */
  text-shadow: -0.5px -0.5px 0 rgba(0, 0, 0, 0.5),
    0.5px -0.5px 0 rgba(0, 0, 0, 0.5), -0.5px 0.5px 0 rgba(0, 0, 0, 0.5),
    0.5px 0.5px 0 rgba(0, 0, 0, 0.5);
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rewritten-session-id-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.rewritten-session {
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  color: #6c757d;
  font-size: 0.8rem;
}
