/**
 * Modern Media Library Styles
 * Clean, professional design with smooth animations
 */

/* Modal Styles */
.media-library-modal .modal-content {
  border: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.media-library-modal .modal-xl {
  max-width: 1200px;
}

/* Header */
.media-library-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 1.5rem;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.media-library-header .header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
}

.media-library-header .header-left .back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
  transition: all 0.2s ease;
}

.media-library-header .header-left .back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: white;
}

.media-library-header .title-breadcrumb {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.media-library-header .modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.media-library-header .modal-title i {
  font-size: 1.4rem;
}

.media-library-header .breadcrumb-nav .breadcrumb {
  font-size: 0.8rem;
}

.media-library-header .breadcrumb-item a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.media-library-header .breadcrumb-item a:hover {
  color: white;
}

.media-library-header .breadcrumb-item.active {
  color: rgba(255, 255, 255, 0.6);
}

.media-library-header .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.5);
}

.media-library-header .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.media-library-header .view-toggle .btn {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
  background: transparent;
}

.media-library-header .view-toggle .btn:hover,
.media-library-header .view-toggle .btn.active {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.media-library-header .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.media-library-header .btn-close:hover {
  opacity: 1;
}

/* Body */
.media-library-body {
  padding: 0;
  background: #f8fafc;
  min-height: 500px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Toolbar */
.media-library-toolbar {
  background: white;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.media-library-toolbar .toolbar-left,
.media-library-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.media-library-toolbar .divider {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
}

.media-library-toolbar .search-box {
  position: relative;
  width: 250px;
}

.media-library-toolbar .search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

.media-library-toolbar .search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.media-library-toolbar .search-box input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.media-library-toolbar .selected-count {
  background: #667eea;
  color: white;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Upload Drop Zone */
.upload-drop-zone {
  margin: 1rem 1.5rem;
  padding: 2rem;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  background: white;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
  border-color: #667eea;
  background: #f0f4ff;
}

.upload-drop-zone .drop-zone-content i {
  font-size: 3rem;
  color: #667eea;
  margin-bottom: 0.5rem;
}

.upload-drop-zone .drop-zone-content p {
  margin: 0.5rem 0;
  color: #64748b;
}

.upload-drop-zone .browse-link {
  color: #667eea;
  font-weight: 600;
  cursor: pointer;
}

.upload-drop-zone .drop-zone-content small {
  color: #94a3b8;
}

/* Upload Progress */
.upload-progress {
  margin: 1rem 1.5rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.upload-progress .progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

.upload-progress .progress-percent {
  font-weight: 600;
  color: #667eea;
}

.upload-progress .progress {
  height: 8px;
  border-radius: 4px;
}

.upload-progress .progress-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Media Content */
.media-content {
  padding: 1rem 1.5rem;
}

.media-content.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.media-content.list-view {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Media Item - Grid View */
.media-content.grid-view .media-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.media-content.grid-view .media-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.media-content.grid-view .media-item.selected {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.media-content.grid-view .media-item .item-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.media-content.grid-view .media-item .item-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

.media-content.grid-view .folder-item {
  position: relative;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.media-content.grid-view .folder-item .item-icon {
  margin-bottom: 0.5rem;
}

.media-content.grid-view .folder-item .item-icon i {
  font-size: 3rem;
  color: #667eea;
}

.media-content.grid-view .folder-item .item-info {
  text-align: center;
}

.media-content.grid-view .folder-item .item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  display: block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-content.grid-view .folder-item .item-meta {
  font-size: 0.75rem;
  color: #94a3b8;
}

.media-content.grid-view .file-item {
  position: relative;
  display: flex;
  flex-direction: column;
}

.media-content.grid-view .file-item .item-preview {
  height: 120px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-content.grid-view .file-item .item-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.video-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
}

.video-preview-placeholder i {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #60a5fa;
}

.video-preview-placeholder span {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
}

.media-content.grid-view .file-item .item-info {
  padding: 0.75rem;
  background: white;
  border-top: 1px solid #f1f5f9;
}

.media-content.grid-view .file-item .item-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: #334155;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-content.grid-view .file-item .item-meta {
  font-size: 0.7rem;
  color: #94a3b8;
}

.media-content.grid-view .media-item .item-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.media-content.grid-view .media-item:hover .item-actions {
  opacity: 1;
}

/* Media Item - List View */
.media-content.list-view .media-item {
  background: white;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.media-content.list-view .media-item:hover {
  background: #f8fafc;
}

.media-content.list-view .media-item.selected {
  border-color: #667eea;
  background: #f0f4ff;
}

.media-content.list-view .media-item .item-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

.media-content.list-view .folder-item .item-icon i {
  font-size: 1.75rem;
  color: #667eea;
}

.media-content.list-view .file-item .item-preview {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f5f9;
  flex-shrink: 0;
}

.media-content.list-view .file-item .item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-content.list-view .media-item .item-info {
  flex: 1;
  min-width: 0;
}

.media-content.list-view .media-item .item-name {
  font-weight: 500;
  color: #334155;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-content.list-view .media-item .item-meta {
  font-size: 0.8rem;
  color: #94a3b8;
}

.media-content.list-view .media-item .item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.media-content.list-view .media-item:hover .item-actions {
  opacity: 1;
}

/* Action Buttons */
.btn-action {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.btn-action:hover {
  background: white;
  color: #667eea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-action.btn-danger:hover {
  color: #ef4444;
}

/* Empty State */
.media-content .empty-state {
  text-align: center;
  padding: 3rem;
  color: #94a3b8;
  grid-column: 1 / -1;
}

.media-content .empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.media-content .empty-state h5 {
  color: #64748b;
  margin-bottom: 0.5rem;
}

/* Drag Over States */
.media-item.dragging {
  opacity: 0.5;
}

.folder-item.drag-over {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%) !important;
  border: 2px dashed #667eea !important;
}

/* Footer */
.media-library-footer {
  background: white;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.media-library-footer .footer-left,
.media-library-footer .footer-right {
  display: flex;
  gap: 0.5rem;
}

/* Image Preview Overlay */
.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10100;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.image-preview-overlay.active {
  display: flex;
}

.image-preview-overlay .preview-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.image-preview-overlay .preview-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.image-preview-overlay img {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.image-preview-overlay .preview-info {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  display: flex;
  gap: 1rem;
  color: white;
  backdrop-filter: blur(10px);
}

.image-preview-overlay .preview-filename {
  font-weight: 500;
}

.image-preview-overlay .preview-size {
  color: rgba(255, 255, 255, 0.7);
}

/* Toast Notifications */
.media-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 10200;
  transform: translateX(120%);
  transition: transform 0.3s ease;
}

.media-toast.show {
  transform: translateX(0);
}

.media-toast.success {
  border-left: 4px solid #10b981;
}

.media-toast.success i {
  color: #10b981;
}

.media-toast.error {
  border-left: 4px solid #ef4444;
}

.media-toast.error i {
  color: #ef4444;
}

.media-toast.info {
  border-left: 4px solid #667eea;
}

.media-toast.info i {
  color: #667eea;
}

.media-toast i {
  font-size: 1.25rem;
}

/* Rename & Create Folder Modals */
#renameModal .modal-content,
#createFolderModal .modal-content {
  border-radius: 12px;
  border: none;
}

#renameModal .modal-header,
#createFolderModal .modal-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

#renameModal .modal-title,
#createFolderModal .modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

#renameModal .modal-title i,
#createFolderModal .modal-title i {
  color: #667eea;
}

#renameInput,
#newFolderInput {
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

#renameInput:focus,
#newFolderInput:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Loading Spinner */
.media-content .loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  grid-column: 1 / -1;
}

/* Button Styles */
.media-library-toolbar .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
}

.media-library-toolbar .btn-primary:hover {
  background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.media-library-footer .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
}

.media-library-footer .btn-primary:hover {
  background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.media-library-footer .btn-primary:disabled {
  background: #94a3b8;
  opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
  .media-library-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .media-library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .media-library-toolbar .toolbar-left,
  .media-library-toolbar .toolbar-right {
    flex-wrap: wrap;
  }
  
  .media-library-toolbar .search-box {
    width: 100%;
  }
  
  .media-content.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  
  .media-library-footer {
    flex-direction: column;
    gap: 0.75rem;
  }
}
