/**
 * Custom Component Styles for Thesis Presentation
 * Includes: Comparison Slider, 3D Model Viewer, Video Overlays, Animations
 */

/*********************************************
 * IMAGE COMPARISON SLIDER
 *********************************************/

img-comparison-slider {
  --divider-width: 3px;
  --divider-color: var(--liu-turquoise, #0cc7d3);
  --default-handle-opacity: 1;
  --default-handle-width: 50px;

  display: block;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

img-comparison-slider img {
  width: 100%;
  height: auto;
  display: block;
}

/* Custom handle styling */
img-comparison-slider .custom-handle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--liu-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Labels for comparison */
.comparison-container {
  position: relative;
}

.comparison-label {
  position: absolute;
  bottom: 20px;
  padding: 8px 16px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 0.8em;
  font-weight: 500;
  border-radius: 4px;
  z-index: 10;
}

.comparison-label.left {
  left: 20px;
}

.comparison-label.right {
  right: 20px;
}

/*********************************************
 * 3D MODEL VIEWER
 *********************************************/

model-viewer {
  width: 100%;
  height: 500px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  --poster-color: transparent;
}

model-viewer::part(default-progress-bar) {
  background: var(--liu-blue);
}

.model-viewer-container {
  position: relative;
}

.model-viewer-caption {
  text-align: center;
  margin-top: 1em;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.model-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 1em;
}

.model-controls button {
  padding: 8px 16px;
  background: var(--liu-blue);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
  transition: background 0.2s ease;
}

.model-controls button:hover {
  background: var(--liu-turquoise);
}

/*********************************************
 * VIDEO BACKGROUNDS & OVERLAYS
 *********************************************/

/* Dark overlay for text readability on video backgrounds */
.video-overlay {
  background: rgba(0,0,0,0.6);
  padding: 40px;
  border-radius: 12px;
  backdrop-filter: blur(5px);
}

.video-overlay h2 {
  color: white !important;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.video-overlay p {
  color: rgba(255,255,255,0.9);
}

/* Video title bar - bottom left corner */
.video-title-bar {
  position: absolute;
  bottom: 5%;
  left: 2%;
  padding: 12px 20px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 8px;
  backdrop-filter: blur(5px);
  z-index: 100;
}

/* Ensure parent slides with video backgrounds have full height for positioning */
.reveal section[data-background-video],
.reveal section[data-background-image] {
  height: 100%;
}

.video-title-bar h3 {
  color: white;
  margin: 0;
  font-size: 1.4em;
}

.video-title-bar .method-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--liu-turquoise);
  color: white;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 10px;
}

/*********************************************
 * LARGE IMAGE DEFAULTS FOR PRESENTATIONS
 *********************************************/

/* Make all slide images large by default */
.reveal section img {
  max-height: 65vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Centered single images should be even larger */
.reveal section > img {
  max-height: 70vh;
  display: block;
  margin: 0 auto;
}

/* Images in split layouts */
.split-layout img {
  max-height: 55vh;
  width: 100%;
  object-fit: contain;
}

/* Full-width images */
.reveal section img.full-width {
  width: 100%;
  max-width: 100%;
  max-height: 75vh;
}

/* Hero images (even larger) */
.reveal section img.hero {
  max-height: 80vh;
  width: auto;
}

/*********************************************
 * ANIMATED DIAGRAM STYLES
 *********************************************/

.diagram-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.diagram-container img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
}

.diagram-container svg {
  width: 100%;
  height: auto;
  max-height: 65vh;
}

/* Hide diagram elements initially for animation */
.diagram-container .animate-step {
  opacity: 0;
  transform: translateY(20px);
}

.diagram-container .animate-step.visible {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.5s ease;
}

/* Highlight active step */
.diagram-container .step-highlight {
  stroke: var(--liu-orange) !important;
  stroke-width: 3px;
  filter: drop-shadow(0 0 10px var(--liu-orange));
}

/* Pipeline arrow animations */
.diagram-container .pipeline-arrow {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.8s ease;
}

.diagram-container .pipeline-arrow.visible {
  stroke-dashoffset: 0;
}

/*********************************************
 * STATS & METRICS CARDS
 *********************************************/

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 1.5em 0;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  border: 1px solid var(--liu-grey-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.stat-card .stat-value {
  font-size: 2.5em;
  font-weight: 700;
  color: var(--liu-blue);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card .stat-label {
  font-size: 0.85em;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.highlight {
  background: linear-gradient(135deg, var(--liu-blue) 0%, var(--liu-turquoise) 100%);
  border: none;
}

.stat-card.highlight .stat-value,
.stat-card.highlight .stat-label {
  color: white;
}

/*********************************************
 * COMPARISON TABLES
 *********************************************/

.comparison-table {
  width: 100%;
  font-size: 0.85em;
}

.comparison-table .method-col {
  font-weight: 600;
  white-space: nowrap;
}

.comparison-table .best {
  background: var(--liu-green) !important;
  color: white;
  font-weight: 600;
}

.comparison-table .worst {
  background: #ffeaea;
  color: #c0392b;
}

.comparison-table .neutral {
  background: var(--liu-blue-20);
}

/*********************************************
 * TIMELINE / ROADMAP
 *********************************************/

.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--liu-blue) 0%, var(--liu-turquoise) 100%);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5em;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px;
  top: 5px;
  width: 14px;
  height: 14px;
  background: var(--liu-blue);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 3px var(--liu-blue);
}

.timeline-item.completed::before {
  background: var(--liu-green);
  box-shadow: 0 0 0 3px var(--liu-green);
}

.timeline-item h4 {
  margin-bottom: 0.3em;
}

.timeline-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9em;
}

