/* ============================================
   C2PA Tools - Tool Page Styles
   工具页专用样式
   ============================================ */

/* ============================================
   Tool Page Layout
   ============================================ */

.tool-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tool-main {
  flex: 1;
  padding: var(--space-8) 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: start;
}

/* ============================================
   Panel Styles
   ============================================ */

.panel {
  background-color: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  min-height: 600px;
}

.panel-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--gray-200);
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.panel-description {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-top: var(--space-2);
}

/* ============================================
   Left Panel - Upload & Info
   ============================================ */

.left-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Upload Section */
.upload-section {
  flex-shrink: 0;
}

/* File Preview (shown after upload) */
.file-preview-section {
  display: none;
}

.file-preview-section.active {
  display: block;
}

/* C2PA Info Section */
.c2pa-info-section {
  display: none;
}

.c2pa-info-section.active {
  display: block;
}

.c2pa-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background-color: var(--gray-50);
  border-radius: var(--radius-default);
  margin-bottom: var(--space-4);
}

.c2pa-status-icon {
  width: 24px;
  height: 24px;
}

.c2pa-status.has-c2pa {
  background-color: var(--success-50);
  border: 1px solid var(--success-200);
}

.c2pa-status.no-c2pa {
  background-color: var(--gray-50);
  border: 1px solid var(--gray-200);
}

.c2pa-details {
  margin-top: var(--space-4);
}

.c2pa-detail-group {
  margin-bottom: var(--space-4);
}

.c2pa-detail-group:last-child {
  margin-bottom: 0;
}

.c2pa-detail-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.c2pa-detail-list {
  list-style: none;
  padding-left: var(--space-6);
}

.c2pa-detail-item {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: var(--space-1);
  position: relative;
}

.c2pa-detail-item::before {
  content: "├─";
  position: absolute;
  left: calc(var(--space-6) * -1);
  color: var(--gray-400);
}

.c2pa-detail-item:last-child::before {
  content: "└─";
}

/* JSON Viewer */
.json-viewer {
  margin-top: var(--space-4);
}

.json-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  padding: var(--space-2);
  border-radius: var(--radius-default);
  transition: background-color var(--transition-fast);
}

.json-toggle:hover {
  background-color: var(--gray-50);
}

.json-toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.json-toggle.expanded .json-toggle-icon {
  transform: rotate(90deg);
}

.json-content {
  display: none;
  margin-top: var(--space-3);
}

.json-content.expanded {
  display: block;
}

/* Action Button */
.action-section {
  margin-top: var(--space-6);
}

/* ============================================
   Right Panel - Results
   ============================================ */

.right-panel {
  position: sticky;
  top: calc(64px + var(--space-8));
}

/* Empty State */
.result-empty {
  display: flex;
}

.result-empty.hidden {
  display: none;
}

/* Result Content */
.result-content {
  display: none;
}

.result-content.active {
  display: block;
}

.result-success-banner {
  background-color: var(--success-50);
  border: 1px solid var(--success-200);
  border-radius: var(--radius-default);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.result-success-icon {
  width: 24px;
  height: 24px;
  color: var(--success-600);
  flex-shrink: 0;
}

.result-success-text {
  font-size: 0.875rem;
  color: var(--success-600);
  font-weight: 500;
}

/* Result Preview */
.result-preview {
  margin-bottom: var(--space-6);
}

.result-image {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius-default);
  border: 1px solid var(--gray-200);
}

/* Comparison Table */
.result-comparison {
  margin-bottom: var(--space-6);
}

.result-comparison-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-4);
}

/* Result Actions */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ============================================
   Loading States
   ============================================ */

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  border-radius: var(--radius-lg);
  z-index: var(--z-dropdown);
}

.loading-overlay.hidden {
  display: none;
}

.loading-text {
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .tool-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .right-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  .tool-main {
    padding: var(--space-4) 0;
  }

  .panel {
    padding: var(--space-4);
    min-height: auto;
  }

  .tool-grid {
    gap: var(--space-4);
  }

  .panel-header {
    margin-bottom: var(--space-4);
  }
}

/* ============================================
   C2PA Timeline Styles
   ============================================ */

.c2pa-timeline {
  position: relative;
  padding-left: var(--space-6);
  margin-top: var(--space-4);
}

.c2pa-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--gray-200);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-5);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--primary-500);
  z-index: 1;
}

.timeline-item.timeline-item-first::before {
  background: var(--primary-500);
}

.timeline-content {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-default);
  padding: var(--space-3);
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 500;
}

.timeline-actor {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-1);
}

.timeline-action {
  font-size: 0.8125rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.timeline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
}

.timeline-details {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--gray-200);
  font-size: 0.75rem;
  color: var(--gray-600);
}

.timeline-details-item {
  display: flex;
  gap: var(--space-2);
  margin-bottom: 4px;
}

.timeline-details-label {
  font-weight: 500;
  min-width: 60px;
}

/* ============================================
   Helper Classes
   ============================================ */

.hidden {
  display: none !important;
}

.disabled {
  opacity: 0.6;
  pointer-events: none;
}
