/* Image Message Component Styles */

/* Image Message Container */
.image-message-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: min(75%, 320px);
  margin: 0;
}

.image-message-wrapper {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.image-message-wrapper:hover {
  transform: scale(1.02);
}

.image-message-thumbnail {
  display: block;
  width: 100%;
  height: auto;
  max-width: 283px;
  max-height: 255px;
  object-fit: contain;
  transition: opacity 0.3s ease;
  border-radius: 12px;
}

.image-message-thumbnail.image-loaded {
  opacity: 1;
}

.image-message-thumbnail:not(.image-loaded) {
  opacity: 0.7;
}

/* Image Overlay and Actions */
.image-message-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
  border-radius: 11px;
}

.image-message-wrapper:hover .image-message-overlay {
  background: rgba(0, 0, 0, 0.3);
}

.image-message-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-message-wrapper:hover .image-message-actions {
  opacity: 1;
  transform: translateY(0);
}

.image-message-expand,
.image-message-download {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #495057;
  font-size: 0.9rem;
}

.image-message-expand:hover,
.image-message-download:hover {
  background: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.image-message-expand:active,
.image-message-download:active {
  transform: scale(0.95);
}

/* Loading State */
.image-message-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 11px;
}

.image-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e9ecef;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: imageSpin 1s linear infinite;
}

@keyframes imageSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error State */
.image-error-state {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(248, 249, 250, 0.9);
  color: #dc3545;
  text-align: center;
  padding: 1rem;
  border-radius: 11px;
}

.image-error-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.image-error-state span {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Image Info */
.image-message-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: rgba(248, 249, 250, 0.8);
  border-radius: 6px;
  font-size: 0.8rem;
  color: #6c757d;
}

.image-filename {
  font-weight: 500;
  color: #495057;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-size {
  color: #868e96;
  font-size: 0.75rem;
}

/* Image Modal Styles */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(8px);
}

.image-modal-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.image-modal-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  animation: imageModalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

@keyframes imageModalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.image-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  background: linear-gradient(135deg, #00091E 0%, rgba(85, 93, 255, 0.05) 100%);
}

.image-modal-info {
  flex: 1;
}

.image-modal-filename {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #212529;
  word-break: break-all;
}

.image-modal-meta {
  color: #6c757d;
  font-size: 0.9rem;
}

.image-modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: 1rem;
}

.image-modal-download,
.image-modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #6c757d;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.image-modal-download:hover,
.image-modal-close:hover {
  background: #dee2e6;
  color: #495057;
}

.image-modal-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #f8f9fa;
  overflow: hidden;
}

.image-modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .image-message-container {
    max-width: 280px;
  }

  .image-message-thumbnail {
    max-width: 260px;
    max-height: 180px;
  }

  .image-modal-content {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
  }

  .image-modal-header {
    padding: 1rem;
  }

  .image-modal-body {
    padding: 0.5rem;
  }

  .image-modal-filename {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .image-message-container {
    max-width: 240px;
  }

  .image-message-thumbnail {
    max-width: 220px;
    max-height: 160px;
  }

  .image-message-actions {
    gap: 0.25rem;
  }

  .image-message-expand,
  .image-message-download {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }

  .image-modal-header {
    padding: 0.75rem;
  }

  .image-modal-filename {
    font-size: 1rem;
  }

  .image-modal-meta {
    font-size: 0.8rem;
  }

  .image-modal-actions {
    margin-left: 0.5rem;
  }

  .image-modal-download,
  .image-modal-close {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }
}

/* Focus styles for accessibility */
.image-message-expand:focus,
.image-message-download:focus,
.image-modal-download:focus,
.image-modal-close:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .image-message-overlay,
  .image-message-actions,
  .image-modal-header,
  .image-modal-actions {
    display: none !important;
  }

  .image-message-container {
    break-inside: avoid;
    max-width: none;
  }
}
