/**
 * Visual Tour Styles
 * Comprehensive styling for tour modal, diagrams, and animations
 */

/* ========================================
   Tour Button
   ======================================== */

.tour-button {
  position: relative;
  padding: 8px 16px;
  background: #005DAA;
  border: 1px solid #005DAA;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tour-button:hover {
  background: #004488;
  border-color: #004488;
}

.tour-button:focus {
  outline: 3px solid #005DAA;
  outline-offset: 2px;
}

.tour-button.first-visit::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #10B981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}

/* ========================================
   Modal Backdrop & Container
   ======================================== */

.tour-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: backdropFadeIn 200ms ease-out;
}

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

.tour-modal {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 300ms ease-out;
  overflow: hidden;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================
   Header Section
   ======================================== */

.tour-header {
  background: linear-gradient(135deg, #005DAA 0%, #7C3AED 100%);
  padding: 24px 32px;
  color: white;
  position: relative;
}

.tour-header-content {
  margin-bottom: 16px;
}

.tour-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.tour-subtitle {
  font-size: 18px;
  opacity: 0.9;
  margin: 0;
}

.tour-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: white;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
  line-height: 1;
  padding: 0;
}

.tour-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tour-close:focus {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.tour-progress-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.tour-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #10B981;
  transition: width 400ms ease-in-out;
  border-radius: 4px;
}

.tour-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Content Section
   ======================================== */

.tour-content {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 32px;
  padding: 32px;
  flex: 1;
  overflow-y: auto;
}

.tour-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F9FAFB;
  border-radius: 8px;
  padding: 24px;
  min-height: 300px;
}

.tour-text {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tour-part-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 2px solid #E5E7EB;
}

.tour-part-icon {
  font-size: 32px;
  line-height: 1;
}

.tour-part-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #1F2937;
}

.tour-part-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin: 4px 0 0 0;
}

.tour-step-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: #1F2937;
}

.tour-step-description {
  font-size: 16px;
  line-height: 1.6;
  color: #4B5563;
  margin: 0;
}

.tour-navigation-help {
  margin-top: auto;
  padding: 16px;
  background: #F3F4F6;
  border-radius: 6px;
  font-size: 14px;
  color: #4B5563;
}

.tour-navigation-help p {
  margin: 0 0 8px 0;
}

.tour-navigation-help ul {
  margin: 0;
  padding-left: 20px;
}

.tour-navigation-help li {
  margin-bottom: 4px;
}

.tour-dont-show-again {
  padding: 12px;
  background: #FEF3C7;
  border-radius: 6px;
  font-size: 14px;
}

.tour-dont-show-again label {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   Footer Section
   ======================================== */

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-top: 1px solid #E5E7EB;
  background: #F9FAFB;
}

.tour-position {
  font-size: 14px;
  color: #6B7280;
  font-weight: 500;
}

.tour-step-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tour-step-dots .dot {
  width: 10px;
  height: 10px;
  background: #D1D5DB;
  border-radius: 50%;
  cursor: pointer;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: white;
}

.tour-step-dots .dot:hover {
  transform: scale(1.2);
}

.tour-step-dots .dot.active {
  background: #005DAA;
  width: 12px;
  height: 12px;
}

.tour-step-dots .dot.completed {
  background: #10B981;
}

.tour-actions {
  display: flex;
  gap: 12px;
}

.tour-back,
.tour-continue {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease;
  border: none;
  min-width: 120px;
}

.tour-back {
  background: #F3F4F6;
  color: #4B5563;
}

.tour-back:hover {
  background: #E5E7EB;
}

.tour-continue {
  background: #005DAA;
  color: white;
}

.tour-continue:hover {
  background: #004488;
}

.tour-back:active,
.tour-continue:active {
  transform: scale(0.98);
}

.tour-back:focus,
.tour-continue:focus {
  outline: 3px solid #005DAA;
  outline-offset: 2px;
}

/* ========================================
   Diagram Styles
   ======================================== */

