/* ChemDoc Sync - Styles & Animations */

/* === Screen Transitions === */
.screen-section {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.screen-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* === Progress Bar Shimmer === */
.progress-bar-animated {
  position: relative;
  overflow: hidden;
}
.progress-bar-animated::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* === Toast Notifications === */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  transform: translateX(120%);
  animation: slideInToast 0.3s ease forwards;
  max-width: 380px;
}
.toast.toast-exit {
  animation: slideOutToast 0.3s ease forwards;
}
.toast .toast-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toast .toast-icon.success { background: #dcfce7; color: #16a34a; }
.toast .toast-icon.error { background: #fee2e2; color: #dc2626; }
.toast .toast-icon.info { background: #dbeafe; color: #2563eb; }

@keyframes slideInToast {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutToast {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

/* === Button Loading Spinner === */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
  top: 50%;
  left: 50%;
  margin-top: -0.5rem;
  margin-left: -0.5rem;
}
@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

/* === SVG Chart Draw-in === */
.chart-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}
.chart-line.animate {
  animation: drawLine 1.5s ease forwards;
}
.chart-area {
  opacity: 0;
}
.chart-area.animate {
  animation: fadeInArea 1.5s ease forwards 0.3s;
}
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}
@keyframes fadeInArea {
  to { opacity: 1; }
}

/* === Counter Animation === */
.counter-animate {
  display: inline-block;
}

/* === Tour Overlay === */
#tour-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}
#tour-overlay.active {
  display: block;
}
#tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 10001;
  transition: opacity 0.3s ease;
}
#tour-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}
#tour-spotlight {
  position: fixed;
  border-radius: 0.75rem;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.6);
  z-index: 10002;
  transition: all 0.4s ease;
  pointer-events: none;
}
#tour-tooltip {
  position: fixed;
  z-index: 10003;
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  width: 360px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  transition: all 0.3s ease;
}
#tour-tooltip .tour-phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
#tour-tooltip .tour-phase-badge.phase-a { background: #dbeafe; color: #1d4ed8; }
#tour-tooltip .tour-phase-badge.phase-b { background: #fef3c7; color: #92400e; }
#tour-tooltip .tour-phase-badge.phase-c { background: #d1fae5; color: #065f46; }
#tour-tooltip .tour-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}
#tour-tooltip .tour-description {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}
#tour-tooltip .tour-step-counter {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 1rem;
}
#tour-tooltip .tour-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
#tour-tooltip .tour-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}
#tour-tooltip .tour-btn-secondary {
  background: #f1f5f9;
  color: #475569;
}
#tour-tooltip .tour-btn-secondary:hover { background: #e2e8f0; }
#tour-tooltip .tour-btn-primary {
  background: #1172d4;
  color: white;
}
#tour-tooltip .tour-btn-primary:hover { background: #0f62b6; }
#tour-tooltip .tour-btn-exit {
  background: transparent;
  color: #94a3b8;
  font-size: 0.75rem;
}
#tour-tooltip .tour-btn-exit:hover { color: #475569; }

/* Tour progress dots */
.tour-dots {
  display: flex;
  gap: 0.375rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.tour-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
  background: #e2e8f0;
  transition: all 0.2s ease;
}
.tour-dot.active {
  background: #1172d4;
  width: 1rem;
}
.tour-dot.completed {
  background: #93c5fd;
}

/* === Card Slide-out Animation === */
.card-slide-out {
  animation: slideOut 0.4s ease forwards;
}
@keyframes slideOut {
  to {
    transform: translateX(100%);
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
  }
}
.card-slide-out-red {
  animation: slideOutRed 0.4s ease forwards;
}
@keyframes slideOutRed {
  0% { border-color: #fca5a5; background: #fef2f2; }
  100% {
    transform: translateX(-100%);
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
  }
}

/* === Sidebar nav === */
.nav-item {
  transition: all 0.15s ease;
}
.nav-item.active {
  background: #3b82f6;
  color: white;
}
.nav-item:not(.active):hover {
  background: #334155;
  color: white;
}

/* === Phase divider === */
.phase-divider {
  padding: 0.5rem 0.75rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin-top: 0.5rem;
}

/* === Welcome screen === */
.phase-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.phase-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
}
.phase-connector {
  width: 3rem;
  height: 2px;
  background: linear-gradient(to right, #93c5fd, #c4b5fd);
}

/* === PDF Preview placeholder === */
.pdf-preview-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1.414;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 0.75rem;
}
.pdf-preview-placeholder .pdf-header {
  height: 1.5rem;
  background: #1172d4;
  border-radius: 0.25rem;
  opacity: 0.2;
}
.pdf-preview-placeholder .pdf-line {
  height: 0.5rem;
  background: #e2e8f0;
  border-radius: 0.25rem;
}
.pdf-preview-placeholder .pdf-line.short { width: 60%; }
.pdf-preview-placeholder .pdf-line.medium { width: 80%; }

/* === Download button appear === */
.download-appear {
  animation: popIn 0.3s ease forwards;
}
@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* === Scrollbar styling === */
.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}
.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}
