/* Azure Blob Gallery Module Styles - Scoped to avoid conflicts */

/* Gallery Styles */
.blob-gallery {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.blob-gallery .gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.blob-gallery .gallery-title {
  font-size: 1.5rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
}

.blob-gallery .gallery-container-name.editable {
  cursor: pointer;
}

.blob-gallery .gallery-container-name.editable:hover {
  background-color: rgba(0, 120, 212, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
}

.blob-gallery .gallery-title-input {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  border: 2px solid #0078d4;
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
  background: white;
  font-family: inherit;
  min-width: 200px;
}

.blob-gallery .gallery-title-input:focus {
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.blob-gallery .gallery-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Upload Section */
.blob-gallery .upload-section {
  display: flex;
  gap: 10px;
  align-items: center;
}

.blob-gallery .upload-input {
  display: none;
}

.blob-gallery .upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.blob-gallery .upload-btn::before {
  content: "+";
  font-size: 18px;
  font-weight: bold;
}

/* Search and Filter */
.blob-gallery .gallery-search {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: 200px;
}

.blob-gallery .gallery-search:focus {
  outline: none;
  border-color: #0078d4;
}

/* Gallery Grid */
.blob-gallery .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

/* Gallery Item */
.blob-gallery .gallery-item {
  position: relative;
  background: #f8f8f8;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.blob-gallery .gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.blob-gallery .gallery-item-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  cursor: pointer;
  display: block;
}

/* Image load error state */
.blob-gallery .gallery-item.image-error {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

.blob-gallery .gallery-item.image-error::before {
  content: "⚠️ Image failed to load";
  color: #999;
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.blob-gallery .gallery-item-info {
  padding: 10px;
  background: white;
}

.blob-gallery .gallery-item-name {
  font-size: 12px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.blob-gallery .gallery-item-name.editable {
  cursor: pointer;
}

.blob-gallery .gallery-item-name.editable:hover {
  background-color: rgba(0, 120, 212, 0.1);
  border-radius: 2px;
  padding: 1px 4px;
  margin: -1px -4px;
  margin-bottom: 4px;
}

.blob-gallery .gallery-item-name-input {
  font-size: 12px;
  color: #333;
  border: 1px solid #0078d4;
  border-radius: 2px;
  padding: 1px 4px;
  outline: none;
  background: white;
  font-family: inherit;
  width: 100%;
  margin-bottom: 5px;
}

.blob-gallery .gallery-item-name-input:focus {
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.blob-gallery .gallery-item-size {
  font-size: 11px;
  color: #888;
}

.blob-gallery .gallery-item-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.3s;
}

.blob-gallery .gallery-item:hover .gallery-item-actions {
  opacity: 1;
}

.blob-gallery .gallery-item-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.2s;
}

.blob-gallery .gallery-item-btn:hover {
  transform: scale(1.1);
}

.blob-gallery .btn-download {
  background: rgba(255, 255, 255, 0.9);
  color: #0078d4;
}

.blob-gallery .btn-delete {
  background: rgba(255, 255, 255, 0.9);
  color: #d32f2f;
}

/* Gallery Buttons */
.blob-gallery .btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.blob-gallery .btn-primary {
  background-color: #0078d4;
  color: white;
}

.blob-gallery .btn-primary:hover {
  background-color: #006abc;
}

.blob-gallery .btn-danger {
  background-color: #d32f2f;
  color: white;
}

.blob-gallery .btn-danger:hover {
  background-color: #b71c1c;
}

.blob-gallery .btn-secondary {
  background-color: #6c757d;
  color: white;
}

.blob-gallery .btn-secondary:hover {
  background-color: #5a6268;
}

/* Loading Spinner */
.blob-gallery .gallery-loading {
  text-align: center;
  padding: 40px;
}

.blob-gallery .spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0078d4;
  border-radius: 50%;
  animation: blob-gallery-spin 1s linear infinite;
}

@keyframes blob-gallery-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Pagination */
.blob-gallery .gallery-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.blob-gallery .pagination-btn {
  padding: 8px 16px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.blob-gallery .pagination-btn:hover:not(:disabled) {
  background: #0078d4;
  color: white;
  border-color: #0078d4;
}

.blob-gallery .pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.blob-gallery .pagination-info {
  font-size: 14px;
  color: #666;
}

/* Status Messages */
.blob-gallery .gallery-status {
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 15px;
  display: none;
}

.blob-gallery .gallery-status.show {
  display: block;
}

.blob-gallery .gallery-status.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.blob-gallery .gallery-status.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.blob-gallery .gallery-status.info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

/* Empty State */
.blob-gallery .gallery-empty {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}

.blob-gallery .gallery-empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

/* Progress Bar */
.blob-gallery .upload-progress {
  width: 100%;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
  display: none;
}

.blob-gallery .upload-progress.show {
  display: block;
}

.blob-gallery .upload-progress-bar {
  height: 100%;
  background: #0078d4;
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  overflow: auto;
}

.lightbox.show {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox .lightbox-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
  z-index: 10001;
}

.lightbox .lightbox-close:hover {
  color: #bbb;
}

.lightbox .lightbox-content {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  animation: blob-gallery-fadeIn 0.3s;
}

.lightbox .lightbox-caption {
  color: #ccc;
  padding: 15px 20px;
  text-align: center;
  font-size: 14px;
}

@keyframes blob-gallery-fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Confirmation Dialog */
.blob-gallery .confirm-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none !important;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  visibility: hidden;
}

.blob-gallery .confirm-dialog.show {
  display: flex !important;
  visibility: visible;
}

.blob-gallery .confirm-dialog-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.blob-gallery .confirm-dialog-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

.blob-gallery .confirm-dialog-message {
  color: #666;
  margin-bottom: 20px;
}

.blob-gallery .confirm-dialog-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .blob-gallery .gallery-header {
    flex-direction: column;
    align-items: stretch;
  }

  .blob-gallery .gallery-controls {
    flex-direction: column;
  }

  .blob-gallery .gallery-search {
    width: 100%;
  }

  .blob-gallery .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }

  .blob-gallery .gallery-item-image {
    height: 100px;
  }
}

@media (max-width: 480px) {
  .blob-gallery {
    padding: 15px;
  }

  .blob-gallery .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .blob-gallery .gallery-item-image {
    height: 80px;
  }
}
