/* IFRAME Embed Wrapper - Enhanced for visibility */
.iframe-embed-wrapper {
  position: relative;
  width: 100%;
  height: calc(100vh - 280px); /* Dynamic height with space for header, title, and description */
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  z-index: 10; /* Ensure it's above other elements */
  display: block !important; /* Force display */
  visibility: visible !important; /* Force visibility */
}

.peertube-iframe-embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: none;
  z-index: 5;
  display: block !important;
  visibility: visible !important;
}

/* Ensure the wrapper is visible when placed in video watch page */
my-video-watch-player .iframe-embed-wrapper,
#video-wrapper ~ .iframe-embed-wrapper,
.video-wrapper .iframe-embed-wrapper {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Hide the original video player when iframe is active */
my-video-watch-player:has(~ .iframe-embed-wrapper) {
  display: none !important;
}

#video-wrapper:has(~ .iframe-embed-wrapper) {
  display: none !important;
}

/* Alternative: Hide video container when iframe wrapper exists */
.video-js:has(~ .iframe-embed-wrapper) {
  display: none !important;
}

/* Consent Overlay */
.iframe-consent-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
}

.iframe-consent-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0.4;
  filter: blur(3px);
}

.iframe-consent-content {
  position: relative;
  z-index: 101;
  max-width: 500px;
  padding: 30px;
  text-align: center;
  color: #fff;
}

.iframe-consent-icon {
  margin-bottom: 20px;
  opacity: 0.8;
}

.iframe-consent-icon svg {
  display: inline-block;
  color: #fff;
}

.iframe-consent-notice {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 25px;
  color: #e0e0e0;
}

.iframe-consent-notice a {
  color: #ff6b35;
  text-decoration: underline;
}

.iframe-consent-notice a:hover {
  color: #ff8c5a;
}

.iframe-consent-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.iframe-consent-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.iframe-consent-btn-primary {
  background: #ff6b35;
  color: #fff;
}

.iframe-consent-btn-primary:hover {
  background: #ff8c5a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.iframe-consent-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.iframe-consent-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Form Styling for Admin Panel */
.iframe-manager-form {
  margin: 20px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.iframe-manager-form .form-group {
  margin-bottom: 15px;
}

.iframe-manager-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #495057;
}

.iframe-manager-form .form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.15s ease-in-out;
}

.iframe-manager-form .form-control:focus {
  border-color: #ff6b35;
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.iframe-manager-form .form-text {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #6c757d;
}

#iframe-preview {
  margin-top: 15px;
  padding: 15px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

#iframe-preview label {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
}

#iframe-preview-url {
  color: #0056b3;
  font-size: 12px;
}

/* Ensure proper sizing in different contexts */
.video-bottom .iframe-embed-wrapper {
  margin-bottom: 20px;
}

/* Hide video.js controls when iframe is active */
.iframe-embed-wrapper ~ .video-js .vjs-control-bar {
  display: none;
}

/* Debugging styles - Add red border to help identify the wrapper */
.iframe-embed-wrapper {
  /* Uncomment to debug:
  border: 3px solid red !important;
  */
}

.peertube-iframe-embed {
  /* Uncomment to debug:
  border: 2px solid blue !important;
  */
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .iframe-consent-content {
    max-width: 90%;
    padding: 20px;
  }
  
  .iframe-consent-notice {
    font-size: 14px;
  }
  
  .iframe-consent-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

@media screen and (max-width: 480px) {
  .iframe-consent-actions {
    gap: 8px;
  }
  
  .iframe-consent-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}
