/* ==========================================
   IMAGE MANAGER
========================================== */

.image-manager-content {
  padding-bottom: 80px;
}


/* ==========================================
   STATS
========================================== */

.image-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 22px;
}

.image-stat {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 100px;
  padding: 20px;
  background: #151515;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 7px;
}

.image-stat-icon {
  width: 45px;
  height: 45px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(216,180,122,.25);
  border-radius: 50%;

  color: #d8b47a;
  font-size: 16px;
}

.image-stat span {
  display: block;
  margin-bottom: 6px;

  color: #777;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.image-stat strong {
  color: #f5f5f5;
  font-size: 25px;
  font-weight: 500;
}


/* ==========================================
   TOOLBAR
========================================== */

.image-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  padding: 15px;

  margin-bottom: 30px;
}

.image-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.image-filter {
  padding: 9px 14px;

  border: 1px solid rgba(255,255,255,.08);
  border-radius: 4px;

  background: transparent;
  color: #888;

  cursor: pointer;

  font-size: 9px;
  letter-spacing: .5px;

  transition: .2s;
}

.image-filter:hover {
  color: #ddd;
  border-color: rgba(255,255,255,.2);
}

.image-filter.active {
  border-color: #d8b47a;
  background: #d8b47a;
  color: #111;
}


.image-tools {
  display: flex;
  align-items: center;
  gap: 9px;
}


/* SEARCH */

.image-search {
  display: flex;
  align-items: center;
  gap: 8px;

  width: 230px;
  height: 38px;

  padding: 0 11px;

  border: 1px solid rgba(255,255,255,.08);
  border-radius: 4px;

  background: #101010;
}

.image-search span {
  color: #666;
  font-size: 16px;
}

.image-search input {
  width: 100%;
  height: 100%;

  margin: 0;
  padding: 0;

  border: 0;
  outline: 0;

  background: transparent;
  color: white;

  font-size: 10px;
}

.image-search input::placeholder {
  color: #555;
}


.upload-btn {
  height: 38px;

  padding: 0 15px;

  border: 1px solid #d8b47a;
  border-radius: 4px;

  background: #d8b47a;
  color: #111;

  cursor: pointer;

  font-size: 9px;
  letter-spacing: .3px;

  transition: .2s;
}

.upload-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}


/* ==========================================
   RESULT HEADER
========================================== */

.image-result-header {
  display: flex;
  align-items: end;
  justify-content: space-between;

  margin-bottom: 18px;
}

.image-result-header h2 {
  margin: 5px 0 0;
}

#imageCountLabel {
  color: #666;
  font-size: 10px;
}


/* ==========================================
   IMAGE GRID
========================================== */

.image-grid {
  display: grid;

  grid-template-columns:
    repeat(auto-fill, minmax(245px, 1fr));

  gap: 16px;
}


/* ==========================================
   IMAGE CARD
========================================== */

.image-card {
  overflow: hidden;

  background: #151515;

  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;

  transition:
    transform .25s ease,
    border-color .25s ease,
    box-shadow .25s ease;
}

.image-card:hover {
  transform: translateY(-3px);

  border-color:
    rgba(216,180,122,.3);

  box-shadow:
    0 18px 50px rgba(0,0,0,.28);
}


/* IMAGE */

.image-card-media {
  position: relative;

  width: 100%;
  height: 220px;

  overflow: hidden;

  background: #101010;
}

.image-card-media img {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;

  transition:
    transform .5s cubic-bezier(.2,.7,.2,1);
}

.image-card:hover
.image-card-media img {
  transform: scale(1.04);
}


/* OVERLAY */

.image-card-overlay {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 8px;

  background: rgba(0,0,0,.55);

  opacity: 0;

  transition: opacity .25s ease;
}

.image-card:hover
.image-card-overlay {
  opacity: 1;
}


.image-overlay-btn {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;

  background: rgba(0,0,0,.5);
  color: white;

  cursor: pointer;

  font-size: 13px;

  transition: .2s;
}

.image-overlay-btn:hover {
  border-color: #d8b47a;
  color: #d8b47a;
}

.image-overlay-btn.delete:hover {
  border-color: #e87979;
  color: #e87979;
}


/* CARD CONTENT */

.image-card-content {
  padding: 15px;
}

.image-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  margin-bottom: 9px;
}


.image-type {
  display: inline-flex;
  align-items: center;

  padding: 5px 7px;

  border: 1px solid rgba(216,180,122,.2);
  border-radius: 3px;

  color: #d8b47a;

  font-size: 7px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.image-format {
  color: #555;
  font-size: 8px;
  text-transform: uppercase;
}


.image-public-id {
  overflow: hidden;

  margin-bottom: 11px;

  color: #aaa;

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;

  font-size: 9px;

  text-overflow: ellipsis;
  white-space: nowrap;
}


.image-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding-top: 10px;

  border-top:
    1px solid rgba(255,255,255,.06);
}

.image-card-meta span {
  color: #555;
  font-size: 8px;
}


/* ==========================================
   LOADING
========================================== */

