/* Base Styles */
body {
  font-family: 'Inter', sans-serif;
  background-color: #f5f7ff;
  margin: 0;
  padding: 0px 20px 20px 20px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1 {
  color: #4361ee;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Three Column Layout */
.three-column-layout {
  display: flex;
  flex: 1;
  gap: 20px;
  height: calc(100vh - 100px);
  overflow: hidden;
}

.left-column {
  flex: 0 0 55%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.middle-column {
  flex: 0 0 25%;
  display: flex;
  flex-direction: column;
}

.right-column {
  flex: 0 0 20%;
  display: flex;
  flex-direction: column;
}

/* URL Input Section */
.url-input-container {
  display: flex;
  gap: 10px;
}

#hlsUrlInput {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

#loadUrlBtn {
  padding: 10px 20px;
  background-color: #4361ee;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

#loadUrlBtn:hover {
  background-color: #3a56d4;
}

/* Video Container */
.video-container {
  position: relative;
  background: linear-gradient(135deg, #f5f7ff 0%, #e8ecff 100%);
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Results Panel - Updated Structure */
.results-panel {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel-header {
  font-weight: 600;
  margin-bottom: 15px;
  color: #4361ee;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.panel-header i {
  font-size: 16px;
}

#screenshotContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  border-radius: 8px;
  padding: 15px;
  gap: 15px;
  overflow-y: auto;
}

.best-match-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  text-align: center;
}

.best-match-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  border: 2px solid #4361ee;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.match-status {
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  margin-bottom: 10px;
}

.match-details {
  width: 100%;
  background: #f8fafc;
  border-radius: 8px;
  padding: 15px;
  margin-top: auto;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.detail-label {
  color: #64748b;
  font-weight: 500;
}

.detail-value {
  color: #1e293b;
  font-weight: 600;
}

/* Reference Panel - Updated Structure */
.reference-panel {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.upload-container {
  margin-bottom: 0;
}

.custom-upload {
  padding: 12px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.custom-upload:hover {
  border-color: #4361ee;
  background: rgba(67, 97, 238, 0.05);
}

.custom-upload i {
  font-size: 24px;
  color: #4361ee;
}

#referenceImageContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  padding: 15px;
  gap: 15px;
}

.reference-image-display {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}

#referenceImageContainer img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

.upload-prompt {
  color: #6b7280;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.processing-status {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.processing-message {
  font-size: 14px;
  color: #4361ee;
  display: flex;
  align-items: center;
  gap: 8px;
}

.processing-message i {
  font-size: 16px;
}

.processing-summary {
  background: #f0f4ff;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: auto;
}

.processing-summary p {
  margin: 5px 0;
  display: flex;
  justify-content: space-between;
}

.processing-summary p span:last-child {
  font-weight: 600;
  color: #1e293b;
}

/* Controls */
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 15px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.controls button {
  padding: 10px 20px;
  background-color: #4361ee;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls button:hover {
  background-color: #3a56d4;
}

#timeDisplay {
  display: flex;
  align-items: center;
  padding: 0 15px;
  background: #f0f4ff;
  border-radius: 8px;
  color: #4361ee;
  font-weight: 500;
}

/* Common Elements */
input[type="file"] {
  display: none;
}

.no-matches {
  color: #6b7280;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
}

.no-matches i {
  font-size: 40px;
  opacity: 0.5;
}

/* Status Indicators */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #4361ee;
  flex: 1;
}

.loading i {
  font-size: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.reference-image-item {
  position: relative;
  margin-bottom: 20px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.detection-success {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #10b981;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.detection-warning {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f59e0b;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.no-faces,
.error {
  text-align: center;
  padding: 20px;
  color: #ef4444;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.no-faces i,
.error i {
  font-size: 40px;
  margin-bottom: 10px;
}

.error-detail {
  font-size: 14px;
  color: #6b7280;
  margin-top: 10px;
}

.help-text {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 5px;
}

/* Confidence Level Indicators */
.confidence-high {
  color: #10b981;
}

.confidence-medium {
  color: #f59e0b;
}

.confidence-low {
  color: #ef4444;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .three-column-layout {
    flex-direction: column;
    height: auto;
  }

  .left-column,
  .middle-column,
  .right-column {
    flex: 1 1 auto;
    width: 100%;
  }

  .video-container {
    min-height: 400px;
  }

  .reference-panel,
  .results-panel {
    min-height: 300px;
  }
}

@media (max-width: 768px) {
  .controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .custom-upload {
    padding: 10px;
  }

  .panel-header {
    font-size: 14px;
  }

  .best-match-image,
  #referenceImageContainer img {
    max-height: 150px;
  }
}