.tour-diagram-heatmap {
  max-width: 100%;
  height: auto;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.tour-diagram-opportunity-card {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.tour-opp-card {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: white;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tour-opp-panel {
  padding: 16px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  transition: all 300ms ease;
  background: white;
}

.tour-opp-panel.highlighted {
  border-color: #10B981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
  background: #ECFDF5;
}

.tour-gap-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tour-gap-table th,
.tour-gap-table td {
  padding: 12px 16px;
  border: 1px solid #E5E7EB;
  text-align: left;
  font-size: 14px;
}

.tour-gap-table th {
  background: #F3F4F6;
  font-weight: 600;
  color: #1F2937;
}

.tour-gap-table td {
  color: #4B5563;
}

.tour-gap-table th.highlighted,
.tour-gap-table td.highlighted {
  background: #DBEAFE;
  border-color: #005DAA;
  font-weight: 600;
}

.tour-diagram-map {
  max-width: 100%;
  height: auto;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: white;
}

.tour-diagram-tabs {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #F3F4F6;
  border-radius: 8px;
  flex-wrap: wrap;
}

.tour-tab-button {
  padding: 10px 16px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  color: #4B5563;
}

.tour-tab-button:hover {
  border-color: #005DAA;
  background: #F9FAFB;
}

.tour-tab-button.highlighted {
  background: #005DAA;
  color: white;
  border-color: #005DAA;
  box-shadow: 0 0 8px rgba(0, 93, 170, 0.5);
}

.tour-diagram-flowchart {
  max-width: 100%;
  height: auto;
  background: white;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
}

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

@media (max-width: 1023px) {
  .tour-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .tour-title {
    font-size: 28px;
  }

  .tour-subtitle {
    font-size: 16px;
  }

  .tour-step-title {
    font-size: 20px;
  }
}

@media (max-width: 767px) {
  .tour-modal {
    border-radius: 0;
    max-height: 100vh;
  }

  .tour-modal-backdrop {
    padding: 0;
  }

  .tour-header {
    padding: 20px;
  }

  .tour-title {
    font-size: 24px;
  }

  .tour-subtitle {
    font-size: 14px;
  }

  .tour-content {
    padding: 20px;
    gap: 20px;
  }

  .tour-diagram {
    padding: 16px;
    min-height: 200px;
  }

  .tour-step-title {
    font-size: 18px;
  }

  .tour-step-description {
    font-size: 14px;
  }

  .tour-footer {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    padding: 16px 20px;
  }

  .tour-actions {
    width: 100%;
    flex-direction: column-reverse;
  }

  .tour-back,
  .tour-continue {
    width: 100%;
  }

  .tour-step-dots {
    justify-content: center;
  }

  .tour-position {
    text-align: center;
  }

  .tour-diagram-tabs {
    flex-direction: column;
    gap: 8px;
  }

  .tour-tab-button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .tour-step-dots {
    display: none;
  }

  .tour-title {
    font-size: 20px;
  }

  .tour-part-icon {
    font-size: 24px;
  }

  .tour-part-title {
    font-size: 16px;
  }
}

/* ========================================
   Accessibility
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .tour-modal-backdrop,
  .tour-modal,
  .tour-progress-fill,
  .tour-content,
  .tour-step-dots .dot,
  .tour-opp-panel {
    animation: none !important;
    transition: none !important;
  }

  .tour-button.first-visit::after {
    animation: none;
  }
}

/* Focus visible styles for keyboard navigation */
.tour-back:focus-visible,
.tour-continue:focus-visible,
.tour-close:focus-visible,
.tour-button:focus-visible {
  outline: 3px solid #005DAA;
  outline-offset: 2px;
}

.tour-step-dots .dot:focus-visible {
  outline: 2px solid #005DAA;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (forced-colors: active) {
  .tour-progress-fill {
    border: 1px solid;
  }

  .tour-opp-panel.highlighted {
    border: 3px solid;
  }

  .tour-tab-button.highlighted {
    border: 3px solid;
  }
}
