/* -------------------------------------------------------------------------- */
/*                              IMAGE PICKER OVERLAY                         */
/* -------------------------------------------------------------------------- */

.image-picker-overlay {
  width: 100%;
  max-width: 600px;
  min-width: 500px;
}

.image-picker-title {
  margin-bottom: 2vmin;
}

.image-picker-title h2 {
  font-size: 2.75vmin;
  font-weight: 900;
  margin: 0;
  color: var(--dark-colour);
}

/* -------------------------------------------------------------------------- */
/*                              UPLOAD STEP                                  */
/* -------------------------------------------------------------------------- */

.image-picker-dropzone {
  border: 1px dashed rgba(0, 0, 0, 0.1);
  border-radius: 1vmin;
  padding: 4vmin;
  text-align: center;
  background: var(--white-colour);
  transition: all 0.2s ease;
  margin-bottom: 2vmin;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-picker-dropzone:hover,
.image-picker-dropzone:focus {
  border-color: var(--blue-colour);
  background: rgba(52, 152, 219, 0.05);
  outline: none;
}

.image-picker-dropzone.drag-over {
  border-color: var(--green-colour);
  background: rgba(22, 160, 133, 0.05);
  transform: scale(1.02);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5vmin;
}

.dropzone-icon {
  font-size: 4vmin;
  opacity: 0.6;
}

.dropzone-message {
  font-size: 1.5vmin !important;
  font-weight: 300 !important;
  text-transform: uppercase;
  color: var(--grey-colour);
  margin: 0;
}

.browse-btn,
.library-btn {
  background-color: var(--blue-colour);
  color: var(--white-colour);
  border: none;
  padding: 1vmin 2vmin;
  border-radius: 0.5vmin;
  font-size: 1.5vmin;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  min-height: 44px;
  min-width: 44px;
}

.library-btn {
  background-color: transparent;
  color: var(--blue-colour);
  text-decoration: underline;
  font-weight: 500;
}

.browse-btn:hover,
.library-btn:hover {
  filter: brightness(1.1);
}

.browse-btn:focus,
.library-btn:focus {
  outline: 2px solid var(--dark-colour);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/*                              PASTE TRAP                                   */
/* -------------------------------------------------------------------------- */

.paste-trap {
  width: 100%;
  padding: 2vmin;
  text-align: center;
}

.paste-trap-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5vmin;
}

.paste-trap h3 {
  margin: 0;
  font-size: 2vmin;
  font-weight: 600;
  color: var(--dark-colour);
}

.paste-trap p {
  margin: 0;
  font-size: 1.5vmin;
  color: var(--dark-colour);
  opacity: 0.8;
}

.paste-target {
  width: 100%;
  min-height: 120px;
  padding: 2vmin;
  border: 2px solid var(--blue-colour);
  border-radius: 0.5vmin;
  background: var(--white-colour);
  font-size: 1.5vmin;
  color: var(--dark-colour);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: text;
  position: relative;
}

.paste-target:focus {
  border-color: var(--green-colour);
  box-shadow: 0 0 0 2px rgba(22, 160, 133, 0.2);
}

.paste-target:empty:before {
  content: attr(placeholder);
  color: rgba(0, 0, 0, 0.5);
  font-style: italic;
  position: absolute;
  pointer-events: none;
}

.paste-hint {
  font-size: 1.25vmin !important;
  color: rgba(0, 0, 0, 0.6) !important;
  font-style: italic;
  text-align: center;
}

/* Removed keyboard shortcut styles - using button only */

.hint-text {
  font-size: 1.25vmin !important;
  color: rgba(0, 0, 0, 0.6);
  text-align: center;
  text-transform: uppercase;
  font-weight: 300 !important;
}

/* -------------------------------------------------------------------------- */
/*                              EDIT STEP                                    */
/* -------------------------------------------------------------------------- */

.edit-canvas-container {
  position: relative;
  margin-bottom: 2vmin;
  border-radius: 0.5vmin;
  overflow: hidden;
  background: #f0f0f0;
}

.edit-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: move;
}

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.crop-instructions {
  text-transform: uppercase;
  font-size: 1.25vmin;
  margin-bottom: 5vmin;
}

