/* Enhanced Styles - Phase 1 UI Improvements with Fixed Scaling and Video Cropping */

/* Import Open Sans font */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap');

/* Typography Variables */
:root {
  --petrol-blue: #1e4a5c;
  --petrol-blue-65: rgba(30, 74, 92, 0.65);
  --font-primary: 'Open Sans', Arial, sans-serif;
  --font-fallback: Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  margin: 0;
  padding: 20px;
  background: #030041;
  min-height: 100vh;
  color: #333;
}

.demo-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

/* Header Section */
.header-section {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: left;
  gap: 2px;
  margin-bottom: 0px;
}

.company-logo {
  height: 120px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Typography Classes */

/* Headline 1: Visuelt Medium / -1 spacing / Petrol blue / Open Sans bold / Arial bold */
.headline-1 {
  font-family: var(--font-primary);
  font-weight: 700;
  color: white
  /* color: var(--petrol-blue); */
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Intro Text: Visuelt Regular / 40-60 line height / 65% Petrol blue / Open Sans Normal / Arial normal */
.intro-text {
  font-family: var(--font-primary);
  font-weight: 400;
  color: var(--petrol-blue-65);
  line-height: 1.5; /* 40-60% range, using 1.5 as optimal */
}

/* Call to Actions: Visuelt Regular / +1 spacing / Open Sans Normal or bold / Arial normal or bold */
.cta-text {
  font-family: var(--font-primary);
  font-weight: 400;
  letter-spacing: 0.02em; /* +1 spacing */
}

.cta-text.bold {
  font-weight: 600;
}

/* Header - Headline 1 Typography */
h3 {
  /* Headline 1: Visuelt Medium / -1 spacing / Petrol blue / Open Sans bold / Arial bold */
  /*color: var(--petrol-blue); */
  color: white;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700; /* Open Sans bold */
  font-family: var(--font-primary);
  letter-spacing: -0.02em; /* -1 spacing */
  text-shadow: none; /* Remove previous white text shadow */
}

/* Main Player Section */
.player-section {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
  overflow: hidden;
  min-height: 0;
}

/* Product Info Section */
.product-info {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
}

.product-logos {
  display: flex;
  justify-content: left;
  gap: 24px;
  margin-bottom: 20px;
}

.product-logo {
  height: 50px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.product-logo:hover {
  opacity: 1;
}

.demo-description {
  text-align: left;
}

.demo-description h4 {
  margin: 0 0 12px 0;
  color: #1e293b;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-primary);
}

.demo-description p {
  /* Apply Intro Text typography */
  margin: 0 0 16px 0;
  font-family: var(--font-primary);
  font-weight: 400;
  color: var(--petrol-blue-65); /* 65% Petrol blue */
  font-size: 0.9rem;
  line-height: 1.5; /* 40-60% range optimal */
  max-width: auto;
  margin-left: 0;
  margin-right: auto;
}

.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: left;
  gap: 8px;
  margin-top: 16px;
}

.feature-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* FIXED VIDEO CONTAINER SCALING */
#videoContainer {
  position: relative;
  background-color: #000;
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);

  /* Smooth transitions for all transformations */
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);

  /* Default 16:9 aspect ratio - no fixed height */
  aspect-ratio: 16/9;
  height: auto;
}

/* Transitioning state for smooth animations */
#videoContainer.transitioning {
  transform: scale(0.98);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

/* FIXED VERTICAL MODE - No more fixed dimensions! */
#videoContainer.vertical-mode {
  aspect-ratio: 9/16;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

/* Video element styling - FIXED CROPPING */
#video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;  /* CHANGED FROM 'contain' TO 'cover' FOR PROPER CROPPING */
  object-position: center;
  border-radius: 12px;
}

/* FIXED PLAY BUTTON - Responsive sizing */
#customPlayButton {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 50%;
  width: min(80px, 15%);
  height: min(80px, 15%);
  font-size: min(30px, 5vw);
  cursor: pointer;
  display: none;
  z-index: 10;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

#customPlayButton:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -50%) scale(1.1);
}

/* Controls Sidebar */
.controls-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-section {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.control-section h4 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Enhanced Control Buttons */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  /* Apply CTA typography */
  font-family: var(--font-primary);
  font-weight: 400;
  letter-spacing: 0.02em; /* +1 spacing */
  text-decoration: none;
  color: inherit;
}

.control-btn:hover {
  border-color: #4ea1ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.control-btn.active {
  border-color: #4ea1ff;
  background: #4ea1ff;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.control-btn .icon {
  font-size: 1.5rem;
  min-width: 24px;
}

.control-btn .content {
  flex: 1;
}

.control-btn .label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.control-btn .desc {
  display: block;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Stream Selection */
.stream-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stream-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  /* Apply CTA typography */
  font-family: var(--font-primary);
  font-weight: 400;
  letter-spacing: 0.02em; /* +1 spacing */
}

