/* Base Styles */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f9f9f9;
  margin: 0;
  padding: 0;
}

.ui.container {
  padding: 20px;
}

/* Dark Mode */
body.dark-mode {
  background-color: #121212;
  color: #f5f5f5;
}

body.dark-mode .ui.segment,
body.dark-mode .ui.menu,
body.dark-mode .ui.card {
  background-color: #1e1e1e;
  color: #f5f5f5;
  border-color: #444;
}

body.dark-mode .ui.header,
body.dark-mode .ui.menu .item {
  color: #f5f5f5 !important;
}

/* Gallery Layout */
.gallery-container {
  margin-top: 2rem;
}

.ui.stackable.grid {
  margin-top: 1rem;
}

/* Gallery List */
.gallery-list {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding-right: 1rem;
}

.gallery-list .item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.2s;
}

.gallery-list .item:hover {
  background-color: rgba(33, 133, 208, 0.1);
}

.gallery-list .ui.label {
  margin-left: 8px;
}

/* Main Image */
.main-image-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

#mainImage {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
  cursor: zoom-in;
}

/* Image Description */
.image-description-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 12px;
  text-align: center;
}

body.dark-mode .image-description-container {
  background: rgba(0,0,0,0.8);
}

/* Download Button */
.download-button {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  background: rgba(0,0,0,0.7);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border: none;
}

.download-button:hover {
  background: rgba(0,0,0,0.9);
  transform: scale(1.1);
}

/* Thumbnail Strip */
.thumbnail-strip-container {
  position: relative;
  width: 100%;
  margin-top: 2rem;
}

.thumbnail-strip {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1rem 0;
  gap: 0.8rem;
  -webkit-overflow-scrolling: touch;
}

.thumbnail-strip::-webkit-scrollbar {
  height: 8px;
}

.thumbnail-strip::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.thumbnail-strip::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

body.dark-mode .thumbnail-strip::-webkit-scrollbar-track {
  background: #2a2a2a;
}

body.dark-mode .thumbnail-strip::-webkit-scrollbar-thumb {
  background: #555;
}

.thumbnail-item {
  flex: 0 0 auto;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.thumbnail-item.active {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px #2185d0;
}

.thumbnail-item img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.2s;
}

/* Fullscreen Modal */
.ui.fullscreen.modal {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background-color: rgba(0,0,0,0.95) !important;
}

.fullscreen-modal-content {
  width: 95vw;
  height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.image-container {
  position: relative;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 80%;
}

.modal-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Modal Controls */
.modal-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  z-index: 10;
}

.modal-controls .ui.button {
  background-color: rgba(0,0,0,0.7);
  color: white;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-controls .ui.button:hover {
  background-color: rgba(0,0,0,0.9);
}

#closeModal {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 1.5rem;
  z-index: 100;
  cursor: pointer;
  background: rgba(0,0,0,0.7);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
}

.modal-download {
  position: absolute;
  top: 20px;
  right: 70px;
  z-index: 10;
  background: rgba(0,0,0,0.7);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border: none;
}

.modal-download:hover {
  background: rgba(0,0,0,0.9);
}

.modal-description {
  padding: 1.5rem;
  text-align: center;
  color: white;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: #2185d0;
  color: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  border: none;
}

/* Responsive */
@media (max-width: 768px) {
  .ui.stackable.grid {
    flex-direction: column;
  }
  
  .gallery-list {
    position: static;
    max-height: none;
    margin-bottom: 2rem;
  }
  
  #mainImage {
    max-height: 60vh;
  }
  
  .thumbnail-item img {
    width: 100px;
    height: 70px;
  }
  
  .modal-controls {
    bottom: 80px;
  }
  
  .modal-download {
    top: 80px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  .thumbnail-item img {
    width: 80px;
    height: 60px;
  }
  
  .image-description-container {
    font-size: 0.9rem;
    padding: 8px;
  }
}