.image-loading {
  grid-column: 1 / -1;

  min-height: 350px;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: 14px;

  color: #555;

  font-size: 10px;
}


.loading-spinner {
  width: 28px;
  height: 28px;

  border:
    1px solid rgba(255,255,255,.1);

  border-top-color: #d8b47a;

  border-radius: 50%;

  animation:
    imageSpin .8s linear infinite;
}

@keyframes imageSpin {
  to {
    transform: rotate(360deg);
  }
}


/* ==========================================
   EMPTY
========================================== */

.image-empty {
  grid-column: 1 / -1;

  padding: 90px 20px;

  border: 1px dashed rgba(255,255,255,.08);
  border-radius: 6px;

  text-align: center;
}

.image-empty-icon {
  margin-bottom: 15px;

  color: #444;
  font-size: 30px;
}

.image-empty h3 {
  margin: 0 0 7px;

  color: #aaa;
  font-size: 15px;
  font-weight: 400;
}

.image-empty p {
  margin: 0;

  color: #555;
  font-size: 10px;
}


/* ==========================================
   MODAL
========================================== */

.image-modal {
  position: fixed;
  inset: 0;

  z-index: 5000;

  display: none;

  align-items: center;
  justify-content: center;

  padding: 20px;

  background:
    rgba(0,0,0,.82);

  backdrop-filter:
    blur(10px);
}

.image-modal.open {
  display: flex;
}


.image-modal-card {
  width: min(520px, 100%);
  max-height: 92vh;

  overflow-y: auto;

  padding: 28px;

  border:
    1px solid rgba(255,255,255,.09);

  border-radius: 8px;

  background: #151515;

  box-shadow:
    0 30px 100px rgba(0,0,0,.65);
}


.image-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 28px;
}

.image-modal-header h2 {
  margin: 5px 0 0;
}


.modal-close {
  width: 36px;
  height: 36px;

  flex-shrink: 0;

  border:
    1px solid rgba(255,255,255,.1);

  border-radius: 50%;

  background: transparent;
  color: white;

  cursor: pointer;

  font-size: 21px;

  transition: .2s;
}

.modal-close:hover {
  color: #d8b47a;
  border-color: #d8b47a;
}


/* ==========================================
   UPLOAD FORM
========================================== */

.upload-field {
  margin-bottom: 20px;
}

.upload-field > label:not(.drop-zone) {
  display: block;

  margin-bottom: 8px;

  color: #999;

  font-size: 10px;
  letter-spacing: .5px;
}


.upload-field select {
  width: 100%;
  height: 45px;

  padding: 0 12px;

  border:
    1px solid rgba(255,255,255,.08);

  border-radius: 4px;

  outline: none;

  background: #101010;
  color: white;

  font-size: 11px;
}

.upload-field select:focus {
  border-color: #d8b47a;
}


/* DROP ZONE */

.drop-zone {
  min-height: 160px;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: 7px;

  border:
    1px dashed rgba(255,255,255,.13);

  border-radius: 6px;

  background: #101010;

  cursor: pointer;

  transition: .2s;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: #d8b47a;
  background:
    rgba(216,180,122,.04);
}

.drop-icon {
  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 4px;

  border:
    1px solid rgba(216,180,122,.25);

  border-radius: 50%;

  color: #d8b47a;

  font-size: 18px;
}

.drop-zone strong {
  color: #ccc;
  font-size: 12px;
  font-weight: 400;
}

.drop-zone span {
  color: #555;
  font-size: 9px;
}


/* UPLOAD PREVIEW */

.upload-preview {
  display: flex;
  align-items: center;

  gap: 13px;

  margin-bottom: 20px;
  padding: 10px;

  border:
    1px solid rgba(255,255,255,.07);

  border-radius: 5px;

  background: #101010;
}

.upload-preview.hidden {
  display: none;
}

.upload-preview img {
  width: 65px;
  height: 65px;

  object-fit: cover;

  border-radius: 4px;
}

.upload-preview div {
  min-width: 0;
}

.upload-preview strong {
  display: block;

  overflow: hidden;

  margin-bottom: 5px;

  color: #bbb;

  font-size: 10px;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-preview span {
  color: #555;
  font-size: 9px;
}


/* MESSAGE */

.upload-message {
  min-height: 18px;

  margin-bottom: 5px;

  color: #e87979;

  font-size: 10px;
}

.upload-message.success {
  color: #79d49a;
}


/* ACTIONS */

.upload-actions {
  display: flex;
  justify-content: flex-end;

  gap: 8px;

  padding-top: 18px;

  border-top:
    1px solid rgba(255,255,255,.07);
}

.secondary-btn,
.upload-submit-btn {
  height: 40px;

  padding: 0 17px;

  border-radius: 4px;

  cursor: pointer;

  font-size: 9px;
}

.secondary-btn {
  border:
    1px solid rgba(255,255,255,.09);

  background: transparent;
  color: #999;
}

.secondary-btn:hover {
  color: white;
  border-color: #555;
}

.upload-submit-btn {
  border: 1px solid #d8b47a;

  background: #d8b47a;
  color: #111;
}

.upload-submit-btn:hover {
  filter: brightness(1.08);
}

.upload-submit-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}


