/* EEAT Content Architect - Custom Styles */

* {
  box-sizing: border-box;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #bcccdc;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #829ab1;
}

/* Tab animations */
.tab-btn {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 0;
  height: 2px;
  background: #ee7a10;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}
.tab-btn.active::after {
  width: 100%;
}
.tab-btn.active {
  color: #ee7a10;
  font-weight: 600;
}

/* Content panel transition */
.tab-panel {
  animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Markdown rendered content */
.markdown-body h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #102a43;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #fad7a5;
}
.markdown-body h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #243b53;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.markdown-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #334e68;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}
.markdown-body p {
  color: #334e68;
  line-height: 1.75;
  margin-bottom: 0.75rem;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.markdown-body li {
  color: #334e68;
  line-height: 1.7;
  margin-bottom: 0.25rem;
}
.markdown-body strong {
  color: #102a43;
  font-weight: 600;
}
.markdown-body blockquote {
  border-left: 4px solid #f19533;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: #fef7ee;
  border-radius: 0 8px 8px 0;
  color: #486581;
  font-style: italic;
}

/* Table styling for proposal section - AIEO optimized */
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.markdown-body thead {
  background: linear-gradient(135deg, #243b53, #334e68);
}
.markdown-body th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #ffffff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.markdown-body td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #d9e2ec;
  color: #334e68;
  line-height: 1.5;
}
.markdown-body tbody tr:nth-child(even) {
  background-color: #f0f4f8;
}
.markdown-body tbody tr:hover {
  background-color: #fef7ee;
  transition: background-color 0.2s;
}

/* Code blocks */
.markdown-body code {
  background: #f0f4f8;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #b9480a;
}
.markdown-body pre {
  background: #102a43;
  color: #d9e2ec;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}
.markdown-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* Links - source citations */
.markdown-body a {
  color: #df6009;
  text-decoration: none;
  border-bottom: 1px solid #fad7a5;
  transition: all 0.2s;
  font-weight: 500;
}
.markdown-body a:hover {
  color: #b9480a;
  border-bottom-color: #b9480a;
  background-color: #fef7ee;
  padding: 0 2px;
  border-radius: 2px;
}
.markdown-body a::after {
  content: '\f35d';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.65em;
  margin-left: 3px;
  opacity: 0.5;
  vertical-align: super;
}

/* Horizontal rule */
.markdown-body hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #bcccdc, transparent);
  margin: 2rem 0;
}

/* Line clamp */
.line-clamp-1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading animation */
.loading-dot {
  animation: pulse 1.4s infinite both;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Copy button */
.copy-btn {
  transition: all 0.2s;
}
.copy-btn:hover {
  transform: scale(1.05);
}
.copy-btn.copied {
  background-color: #10b981 !important;
  color: white !important;
}

/* Textarea auto-resize feel */
textarea {
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus {
  border-color: #f19533;
  box-shadow: 0 0 0 3px rgba(241, 149, 51, 0.15);
  outline: none;
}

/* Hero gradient */
.hero-gradient {
  background: linear-gradient(135deg, #102a43 0%, #243b53 50%, #334e68 100%);
}

/* Card hover */
.result-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.result-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Chip/badge */
.eeat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Toast notification */
.toast {
  animation: slideUp 0.3s ease-out, fadeOut 0.3s ease-in 2.2s forwards;
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* Source reference links in tables */
.markdown-body td a {
  font-size: 0.85rem;
  word-break: break-all;
}

/* Responsive table */
@media (max-width: 640px) {
  .markdown-body table {
    font-size: 0.8rem;
  }
  .markdown-body th, .markdown-body td {
    padding: 0.5rem 0.6rem;
  }
}

/* Streaming cursor */
.streaming-cursor::after {
  content: '▋';
  animation: blink 1s infinite;
  color: #ee7a10;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ═══ History & Detail Page Styles ═══ */

/* History row */
.history-row {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.history-row:hover {
  background-color: #f0f4f8;
}
.history-row:active {
  background-color: #d9e2ec;
}

/* Truncate text */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Detail section borders */
.detail-section {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #d9e2ec;
}
.detail-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Dropdown animation */
#export-dropdown,
#detail-export-dropdown {
  animation: dropdownSlide 0.15s ease-out;
}
@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pagination button */
.pagination-btn {
  transition: all 0.2s;
  min-width: 36px;
  text-align: center;
}
.pagination-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

/* Empty state */
.empty-state {
  animation: fadeIn 0.5s ease-in-out;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .history-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .history-row > .flex-shrink-0:last-child {
    align-self: flex-end;
    margin-top: -0.5rem;
  }
}
