.machine_action_buttons {
  position: absolute;
  top: 3vh;
  left: 11.5vh;
  display: none;
  gap: 1.7vh;
  z-index: 5;
}

.machine_action_buttons.admin-active {
  display: flex;
}

.machine_btn_save {
  padding: 0.85vh 1.7vh;
  width: 11.9vh;
  top: 10vh;
  background: var(--green);
  color: var(--font);
  border: none;
  border-radius: 0.68vh;
  font-size: 1.87vh;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.machine_btn_save:hover {
  background: #6ee04f;
  transform: translateY(-1px);
}

.machine_btn_cancel {
  padding: 0.85vh 1.7vh;
  width: 11.9vh;
  background: var(--red);
  color: var(--font);
  border: none;
  border-radius: 0.68vh;
  font-size: 1.87vh;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.machine_btn_cancel:hover {
  background: #ff4d3a;
  transform: translateY(-1px);
}

#used_machines_vin_new_dropdown {
  position: fixed;
  background: rgba(0, 0, 0, 0.95);
  font-size: 1.3vh;
  display: none;
  z-index: 9999;
  max-height: 30vh;
  overflow-y: auto;
  border: 1px solid var(--body_border);
  border-radius: 0 0 0.5vh 0.5vh;
  line-height: 1;
}

#used_machines_vin_new_dropdown div {
  padding: 0.8vh 1vh !important;
  color: #9a9a9a;
  cursor: pointer;
  text-align: left;
  line-height: 1.5vh;
}

#used_machines_vin_new_dropdown div:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

#used_machines_vin_new_dropdown .match {
  color: #fff;
  font-weight: bold;
}

#used_machines_vin_new_dropdown .no-match {
  color: red;
  cursor: default;
  text-align: center;
}

#used_machines_vin_new_dropdown .edit {
  color: #ffb340;
  font-weight: bold;
}

.vin-not-found {
  animation: blinkRed 0.6s ease-in-out 3;
}

@keyframes blinkRed {
  0%, 100% { 
    background-color: rgba(206, 59, 40, 0.3);
  }
  50% { 
    background-color: transparent;
  }
}

.used_machines_frame input,
.used_machines_frame textarea {
  background: transparent;
  border: none;
  outline: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  text-align: inherit;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  resize: none;
}

.used_machines_frame input::placeholder,
.used_machines_frame textarea::placeholder {
  color: inherit;
  opacity: 0.6;
}

#used_machines_vin_new {
  text-transform: uppercase;
}

.upload_overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: auto;
  z-index: 1;
}

.upload_overlay:hover {
  background: rgba(0, 0, 0, 0.2);
}

.upload_icon {
  font-size: 3vh;
  margin-bottom: 3vh;
  opacity: 0.6;
}

.upload_text {
  font-size: 1.5vh;
  color: var(--font);
  opacity: 0.6;
}

.image_tools_overlay {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, 50%);
  z-index: 2;
  pointer-events: none;
}

#image_tools {
  display: flex;
  flex-direction: column;
  gap: 1.5vh;
  align-items: center;
  pointer-events: auto;
}

#image_arrow_controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.5vh;
  width: 18vh;
}

.image_arrow {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.4vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2vh;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.image_arrow:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--font_dark2);
}

#image_zoom_controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6vh;
  width: 18vh;
}

#image_zoom_slider {
  width: 100%;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 0.4vh;
  accent-color: var(--font);
  border: 1px solid rgba(255, 255, 255, 0.3);
  height: 2vh;
}

#image_zoom_percent {
  color: var(--font);
  font-size: 1.4vh;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.4vh 0.8vh;
  border-radius: 0.3vh;
  border: 1px solid rgba(255, 255, 255, 0.3);
  text-align: center;
}

#image_change_photo_btn {
  width: 15vh;
  padding: 0.7vh;
  background: var(--black_trans);
  color: var(--font);
  border: none;
  border-radius: 0.5vh;
  font-size: 1.5vh;
  cursor: pointer;
  transition: all 0.2s ease;
}

