/**
 * Media Library Custom Styles
 * This file provides additional styling for the media library functionality
 */

/* Media Modal Styles */
#mediaModal .modal-xl {
  max-width: 95%;
}

/* Media Grid Styles */
#media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

#media-grid.grid-view .media-item {
  width: 100%;
  height: 170px;
}

#media-grid.list-view .media-item {
  display: flex;
  width: 100%;
}

/* Media Item Styles */
.media-item {
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  transition: all 0.2s ease;
  background-color: #f8f9fa;
}

.media-item:hover {
  border-color: #ddd;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.media-item.selected {
  border-color: #0d6efd;
  box-shadow: 0 0 0 1px #0d6efd;
}

.media-item.showing-details {
  border-color: #198754 !important;
  box-shadow: 0 0 0 4px rgba(25, 135, 84, 0.2) !important;
}

.media-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.media-item .check-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.media-item:hover .check-overlay {
  opacity: 1;
}

.media-item.selected .check-overlay {
  opacity: 1;
  background-color: #0d6efd;
  color: white;
}

.media-item .media-info {
  padding: 8px;
  font-size: 0.85rem;
  color: #555;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
}

/* Image Details Panel */
#image-details-panel {
  position: sticky;
  top: 20px;
  margin-top: 0;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
}

#image-details-panel.d-none {
  display: none !important;
}

#image-details-panel:not(.d-none) {
  display: block !important;
}

#details-image-preview {
  max-height: 200px;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto 10px auto;
}

/* Upload Area Styles */
#mediaDropzone {
  border: 2px dashed #ddd;
  border-radius: 4px;
  transition: all 0.3s;
  padding: 30px;
  text-align: center;
}

#mediaDropzone.drag-over {
  border-color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.05);
}

/* Image Preview Styles */
.upload-preview-item {
  margin-bottom: 20px;
}

.upload-preview-item .progress {
  height: 5px;
  margin-top: -5px;
  position: relative;
  z-index: 10;
  border-radius: 0;
}

.upload-preview-item .remove-upload {
  position: absolute;
  top: 5px;
  right: 20px;
  background-color: rgba(255,255,255,0.7);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Direct Insert Button */
.direct-insert-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 100;
  padding: 2px 8px;
  font-size: 12px;
  display: none;
}

.media-item:hover .direct-insert-btn {
  display: block;
}

/* Form Controls Within Media Library */
#image-details-panel .form-group {
  margin-bottom: 15px;
}

#image-details-panel .form-label {
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

#image-details-panel .form-control {
  font-size: 0.9rem;
}

#image-details-panel textarea {
  resize: vertical;
  min-height: 38px;
}

/* Debug Overlay Styles */
#media-debug-overlay {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0,0,0,0.7);
  color: white;
  padding: 10px;
  border-radius: 5px;
  z-index: 9999;
  max-width: 400px;
  max-height: 200px;
  overflow: auto;
  font-size: 12px;
  font-family: monospace;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .col-md-4 {
    margin-top: 15px;
  }
  
  #image-details-panel {
    position: static;
  }
}