/* LightWeight Video Gallery Admin Styles */

/* Shortcode Column */
.lwviga-shortcode-display {
  background: #f0f0f0;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  display: inline-block;
  font-family: "Courier New", Courier, monospace;
}

.lwviga-copy-shortcode {
  margin-left: 10px;
}

#lwviga-video-gallery-admin {
  background: #fff;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.lwviga-video-gallery-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.lwviga-video-gallery-header .button-primary {
  margin-bottom: 10px;
}

.video-gallery-items {
  min-height: 100px;
}

.video-item {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.video-item:hover {
  border-color: #999;
}

.video-item.ui-sortable-helper {
  transform: rotate(5deg);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border-color: #0073aa;
}

.video-item-header {
  background: #f1f1f1;
  padding: 12px 15px;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  cursor: move;
}

.drag-handle {
  color: #666;
  margin-right: 10px;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.toggle-video-content {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 0;
  margin: 0 8px 0 0;
  font-size: 20px;
  transition: transform 0.3s ease, color 0.3s ease;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-video-content:hover {
  color: #0073aa;
}

.toggle-video-content:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

.video-item.collapsed .toggle-video-content {
  transform: rotate(-90deg);
}

.video-item.collapsed .video-item-content {
  display: none;
}

.video-item-title {
  flex: 1;
  font-weight: 600;
  color: #333;
}

.remove-video {
  color: #a00;
  text-decoration: none;
  font-weight: normal;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.remove-video:hover {
  color: #dc3232;
}

.video-item-content {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  align-items: start;
}

.video-preview {
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
}

.video-preview-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-preview:empty::before {
  content: "No video selected";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-style: italic;
}

.video-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.video-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-field label {
  font-weight: 600;
  color: #333;
  margin: 0;
}

.video-field .button {
  align-self: flex-start;
}

.video-title-input {
  width: 100%;
  max-width: 400px;
}

.video-filename {
  font-size: 12px;
  color: #666;
  font-style: italic;
  margin-top: 4px;
}

.poster-preview {
  margin-top: 8px;
}

.poster-preview img {
  max-width: 100px;
  height: auto;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.video-description {
  width: 100%;
  resize: vertical;
  min-height: 60px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
}

.video-description:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
  outline: none;
}

/* External URL display */
.video-external-url-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: #e8f0fe;
  border: 1px solid #c1d8f0;
  border-radius: 3px;
  font-size: 12px;
  max-width: 100%;
}

.external-url-text {
  color: #1a73e8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.remove-external-url {
  flex-shrink: 0;
  padding: 0 4px !important;
  min-height: 20px !important;
  line-height: 18px !important;
}

/* Aspect ratio select */
.video-aspect-ratio-select {
  max-width: 200px;
}

/* Empty state */
.video-gallery-items:empty::before {
  content: "No videos added yet. Click 'Add Video' to get started.";
  display: block;
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
  border: 2px dashed #ddd;
  border-radius: 4px;
  background: #fafafa;
}

/* Sortable placeholder */
.video-item-placeholder {
  background: #e1f5fe;
  border: 2px dashed #0073aa;
  border-radius: 4px;
  height: 100px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0073aa;
  font-style: italic;
}

.video-item-placeholder::before {
  content: "Drop video here";
}

/* Media upload states */
.video-field.uploading .button {
  opacity: 0.6;
  pointer-events: none;
}

.video-field.uploading .button::after {
  content: " (Uploading...)";
}

/* Responsive adjustments */
@media (max-width: 782px) {
  .video-item-content {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .video-item-header {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .drag-handle {
    order: -1;
    margin-right: 8px;
  }

  .remove-video {
    margin-left: auto;
  }
}

/* Loading animation */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

.video-item.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Success states */
.video-field.success .button {
  background: #46b450;
  border-color: #46b450;
  color: white;
}

.video-field.success .button::after {
  content: " ✓";
}