/* ==========================================
   PREVIEW MODAL
========================================== */

.preview-modal {
  padding: 30px;
}

.preview-card {
  position: relative;

  width: min(1050px, 100%);
  max-height: 92vh;

  display: grid;

  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);

  overflow: hidden;

  border:
    1px solid rgba(255,255,255,.09);

  border-radius: 8px;

  background: #141414;

  box-shadow:
    0 40px 120px rgba(0,0,0,.7);
}


.preview-close {
  position: absolute;

  top: 15px;
  right: 15px;

  z-index: 3;

  width: 38px;
  height: 38px;

  border:
    1px solid rgba(255,255,255,.15);

  border-radius: 50%;

  background: rgba(0,0,0,.55);
  color: white;

  cursor: pointer;

  font-size: 21px;
}

.preview-close:hover {
  color: #d8b47a;
  border-color: #d8b47a;
}


/* PREVIEW IMAGE */

.preview-image-wrapper {
  min-height: 650px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 35px;

  background: #090909;
}

.preview-image-wrapper img {
  max-width: 100%;
  max-height: 75vh;

  display: block;

  object-fit: contain;
}


/* PREVIEW DETAILS */

.preview-details {
  display: flex;
  flex-direction: column;

  padding: 35px 28px;

  border-left:
    1px solid rgba(255,255,255,.07);
}

.preview-main-info {
  margin-bottom: 35px;
}

.preview-main-info > span {
  display: inline-block;

  margin-bottom: 10px;
  padding: 5px 7px;

  border:
    1px solid rgba(216,180,122,.2);

  border-radius: 3px;

  color: #d8b47a;

  font-size: 7px;

  letter-spacing: 1px;
  text-transform: uppercase;
}

.preview-main-info h2 {
  overflow-wrap: anywhere;

  margin: 0;

  color: #ccc;

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;

  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
}


/* META */

.preview-meta {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 1px;

  margin-bottom: 30px;

  background:
    rgba(255,255,255,.07);

  border:
    1px solid rgba(255,255,255,.07);
}

.preview-meta div {
  padding: 14px;

  background: #111;
}

.preview-meta span {
  display: block;

  margin-bottom: 6px;

  color: #555;

  font-size: 7px;
  letter-spacing: 1px;
}

.preview-meta strong {
  color: #aaa;
  font-size: 10px;
  font-weight: 400;
}


/* URL */

.preview-url {
  margin-bottom: 25px;
}

.preview-url > span {
  display: block;

  margin-bottom: 8px;

  color: #555;

  font-size: 7px;
  letter-spacing: 1px;
}

.preview-url > div {
  display: flex;
}

.preview-url input {
  min-width: 0;
  flex: 1;

  height: 38px;

  margin: 0;

  padding: 0 9px;

  border:
    1px solid rgba(255,255,255,.08);

  border-right: 0;

  border-radius: 4px 0 0 4px;

  outline: none;

  background: #0d0d0d;
  color: #777;

  font-size: 8px;
}

#copyUrlBtn {
  width: 55px;

  border:
    1px solid #d8b47a;

  border-radius: 0 4px 4px 0;

  background: transparent;
  color: #d8b47a;

  cursor: pointer;

  font-size: 8px;
}

#copyUrlBtn:hover {
  background: rgba(216,180,122,.08);
}


/* DELETE */

.preview-delete {
  width: 100%;
  height: 40px;

  margin-top: auto;

  border:
    1px solid rgba(232,121,121,.3);

  border-radius: 4px;

  background: transparent;
  color: #e87979;

  cursor: pointer;

  font-size: 9px;

  transition: .2s;
}

.preview-delete:hover {
  border-color: #e87979;
  background: rgba(232,121,121,.07);
}


/* ==========================================
   RESPONSIVE
========================================== */

@media (max-width: 1100px) {

  .image-stats {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .preview-card {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .preview-image-wrapper {
    min-height: 400px;
  }

  .preview-details {
    border-left: 0;
    border-top:
      1px solid rgba(255,255,255,.07);
  }

}


@media (max-width: 800px) {

  .image-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .image-tools {
    width: 100%;
  }

  .image-search {
    flex: 1;
    width: auto;
  }

  .upload-btn {
    flex-shrink: 0;
  }

}


@media (max-width: 600px) {

  .image-stats {
    grid-template-columns: 1fr;
  }

  .image-filters {
    width: 100%;
  }

  .image-filter {
    flex: 1;
  }

  .image-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .image-search {
    width: 100%;
  }

  .upload-btn {
    width: 100%;
  }

  .image-grid {
    grid-template-columns: 1fr;
  }

  .image-card-media {
    height: 250px;
  }

  .image-modal {
    padding: 10px;
  }

  .image-modal-card {
    padding: 20px;
  }

  .preview-modal {
    padding: 10px;
  }

  .preview-image-wrapper {
    min-height: 300px;
    padding: 20px;
  }

  .preview-details {
    padding: 25px 20px;
  }

  .preview-meta {
    grid-template-columns: 1fr;
  }

}