/**
 * Fotos Gallery Styles
 * Windows 95/98 aesthetic for photo gallery
 */

/* Gallery Window Sizing */
.window-container.gallery-window {
  width: 640px;
  height: 480px;
  max-width: 95vw;
  max-height: 90vh;
}

.window-container.gallery-window .window-body {
  padding: 12px;
  height: calc(100% - 43px); /* Subtract title bar height */
  overflow: hidden;
  background: rgba(23, 23, 23, 0.5); /* Translucent background like controls-wrap */
  box-sizing: border-box;
}

/* Folder View Container */
.photos-folder-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: transparent;
  font-family: 'MS Sans Serif', Arial, sans-serif;
  font-size: 11px;
  box-sizing: border-box;
}

/* Hide breadcrumb if it exists (shouldn't be generated anymore) */
.photos-breadcrumb {
  display: none !important;
}

/* Grid Container - Windows Explorer icon view */
.photos-grid {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  margin-bottom: 12px; /* Add bottom margin to create space */
  background: transparent;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-end;
  gap: 12px;
}

/* Folder Items - Windows 95/98 style */
.photos-folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  padding: 4px;
  width: 140px;
  min-height: 170px;
  border: 1px solid transparent;
  background: transparent;
  user-select: none;
}

.photos-folder:hover {
  background: #00008099;
  border: 1px dotted #ffffff;
}

.photos-folder:hover .photos-item-label {
  color: #ffffff;
  background: #000080;
}

.photos-folder img {
  width: 96px;
  height: 96px;
  margin-bottom: 4px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Media Items - Windows 95/98 icon style */
.photos-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  padding: 4px;
  width: 140px;
  min-height: 170px;
  border: 1px solid transparent;
  background: transparent;
  user-select: none;
  position: relative;
}

.photos-item:hover {
  background: #000080;
  border: 1px dotted #ffffff;
}

.photos-item:hover .photos-item-label {
  color: #ffffff;
  background: #000080;
}

.photos-item img {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border: none;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

.photos-type-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

/* Item Labels - Windows 95/98 style */
.photos-item-label {
  font-size: 11px;
  color: #ffffff;
  text-align: center;
  word-wrap: break-word;
  max-width: 128px;
  line-height: 1.2;
  padding: 1px 2px;
  background: transparent;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty State */
.photos-empty {
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  color: #ffffff;
  font-size: 11px;
}

/* Image Viewer Container */
.photos-image-viewer {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: transparent;
  position: relative;
}

/* Navigation Bar at Top - Overlaid on image */
.photos-nav-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px;
  /* background: rgba(23, 23, 23, 0.8); */
  z-index: 10;
}

.photos-nav-bar-left {
  display: flex;
  gap: 8px;
}

.photos-nav-bar-actions {
  display: flex;
  gap: 8px;
  position: absolute;
  right: 0;
}

.photos-nav-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-family: 'MS Sans Serif', Arial, sans-serif;
  background: #c0c0c0;
  border: 2px outset #ffffff;
  cursor: pointer;
  color: #000000;
  min-width: 70px;
}

/* Hide button text on mobile, show only symbols */
.photos-nav-btn .btn-text {
  display: inline;
}

@media (max-width: 768px) {
  .photos-nav-btn .btn-text {
    display: none;
  }
  .photos-nav-btn {
    min-width: auto;
    padding: 4px 8px;
  }
}

.photos-nav-btn:hover {
  background: #d4d4d4;
}

.photos-nav-btn:active {
  border-style: inset;
  background: #a0a0a0;
}

.photos-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Image Display Area - Full window */
.photos-image-display {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1;
}

.photos-image-display img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.15s linear;
  cursor: zoom-in;
}

/* Zoom out cursor when maximized */
.window-container.maximized .photos-image-display img {
  cursor: zoom-out;
}

.photos-image-display img.loaded {
  opacity: 1;
}

/* Image Counter - Hidden for now */
.photos-image-counter {
  display: none;
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 3px;
  font-family: 'MS Sans Serif', Arial, sans-serif;
}

/* Scrollbar styling for Windows 95/98 look */
.photos-grid::-webkit-scrollbar {
  width: 16px;
}

.photos-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.photos-grid::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 1px solid #808080;
}

.photos-grid::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .window-container.gallery-window {
    width: 95vw !important;
  }
  
  .photos-grid {
    gap: 4px;
    padding: 4px;
    justify-content: center;
  }
  
  .photos-item,
  .photos-folder {
    width: 76px;
    min-height: 100px;
  }
  
  .photos-item img {
    width: 64px;
    height: 64px;
  }
  
  .photos-folder img {
    width: 64px;
    height: 64px;
  }
  
  .photos-item-label {
    font-size: 10px;
    max-width: 72px;
  }
  
  .photos-nav-bar {
    flex-wrap: wrap;
  }
  
  .photos-nav-btn {
    flex: 1;
    min-width: 60px;
  }
  
  /* Crop wide images to fit phone screen ratio */
  .photos-image-display img {
    object-fit: cover;
    width: 100%;
    height: 100%;
  }
}

/* Portrait orientation - fill height, crop sides */
@media (max-width: 768px) and (orientation: portrait) {
  .photos-image-display {
    height: 100%;
  }
  
  .photos-image-display img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
  }
  
  .window-container.maximized .photos-image-display img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
  }
}

/* Window control buttons styling */
.window-minimize,
.window-close {
  cursor: pointer;
}
