/* Trust Badge System - Visual integrity indicators for HTML-SQLite files */

/* Trust Badge Base Styles */
.trust-badge {
  position: fixed;
  z-index: 9999;
  max-width: 340px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  font-size: 14px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

/* Position variants */
.trust-badge[data-position="top-right"] {
  top: 20px;
  right: 20px;
}

.trust-badge[data-position="top-left"] {
  top: 20px;
  left: 20px;
}

.trust-badge[data-position="bottom-right"] {
  bottom: 20px;
  right: 20px;
}

.trust-badge[data-position="bottom-left"] {
  bottom: 20px;
  left: 20px;
}

/* Status-specific colors with gradients */
.trust-verified {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.trust-signed {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.trust-timestamped {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.trust-unverified {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.trust-tampered {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  animation: pulse 2s ease-in-out infinite;
}

/* Badge Header */
.trust-badge-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.trust-icon {
  font-size: 22px;
  font-weight: bold;
  line-height: 1;
}

.trust-status {
  font-weight: 700;
  flex: 1;
  letter-spacing: 0.5px;
  font-size: 13px;
}

.trust-expand {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: inherit;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.trust-expand:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.1);
}

/* Badge Details (expandable) */
.trust-details {
  padding: 0 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideDown 0.25s ease;
}

.trust-details[hidden] {
  display: none;
}

.trust-detail-item {
  margin: 14px 0;
  line-height: 1.5;
}

.trust-detail-item strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.trust-detail-item small {
  opacity: 0.9;
  line-height: 1.4;
}

.trust-hash {
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-block;
  cursor: pointer;
  word-break: break-all;
  transition: background 0.2s;
}

.trust-hash:hover {
  background: rgba(0, 0, 0, 0.35);
}

.trust-copy {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  padding: 6px 8px;
  margin-left: 6px;
  border-radius: 6px;
  opacity: 0.9;
  transition: all 0.2s;
  vertical-align: middle;
}

.trust-copy:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.3);
}

.trust-learn-more {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: inherit;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  font-weight: 600;
  margin-top: 10px;
  transition: all 0.2s;
  font-size: 13px;
}

.trust-learn-more:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.6);
  }
}

/* Compact mode (collapsed) */
.trust-badge:not(.expanded) {
  cursor: pointer;
}

.trust-badge:not(.expanded):hover {
  transform: scale(1.03);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

/* Education Modal */
.trust-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.trust-modal-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  color: #1f2937;
}

.trust-modal-content h2 {
  margin-top: 0;
  color: #111827;
  font-size: 24px;
  margin-bottom: 24px;
}

.trust-modal-content h3 {
  color: #374151;
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.trust-education-section {
  margin-bottom: 28px;
}

.trust-education-section p {
  line-height: 1.6;
  color: #4b5563;
  margin: 8px 0;
}

.trust-education-section ol,
.trust-education-section ul {
  padding-left: 24px;
  line-height: 1.8;
  color: #4b5563;
}

.trust-education-section li {
  margin: 8px 0;
}

.trust-education-example {
  background: #f3f4f6;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-family: monospace;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.trust-education-arrow {
  font-size: 20px;
  color: #6b7280;
}

.trust-education-hash {
  background: #10b981;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: bold;
}

.trust-badge-mini {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  margin: 0 2px;
}

.trust-badge-mini.trust-verified {
  background: #10b981;
}

.trust-badge-mini.trust-unverified {
  background: #f59e0b;
}

.trust-badge-mini.trust-tampered {
  background: #ef4444;
}

.trust-education-close {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  width: 100%;
  margin-top: 24px;
  transition: all 0.2s;
}

.trust-education-close:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .trust-badge {
    max-width: calc(100vw - 40px);
    font-size: 13px;
  }
  
  .trust-badge[data-position="top-right"],
  .trust-badge[data-position="top-left"] {
    top: 12px;
  }
  
  .trust-badge[data-position="bottom-right"],
  .trust-badge[data-position="bottom-left"] {
    bottom: 12px;
  }
  
  .trust-badge[data-position="top-right"],
  .trust-badge[data-position="bottom-right"] {
    right: 12px;
  }
  
  .trust-badge[data-position="top-left"],
  .trust-badge[data-position="bottom-left"] {
    left: 12px;
  }
  
  .trust-modal-content {
    padding: 24px;
    font-size: 14px;
  }
}

/* Print styles - hide badge when printing */
@media print {
  .trust-badge,
  .trust-modal {
    display: none !important;
  }
}