.thirds-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.3;
}

.grid-line {
  position: absolute;
  background: var(--white-colour);
}

.grid-line-h {
  width: 100%;
  height: 1px;
}

.grid-line-v {
  height: 100%;
  width: 1px;
}

.focal-point {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--yellow-colour);
  border: 2px solid var(--white-colour);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  pointer-events: auto;
  cursor: crosshair;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.focal-point:focus {
  outline: 2px solid var(--dark-colour);
  outline-offset: 2px;
}

.safe-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.1));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1vmin;
}

.safe-area-text {
  background: rgba(0, 0, 0, 0.7);
  color: var(--white-colour);
  padding: 0.5vmin 1vmin;
  border-radius: 0.25vmin;
  font-size: 1.25vmin;
  font-weight: 500;
}

.edit-controls {
  margin-bottom: 2vmin;
}

.control-group {
  margin-bottom: 2vmin;
}

.control-label {
  display: block;
  font-size: 1.5vmin;
  font-weight: 600;
  color: var(--dark-colour);
  margin-bottom: 1vmin;
}

.text-protection-buttons {
  display: flex;
  gap: 0.5vmin;
}

.protection-btn {
  flex: 1;
  padding: 1vmin;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: var(--white-colour);
  color: var(--dark-colour);
  font-size: 1.25vmin;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0.5vmin;
  min-height: 44px;
}

.protection-btn:first-child {
  border-radius: 0.5vmin 0 0 0.5vmin;
}

.protection-btn:last-child {
  border-radius: 0 0.5vmin 0.5vmin 0;
}

.protection-btn:only-child {
  border-radius: 0.5vmin;
}

.protection-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.protection-btn:focus {
  outline: 2px solid var(--dark-colour);
  outline-offset: 1px;
}

.protection-btn.active {
  background: var(--blue-colour);
  color: var(--white-colour);
  border-color: var(--blue-colour);
}

.alt-text-input {
  width: 100%;
  padding: 1vmin;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.5vmin;
  font-size: 1.5vmin;
  margin-bottom: 1vmin;
  min-height: 44px;
}

.alt-text-input:focus {
  outline: 2px solid var(--dark-colour);
  outline-offset: 1px;
  border-color: var(--dark-colour);
}

.alt-text-input:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

.decorative-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75vmin;
  font-size: 1.25vmin;
  cursor: pointer;
  color: var(--dark-colour);
}

.decorative-input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  cursor: pointer;
}

