/* Media UI */
.media_file_input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Upload container */
.media_uploader {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 10px 0;
}

/* Dropzone */
.media_dropzone {
  max-width: 200px;
  border: 2px dashed #dfedf9;
  border-radius: 4px;
  padding: 10px;
  text-align: center;
  color: #3d5988;
  cursor: pointer;
}

/* Drag state */
.media_dropzone.dragover {
  border-color: #bbd2e9;
  background: #fafafa;
}

/* Toolbar */
.media_toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Preview grid */
.media_grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

/* Preview item */
.media_item {
  position: relative;
  border: 2px solid #6ea2cf;
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
}

/* Preview image */
.media_thumb {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}

/* Filename */
.media_filename {
  display: block;
  font-size: 11px;
  padding: 8px 6px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Add tile (+) */
.media_add_tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #bdd4e9;
  border-radius: 4px;
  height: 150px;
  background: #ffffff;
  color: #3d5988;
  cursor: pointer;
}

.media_add_tile:hover {
  border-color: #999;
  color: #666;
}

.media_add_icon {
  font-size: 32px;
  line-height: 1;
}

/* Info messages */
.media_info {
  font-size: 12px;
  color: #666;
  min-height: 1em;
}

.media_info--error {
  color: #b00;
}

/* Delete button */
.media_actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 6px;
}

.media_actions button {
  border: none;
  background: rgb(186 47 47 / 60%);
  color: #fff;
  font-size: 22px;
  border-radius: 30%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.media_actions button:hover {
  background: rgb(186 47 47 / 100%);
  scale: 1.1;
}

.media_actions button:active {
  scale: 0.9;
}

/* Lightbox background */
.media_lightbox_backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.media_lightbox_backdrop.open {
  display: flex;
}

/* Lightbox content */
.media_lightbox {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.media_lightbox img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
}

/* Lightbox close button */
.media_lightbox_close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 18px;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}