/*********************************************
 * ICON BADGES
 *********************************************/

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 500;
}

.badge.success {
  background: #d4edda;
  color: #155724;
}

.badge.warning {
  background: #fff3cd;
  color: #856404;
}

.badge.danger {
  background: #f8d7da;
  color: #721c24;
}

.badge.info {
  background: var(--liu-blue-20);
  color: var(--liu-blue);
}

/*********************************************
 * SPLIT LAYOUTS
 *********************************************/

.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.split-layout.reverse {
  direction: rtl;
}

.split-layout.reverse > * {
  direction: ltr;
}

.split-layout-60-40 {
  grid-template-columns: 3fr 2fr;
}

.split-layout-40-60 {
  grid-template-columns: 2fr 3fr;
}

/*********************************************
 * QUOTE / CALLOUT BOXES
 *********************************************/

.callout {
  padding: 20px 24px;
  border-radius: 8px;
  margin: 1em 0;
}

.callout.info {
  background: var(--liu-blue-20);
  border-left: 4px solid var(--liu-blue);
}

.callout.success {
  background: #d4edda;
  border-left: 4px solid #28a745;
}

.callout.warning {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
}

.callout.insight {
  background: linear-gradient(135deg, var(--liu-blue-20) 0%, var(--liu-turquoise) 100%);
  background-size: 200% 200%;
  border: none;
  color: white;
  padding: 30px;
}

.callout.insight h4 {
  color: white;
  margin-bottom: 0.5em;
}

/*********************************************
 * LOADING STATES
 *********************************************/

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--liu-grey-light);
  border-top-color: var(--liu-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/*********************************************
 * QR CODE STYLING
 *********************************************/

.qr-container {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.qr-container img {
  width: 150px;
  height: 150px;
  border-radius: 8px;
}

.qr-container .qr-info h4 {
  margin-bottom: 0.3em;
}

.qr-container .qr-info p {
  color: var(--text-secondary);
  margin: 0;
}

/*********************************************
 * FEATURE ICONS GRID
 *********************************************/

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}

.feature-card {
  text-align: center;
  padding: 30px 20px;
}

.feature-card .icon {
  font-size: 3em;
  margin-bottom: 15px;
}

.feature-card h4 {
  color: var(--liu-blue);
  margin-bottom: 0.5em;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9em;
  margin: 0;
}

/*********************************************
 * RESPONSIVE ADJUSTMENTS
 *********************************************/

@media screen and (max-width: 1024px) {
  .split-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  model-viewer {
    height: 350px;
  }

  img-comparison-slider {
    max-width: 100%;
  }
}