.stream-btn:hover {
  border-color: #4ea1ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.stream-btn.active {
  border-color: #4ea1ff;
  background: #4ea1ff;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.stream-btn .stream-icon {
  font-size: 1.5rem;
  min-width: 24px;
}

.stream-btn .stream-info h5 {
  margin: 0 0 4px 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.stream-btn .stream-info p {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Status Section */
.status-section {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
}

.status-grid {
  display: grid;
  gap: 12px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.status-item:last-child {
  border-bottom: none;
}

.status-item .label {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

.status-item .value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
}

/* Debug Panel */
#debugPanel {
  background: #1e293b;
  border-radius: 12px;
  padding: 16px;
  color: white;
  display: none;
}

#debugToggle {
  width: 100%;
  padding: 12px;
  background: #64748b;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.3s ease;
  /* Apply CTA typography */
  font-family: var(--font-primary);
  font-weight: 400;
  letter-spacing: 0.02em; /* +1 spacing */
}

#debugToggle:hover {
  background: #475569;
}

#debugContent {
  margin-top: 12px;
}

.debug-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #334155;
  font-size: 0.8rem;
}

.debug-item:last-child {
  border-bottom: none;
}

.debug-section {
  margin: 12px 0 8px 0;
  font-weight: 600;
  font-size: 0.85rem;
  color: #94a3b8;
}

.debug-event {
  padding: 4px 8px;
  background: #334155;
  border-radius: 4px;
  margin: 4px 0;
  font-size: 0.75rem;
}

/* Log Section */
#log {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 8px;
  height: 120px;
  overflow-y: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.4;
  margin-top: 12px;
}

#log div {
  margin: 2px 0;
  word-break: break-word;
}

#log::-webkit-scrollbar {
  width: 4px;
}

#log::-webkit-scrollbar-track {
  background: #1e293b;
}

#log::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 2px;
}

/* ENHANCED RESPONSIVE DESIGN - FIXED MOBILE SCALING */
@media (max-width: 768px) {
  .demo-container {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 10px;
  }

  .header-section {
    flex-direction: column;
    gap: 12px;
  }

  .company-logo {
    height: 80px;
  }

  h3 {
    font-size: 1.2rem;
    /* Maintain typography specs */
    font-family: var(--font-primary);
    font-weight: 700;
    color: var(--petrol-blue);
    letter-spacing: -0.02em;
  }

  .product-logos {
    gap: 16px;
    justify-content: center;
  }

  .product-logo {
    height: 28px;
  }

  .features {
    gap: 6px;
    justify-content: center;
  }

  .feature-tag {
    font-size: 0.75rem;
    padding: 3px 8px;
  }

  .demo-description {
    text-align: center;
  }

  /* FIXED MOBILE VIDEO SCALING */
  #videoContainer {
    max-width: 100%;
    aspect-ratio: 16/9;
  }

  #videoContainer.vertical-mode {
    max-width: min(320px, 90vw);
    aspect-ratio: 9/16;
    margin: 0 auto;
  }

  .control-section {
    padding: 16px;
  }

  .button-group {
    gap: 8px;
  }

  .control-btn {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .company-logo {
    height: 60px;
  }

  h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    /* Maintain typography specs */
    font-family: var(--font-primary);
    font-weight: 700;
    color: var(--petrol-blue);
    letter-spacing: -0.02em;
  }

  .player-section {
    padding: 16px;
  }

  /* EXTRA SMALL SCREENS */
  #videoContainer.vertical-mode {
    max-width: min(280px, 85vw);
    aspect-ratio: 9/16;
  }

  .product-logo {
    height: 24px;
  }

  .feature-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
  }
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.control-section {
  animation: slideIn 0.6s ease-out;
}

/* Focus states for accessibility */
.control-btn:focus,
.stream-btn:focus,
#debugToggle:focus {
  outline: 2px solid #4ea1ff;
  outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
* {
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* FORCE SCALING FIX - Ensures proper aspect ratio behavior */
#videoContainer,
#videoContainer.vertical-mode,
#videoContainer.horizontal-mode {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
}

/* Force aspect ratios */
#videoContainer {
  aspect-ratio: 16/9 !important;
  max-width: 800px !important;
  margin: 0 auto !important;
}

#videoContainer.vertical-mode {
  aspect-ratio: 9/16 !important;
  max-width: 400px !important;
  margin: 0 auto !important;
}

/* Ensure video element fills container properly and crops content */
#video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;  /* This removes black bars and crops video */
  object-position: center !important;
  display: block !important;
}

/* Mobile fixes */
@media (max-width: 768px) {
  #videoContainer {
    max-width: 100% !important;
    aspect-ratio: 16/9 !important;
  }

  #videoContainer.vertical-mode {
    max-width: min(320px, 90vw) !important;
    aspect-ratio: 9/16 !important;
    margin: 0 auto !important;
  }
}

@media (max-width: 480px) {
  #videoContainer.vertical-mode {
    max-width: min(280px, 85vw) !important;
    aspect-ratio: 9/16 !important;
  }
}