#image_change_photo_btn:hover {
  background: #3b3b3b98;
  transform: translateY(-1px);
}

.image_hover_overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.used_machines_image:hover .image_hover_overlay {
  background: rgba(0, 0, 0, 0.2);
}

#photo_gallery_overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#photo_gallery_window {
  position: relative;
  width: 60vw;
  height: 60vh;
  background: var(--body);
  border: 2px solid var(--body_border);
  border-radius: 1vh;
  padding: 2vh;
  display: flex;
  flex-direction: column;
}

#photo_gallery_close {
  position: absolute;
  top: 1vh;
  right: 1vh;
  width: 4vh;
  height: 4vh;
  background: var(--red);
  color: var(--font);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5vh;
  cursor: pointer;
  z-index: 10001;
}

#photo_gallery_close:hover {
  background: #ff4d3a;
}

#photo_gallery_grid {
  flex: 1;
  background: var(--body_in);
  border-radius: 0.5vh;
  padding: 1.5vh;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(12vh, auto);
  gap: 1vh;
  overflow-y: auto;
  align-content: start;
}

#photo_gallery_grid::-webkit-scrollbar {
  width: 8px;
}

#photo_gallery_grid::-webkit-scrollbar-track {
  background: var(--color_05);
  border-radius: 10px;
}

#photo_gallery_grid::-webkit-scrollbar-thumb {
  background: var(--color_03);
  border-radius: 10px;
}

#photo_gallery_existing {
  display: contents;
}

.photo_gallery_thumb {
  aspect-ratio: 1.5;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 0.5vh;
  border: 1px solid var(--color_12);
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  filter: grayscale(75%) brightness(0.9);
  opacity: 0.85;
}

.photo_gallery_thumb:hover {
  filter: grayscale(0%) brightness(1);
  opacity: 1;
  border-color: var(--color_14);
  box-shadow:
    -10px 0 10px -4px rgba(255,255,255,0.1),
    10px 0 10px -4px rgba(255,255,255,0.1),
    0 -1px 8px -1px rgba(255,255,255,0.05),
    0 1px 8px -1px rgba(255,255,255,0.05);
}

.photo_gallery_add {
  border: 2px dashed var(--body_border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  filter: none;
  opacity: 1;
}

.photo_gallery_add:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--header);
  box-shadow: none;
}

.photo_gallery_add_icon {
  font-size: 4vh;
  opacity: 0.6;
}

.photo_gallery_add_text {
  font-size: 1.6vh;
  color: var(--font_dark2);
  margin-top: 1vh;
}

.photo_gallery_thumb_number {
  position: absolute;
  top: 0.7vh;
  right: 0.7vh;
  background: rgba(0, 0, 0, 0.8);
  color: var(--color_07);
  padding: 0.4vh 0.9vh;
  border-radius: 0.3vh;
  font-size: 1.6vh;
  line-height: 1;
  font-weight: bold;
  pointer-events: none;
  opacity: 0.6;
}

.photo_gallery_select_overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.photo_gallery_thumb:hover .photo_gallery_select_overlay {
  opacity: 1;
}

.photo_gallery_select_text {
  color: var(--font);
  font-size: 1.6vh;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5vh 1vh;
  border-radius: 0.5vh;
}

.used_machines_frame.collapsed {
    height: 10vh !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: height 0.3s ease;
}

.used_machines_frame.collapsed .used_machines_model {
    position: relative;
    top: 0;
    height: 6vh;
    font-size: 2.7vh;
    line-height: 6vh;
}

.used_machines_frame.collapsed .used_machines_vin {
    position: relative;
    top: 0;
    height: 4.5vh;
    font-size: 2.0vh;
    line-height: 4.5vh;
}

.used_machines_frame.collapsed .used_machines_image,
.used_machines_frame.collapsed .used_machines_warranty,
.used_machines_frame.collapsed .used_machines_remark {
    display: none !important;
}

.used_machines_frame {
    transition: height 0.3s ease;
}