/* Sky Photos extension styles (ext/sky-photos) */

.modal {
  display: none;
  position: fixed;
  z-index: 20;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #111;
  color: #fff;
  padding: 20px;
  width: 50%;
  max-width: 600px;
  height: 50%;
  max-height: 600px;
  border-radius: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.modal-content img {
  max-width: 100%;
  max-height: 60%;
  margin-bottom: 10px;
  border-radius: 8px;
}

.close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}

.close:hover {
  color: #bbb;
}

.sky-photo-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 6px solid #fff;
  border-top: 6px solid #444;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.save-btn {
  margin-top: 12px;
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 20px;
  border: none;
  background: #1e88e5;
  color: white;
  cursor: pointer;
}

.save-btn:active {
  transform: scale(0.97);
}

.save-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.progress {
  width: 80%;
  max-width: 360px;
  margin: 16px auto;
  text-align: center;
}

.progress .bar {
  height: 6px;
  width: 0%;
  background: #4ea1ff;
  border-radius: 3px;
  transition: width 0.15s ease;
}

.progress .label {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.75;
}

.hidden {
  display: none;
}

#skyPhotosEarthGallery {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
}

.sky-earth-photo-thumb {
  position: absolute;
  display: flex;
  transform: translate(-50%, -50%);
  transform-origin: center;
  border-radius: 8px;
  z-index: 5;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

#photo-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  animation: photoPopupFadeIn 120ms ease-out;
}

@keyframes photoPopupFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#photo-popup img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

:root {
  --sky-scroll-cross-size: calc(3 * var(--menu-icon-size));
  --sky-scroll-inset-top: 8px;
  --sky-scroll-select-border: 4px;
  --fab-corner-clearance: 64px;
  --sky-scroll-gap: calc(5px / var(--dppx, 1));
}

#skyPhotosScrollGallery {
  padding: var(--sky-scroll-select-border);
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  position: fixed;
  z-index: 20;
}

#skyPhotosScrollGallery.horizontal {
  top: var(--sky-scroll-inset-top);
  height: var(--sky-scroll-cross-size);
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
}

#skyPhotosScrollGallery.horizontal.scroll-menu-right {
  left: 0;
  right: var(--menu-corner-size);
}

#skyPhotosScrollGallery.horizontal.scroll-menu-left {
  left: var(--menu-corner-size);
  right: 0;
}

#skyPhotosScrollGallery.vertical {
  width: var(--sky-scroll-cross-size);
  top: calc(var(--sky-scroll-inset-top) + var(--menu-corner-height, var(--menu-corner-size)));
  bottom: var(--fab-corner-clearance);
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
}

#skyPhotosScrollGallery.vertical.scroll-menu-right {
  right: 0;
  left: auto;
}

#skyPhotosScrollGallery.vertical.scroll-menu-left {
  left: 0;
  right: auto;
}

#skyPhotosScrollGallery::-webkit-scrollbar {
  display: none;
}

#skyPhotosScrollGallery.dragging {
  cursor: grabbing;
}

#skyPhotosScrollBox {
  display: flex;
  gap: var(--sky-scroll-gap);
}

.scroll-spacer {
  flex-shrink: 0;
  pointer-events: none;
}

.sky-scroll-photo-thumb {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}

.sky-scroll-photo-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-sizing: border-box;
  border: var(--sky-scroll-select-border) solid transparent;
  display: block;
  scroll-snap-align: center;
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
}

.sky-scroll-photo-thumb.is-selected img {
  border-color: rgba(255, 255, 255, 1);
}

#skyPhotosScrollGallery.horizontal #skyPhotosScrollBox {
  flex-direction: row;
  height: 100%;
  align-items: stretch;
}

#skyPhotosScrollGallery.horizontal .sky-scroll-photo-thumb {
  height: 100%;
  width: auto;
}

#skyPhotosScrollGallery.vertical #skyPhotosScrollBox {
  flex-direction: column;
  width: 100%;
}

#skyPhotosScrollGallery.vertical .sky-scroll-photo-thumb {
  width: 100%;
  height: auto;
}

@media (hover: hover) and (pointer: fine) {
  .add-photo-fab-wrap:hover .corner-hover-label {
    opacity: 1;
  }
}

@media (hover: hover) and (pointer: fine) {
  .corner-hover-label {
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
    color: lightgray;
    font-family: 'Courier New', monospace;
    font-size: 14px;
  }

  .add-photo-fab-wrap:hover .corner-hover-label {
    opacity: 1;
  }
}

.add-photo-fab-wrap {
  position: fixed;
  bottom: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--sky-scroll-inset-top);
}

.add-photo-fab-wrap.fab-corner-right {
  right: 0;
  left: auto;
  flex-direction: row;
}

.add-photo-fab-wrap.fab-corner-left {
  left: 0;
  right: auto;
  flex-direction: row-reverse;
}

.add-photo-fab {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #1e88e5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.add-photo-fab img {
  width: var(--menu-icon-size);
  height: var(--menu-icon-size);
  display: block;
  pointer-events: none;
}

.add-photo-choice {
  position: fixed;
  bottom: var(--fab-corner-clearance, 64px);
  z-index: 80;
  min-width: 180px;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.add-photo-choice-title {
  margin: 0;
  padding: 10px 16px 6px;
  color: rgba(255, 255, 255, 0.55);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  text-align: left;
  pointer-events: none;
}

.add-photo-choice.choice-corner-right .add-photo-choice-title {
  text-align: right;
}

.choice-corner-right {
  right: var(--sky-scroll-inset-top);
  left: auto;
}

.choice-corner-left {
  left: var(--sky-scroll-inset-top);
  right: auto;
}

.add-photo-choice.choice-corner-left .menu-item {
  flex-direction: row;
  text-align: left;
}

.add-photo-choice.choice-corner-right .menu-item {
  flex-direction: row-reverse;
  text-align: right;
}