.decorative-input:focus {
  outline: 2px solid var(--dark-colour);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/*                              PREVIEW STEP                                 */
/* -------------------------------------------------------------------------- */

.preview-container {
  display: flex;
  gap: 2vmin;
  margin-bottom: 2vmin;
  flex-wrap: wrap;
}

.preview-card {
  flex: 1;
  min-width: 200px;
  border-radius: 0.5vmin;
  overflow: hidden;
  padding: 1vmin;
}

.preview-card.light-bg {
  background: var(--white-colour);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.preview-card.dark-bg {
  background: var(--dark-colour);
  color: var(--white-colour);
}

.preview-image-container {
  position: relative;
  width: 100%;
  height: 120px;
  background-size: cover;
  background-position: center;
  border-radius: 0.25vmin;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1vmin;
  margin-bottom: 1vmin;
}

.preview-tint {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0.25vmin;
}

.preview-text {
  position: relative;
  background: rgba(255, 255, 255, 0.9);
  color: var(--dark-colour);
  padding: 0.5vmin 1vmin;
  border-radius: 0.25vmin;
  font-size: 1.25vmin;
  font-weight: 500;
  text-align: center;
}

.dark-bg .preview-text {
  background: rgba(0, 0, 0, 0.8);
  color: var(--white-colour);
}

.preview-label {
  font-size: 1.25vmin;
  font-weight: 500;
  text-align: center;
  color: inherit;
}

.contrast-hint {
  background: rgba(255, 238, 76, 0.1);
  border: 1px solid var(--yellow-colour);
  border-radius: 0.5vmin;
  padding: 1.5vmin;
  margin-bottom: 2vmin;
  text-align: center;
}

.contrast-hint p {
  margin: 0;
  font-size: 1.25vmin;
  color: var(--dark-colour);
}

/* -------------------------------------------------------------------------- */
/*                              DIALOG ACTIONS                               */
/* -------------------------------------------------------------------------- */

.dialog-actions {
  display: flex;
  gap: 1vmin;
  justify-content: flex-end;
  margin-top: 2vmin;
  flex-wrap: wrap;
}

.dialog-actions button {
  padding: 1vmin 2vmin;
  border: none;
  border-radius: 0.5vmin;
  font-size: 1.5vmin;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  min-height: 44px;
  min-width: 44px;
}

.dialog-actions .cancel-btn {
  background: rgba(0, 0, 0, 0.1);
  color: var(--dark-colour);
}

.dialog-actions .replace-btn {
  background: var(--blue-colour);
  color: var(--white-colour);
}

.dialog-actions .remove-btn {
  background: var(--red-colour);
  color: var(--white-colour);
}

.dialog-actions .done-btn,
.dialog-actions .confirm-btn {
  background: var(--green-colour);
  color: var(--white-colour);
}

.dialog-actions .back-btn {
  background: rgba(0, 0, 0, 0.1);
  color: var(--dark-colour);
}

.dialog-actions .primary {
  background: var(--green-colour);
  color: var(--white-colour);
}

.dialog-actions button:hover {
  filter: brightness(1.1);
}

.dialog-actions button:focus {
  outline: 2px solid var(--dark-colour);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/*                              ERROR MESSAGES                               */
/* -------------------------------------------------------------------------- */

.error-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red-colour);
  color: var(--white-colour);
  padding: 12px 24px;
  border-radius: 4px;
  z-index: 10000;
  font-size: 1.5vmin;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* -------------------------------------------------------------------------- */
/*                              RESPONSIVE DESIGN                            */
/* -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  .image-picker-overlay {
    min-width: auto;
    max-width: 95vw;
  }

  .preview-container {
    flex-direction: column;
  }

  .text-protection-buttons {
    flex-wrap: wrap;
  }

  .protection-btn {
    min-width: 0;
    flex: 1 1 calc(50% - 0.25vmin);
  }

  .dialog-actions {
    justify-content: center;
  }
}

/* -------------------------------------------------------------------------- */
/*                              ACCESSIBILITY                                */
/* -------------------------------------------------------------------------- */

/* Respect reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  .image-picker-dropzone {
    transition: none;
  }

  .image-picker-dropzone.drag-over {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .image-picker-dropzone {
    border-width: 3px;
  }

  .protection-btn {
    border-width: 2px;
  }
}

/* Focus styles for keyboard navigation */
.image-picker-overlay *:focus-visible {
  outline: 2px solid var(--dark-colour);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/*                              IMAGE PICKER SUBMENU                         */
/* -------------------------------------------------------------------------- */

.image-picker-submenu-wrap {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: rgba(0, 0, 0, 0.2);
}

.image-picker-submenu-wrap.show {
  z-index: 1001;
  pointer-events: auto;
}

.image-picker-submenu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  width: 90vw;
  max-width: 30vmin;
  background-color: var(--light-colour);
  border-radius: 1vmin;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 4px 8px -2px,
    rgba(0, 0, 0, 0.15) 0px 8px 16px -4px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.image-picker-submenu.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.image-picker-submenu h3 {
  margin: 0;
  padding: 2vmin;
  text-align: center;
  font-size: 2vmin;
  font-weight: 900;
  color: var(--white-colour);
  background-color: var(--dark-colour);
  border-radius: 1vmin 1vmin 0 0;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.submenu-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2vmin;
  border: none;
  background-color: var(--light-colour);
  cursor: pointer;
  font-size: 1.5vmin;
  font-weight: 300;
  color: var(--dark-colour);
  text-align: left;
  height: 7.5vmin;
  text-decoration: none;
  text-transform: uppercase;
  column-gap: 2vmin;
  border-radius: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  border-top: 1px solid #fff;
}

.submenu-option:hover {
  background-color: var(--white-colour);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.submenu-option:active {
  outline: none;
  box-shadow: none;
}

/* don’t show a mouse-focus ring */
.submenu-option:focus {
  outline: none;
}

/* keep an accessible focus style for keyboard users */
.submenu-option:focus-visible {
  outline: 2px solid var(--dark-colour);
  outline-offset: 2px;
}

/* iOS tap highlight */
.submenu-option {
  -webkit-tap-highlight-color: transparent;
}

.cancel-submenu-btn {
  border-radius: 0 0 1vmin 1vmin;
  color: var(--red-colour);
  background-color: #ddd;
  justify-content: center;
  font-weight: 600;
}

.cancel-submenu-btn:hover {
  background-color: var(--red-colour);
  color: var(--light-colour);
}

.option-icon svg {
  width: 2vmin;
  height: 2vmin;
  fill: var(--dark-colour);
}

/* -------------------------------------------------------------------------- */
/*                              TOAST NOTIFICATIONS                          */
/* -------------------------------------------------------------------------- */

.image-picker-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red-colour);
  color: var(--white-colour);
  padding: 3vmin 4.5vmin;
  border-radius: 0.5vmin;
  z-index: 10000;
  font-size: 2vmin;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: slideInFromTop 0.3s ease-out;
  text-transform: uppercase;
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* -------------------------------------------------------------------------- */
/*                                IMAGE SEARCH                                */
/* -------------------------------------------------------------------------- */

.background-cover {
  position: fixed;
  display: none;
  justify-content: center;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  background-color: #3498db;
  overflow: auto;
}

.imSearchHeaderBck {
  width: 100vw;
  height: fit-content;
  display: flex;
  justify-content: center;
  background-color: rgba(255, 238, 76, 0.05);
  margin-bottom: 4vh;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.imSearchHeader {
  height: 10vh;
  width: 90vw;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.imSearchHeader p {
  font-size: 3vmin;
  font-weight: 300;
  margin: 0;
  padding: 0;
  color: var(--white-colour);
}

.imSearchHeader img {
  height: 6vh;
  width: auto;
  margin: 0;
  padding: 0;
  padding-right: 1vw;
  border-radius: 1vmin;
}

.search-container {
  width: 90vw;
  max-width: 1200px;
  height: fit-content;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  box-sizing: border-box;
}

#searchQuery {
  width: 100%;
  padding: 2vmin;
  font-size: 2.5vmin;
  font-weight: 300;
  margin-bottom: 2vh;
  border-radius: 1vmin;
  border: 1px solid rgba(0, 0, 0, 0.5);
}

.image-results {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  align-content: start;
}

.image-results p {
  text-align: center;
  font-size: 2.25vmin;
  font-weight: 300;
  white-space: nowrap;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 1vmin;
  padding: 2vmin;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  grid-column: 1 / -1;
  line-height: 2;
}

.image-result-container {
  width: 100%;
  height: auto;
  overflow: hidden;
  border-radius: 1vmin;
  background: white;
  display: flex;
  flex-direction: column;
}

.image-result {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  cursor: pointer;
  border-radius: 1vmin 1vmin 0 0;
  display: block;
}

.photographer-name {
  font-size: 1.2vmin;
  text-transform: uppercase;
  padding: 1vmin;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0 0 1vmin 1vmin;
}

.photographer-name a {
  text-decoration: underline;
  color: #3498db;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  margin-top: 4vh;
}

.pagination-button {
  margin: 0 5px;
  padding: 10px 15px;
  border: none;
  background-color: #3498db;
  color: white;
  cursor: pointer;
  border-radius: 5px;
}

.pagination-button.active {
  background-color: #2980b9;
}

.pagination-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

#cancelButton {
  margin-top: 5vh;
  margin-bottom: 2.5vh;
}

/* -------------------------------------------------------------------------- */
/*                              RESPONSIVE DESIGN                            */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .image-library-overlay {
    min-width: auto;
    max-width: 95vw;
  }

  .image-library-results {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5vmin;
  }

  .image-library-search {
    font-size: 2.5vmin;
    padding: 2vmin;
  }
}

@media (max-width: 480px) {
  .image-library-results {
    grid-template-columns: 1fr;
    gap: 1vmin;
  }

  .pagination-button {
    padding: 1.5vmin;
    font-size: 1.75vmin;
  }
}
