/**
 * AIZ Uploader - Image Upload Related CSS
 * This file contains all image upload related styles including Uppy integration,
 * failure report styling, and uploader modal styles.
 */

/* ========================================
   Uppy Dashboard Scrollbar Styles
   ======================================== */

.uppy-Dashboard-files::-webkit-scrollbar {
  width: 4px;
  background: rgba(24, 28, 41, 0.08);
  border-radius: 3px;
}

.uppy-Dashboard-files::-webkit-scrollbar-track {
  background: transparent;
}

.uppy-Dashboard-files::-webkit-scrollbar-thumb {
  background: rgba(24, 28, 41, 0.1);
  border-radius: 3px;
}

.uppy-Dashboard-files {
  scrollbar-color: rgba(24, 28, 41, 0.08);
  scrollbar-width: thin;
}

/* ========================================
   Uppy Root and Dashboard Styles
   ======================================== */

.uppy-Root *:focus {
  outline: none !important;
}

.uppy-size--md .uppy-DashboardItem-progressIndicator,
.uppy-DashboardContent-bar .uppy-DashboardContent-back {
  visibility: hidden;
  opacity: 0;
}

.uppy-Dashboard-inner {
  width: 100% !important;
  height: 100% !important;
}

.uppy-Root {
  height: 100% !important;
}

.uppy-DashboardContent-addMore svg {
  margin-bottom: 0;
}

/* ========================================
   File Card Styles
   ======================================== */

.card-file {
  padding: 8px;
  position: relative;
  border-color: rgb(223, 224, 228);
  transition: all 0.2s ease-in-out;
  margin-bottom: 20px;
}

.card-file .card-body h6 {
  font-size: 0.8rem;
  margin-bottom: 0;
}

.card-file .card-body p {
  margin-bottom: 0;
  font-size: 9px;
  color: #8392a5;
}

.card-file .card-file-thumb {
  height: 120px;
  background-color: #f5f6fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-file .card-body {
  padding: 10px 0 0;
}

.card-file .card-file-thumb i {
  font-size: 50px;
  color: #b3becc;
}

/* ========================================
   Uploader Backdrop and Toggle
   ======================================== */

.aiz-uploader-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.2);
}

[data-toggle="aizuploader"] {
  cursor: pointer;
}

/* ========================================
   Uploader Container Styles
   ======================================== */

.aiz-uploader-all {
  margin-left: -10px;
  margin-right: -10px;
  overflow-y: auto;
  height: calc(100vh - 303px);
}

.uppy-Dashboard-files {
  max-height: calc(100vh - 363px);
}

/* ========================================
   Tab Visibility - Select File Tab
   ======================================== */

/* Hide Uppy Dashboard in Select File tab - More specific selectors */
#aiz-select-file .uppy-Dashboard,
#aiz-select-file .uppy-StatusBar,
#aiz-select-file .uppy-Dashboard-inner,
#aiz-select-file .uppy-Dashboard-files,
#aiz-select-file .uppy-DashboardContent,
#aiz-select-file #aiz-upload-files {
  display: none !important;
  visibility: hidden !important;
}

/* Hide Upload New tab's upload area when Select File tab is active */
#aiz-select-file.active ~ #aiz-upload-new #aiz-upload-files,
#aiz-select-file.active ~ #aiz-upload-new .uppy-Dashboard,
#aiz-select-file.active ~ #aiz-upload-new .uppy-StatusBar {
  display: none !important;
  visibility: hidden !important;
}

/* Hide Uppy elements when Select File tab is active */
#aizUploaderModal #aiz-select-file.active ~ * .uppy-Dashboard,
#aizUploaderModal #aiz-select-file.active .uppy-Dashboard,
#aizUploaderModal #aiz-select-file.active ~ * .uppy-StatusBar,
#aizUploaderModal #aiz-select-file.active .uppy-StatusBar {
  display: none !important;
  visibility: hidden !important;
}

/* Ensure Upload New tab content is hidden when not active */
#aiz-upload-new:not(.active) #aiz-upload-files,
#aiz-upload-new:not(.active) .uppy-Dashboard,
#aiz-upload-new:not(.active) .uppy-StatusBar {
  display: none !important;
}

/* ========================================
   Upload New Tab Styles
   ======================================== */

/* Move Uppy progress bar and status to top for better visibility - Only in Upload New tab */
#aiz-upload-new .uppy-Dashboard {
  display: flex;
  flex-direction: column;
}

#aiz-upload-new .uppy-Dashboard-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Status bar at top - Only in Upload New tab */
#aiz-upload-new .uppy-StatusBar {
  order: -1;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  background: #fff !important;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 10px;
  width: 100%;
}

/* Progress bar styling */
#aiz-upload-new .uppy-StatusBar-progress {
  background: #f0f0f0;
}

#aiz-upload-new .uppy-StatusBar-progressBar {
  background: #007bff;
  height: 4px;
}

/* Complete message at top */
#aiz-upload-new .uppy-StatusBar-content {
  padding: 10px 15px;
  font-size: 14px;
}

/* Dashboard files area - scrollable */
#aiz-upload-new .uppy-Dashboard-files {
  order: 1;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Upload complete indicator */
#aiz-upload-new .uppy-StatusBar.is-complete {
  background: #d4edda !important;
  border-color: #c3e6cb;
  color: #155724;
}

#aiz-upload-new .uppy-StatusBar.is-error {
  background: #f8d7da !important;
  border-color: #f5c6cb;
  color: #721c24;
}

/* Ensure status bar is always visible at top when not waiting */
#aiz-upload-new .uppy-StatusBar.is-waiting {
  display: none;
}

#aiz-upload-new .uppy-StatusBar:not(.is-waiting) {
  display: block !important;
  visibility: visible !important;
}

/* Only apply flexbox layout to Upload New tab, not Select File tab */
#aiz-upload-new {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: scroll;
}

/* Hide Upload New tab when not active */
#aiz-upload-new:not(.active) {
  display: none !important;
}

/* Show Upload New tab when active */
#aiz-upload-new.active {
  display: flex !important;
}

/* ========================================
   Select File Tab Styles
   ======================================== */

/* Ensure Select File tab maintains normal layout */
#aiz-select-file {
  display: block;
  overflow: visible;
}

/* Hide Select File tab when not active */
#aiz-select-file:not(.active) {
  display: none !important;
}

/* Show Select File tab when active */
#aiz-select-file.active {
  display: block !important;
}

/* ========================================
   File Box Styles
   ======================================== */

.aiz-file-box-wrap {
  padding: 0 10px;
  width: 50%;
  float: left;
}

.aiz-file-box-wrap[aria-hidden="true"] {
  display: none;
}

.aiz-file-box {
  position: relative;
}

.aiz-file-box:before {
  content: "";
  display: block;
  padding-top: 100%;
}

.aiz-file-box .dropdown-file {
  position: absolute;
  top: 6px;
  right: 9px;
  z-index: 1;
}

.aiz-file-box .dropdown-file > a {
  color: #5a5a5a;
  font-size: 22px;
  background: #f5f6fa;
  cursor: pointer;
}

.aiz-file-box .card-file {
  cursor: pointer;
  overflow: hidden;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 1;
}

.aiz-file-box .card-file .card-file-thumb {
  position: absolute;
  width: calc(100% - 16px);
  top: 8px;
  left: 8px;
  height: calc(100% - 55px);
}

.aiz-file-box .card-file .card-body {
  position: absolute;
  width: calc(100% - 16px);
  bottom: 5px;
  left: 8px;
}

[data-selected="true"] .aiz-uploader-select {
  border-color: #007bff;
  background: rgba(0, 123, 255, 0.05);
}

/* ========================================
   Modal Styles
   ======================================== */

.modal-adaptive {
  height: calc(100vh - 60px);
  margin: 30px auto !important;
}

/* ========================================
   File Preview Styles
   ======================================== */

/*File preview + remove*/
.file-preview-item h6 {
  font-size: 13px;
  margin-bottom: 0;
}

.file-preview-item {
  padding: 8px;
  border: 1px solid #ebedf2;
  border-radius: 0.25rem;
}

.file-preview-item p {
  font-size: 10px;
  margin-bottom: 0;
  color: var(--secondary);
}

.file-preview-item .thumb {
  -ms-flex: 0 0 50px;
  flex: 0 0 50px;
  max-width: 50px;
  height: 45px;
  width: 50px;
  text-align: center;
  background: #f1f2f4;
  font-size: 20px;
  color: #92969b;
  border-radius: 0.25rem;
  overflow: hidden;
}

.file-preview-item .remove {
  -ms-flex: 0 0 52px;
  flex: 0 0 52px;
  max-width: 52px;
  width: 52px;
}

.file-preview-item .body {
  min-width: 0;
}

.file-preview.box a {
  color: inherit;
}

.file-preview.box:after {
  content: "";
  clear: both;
  display: table;
}

.file-preview.box .file-preview-item {
  width: 160px;
  float: left;
  margin-right: 0.5rem;
  padding: 0;
  display: block !important;
  position: relative;
}

.file-preview.box .thumb {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 120px;
  border-radius: 0;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

.file-preview.box.sm .file-preview-item {
  width: 100px;
}

.file-preview.box.sm .thumb {
  height: 52px;
}

.file-preview.box .body {
  padding: 0;
  padding: 8px 8px 2px;
}

.file-preview.box .remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: auto;
  max-width: 100%;
}

.file-preview.box .remove .btn {
  padding: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #eaeaea;
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (min-width: 576px) {
  /*sm*/
  .modal-adaptive {
    max-width: 540px;
  }

  .aiz-file-box-wrap {
    width: 33.3333%;
  }
}

@media (min-width: 768px) {
  /*md*/
  .modal-adaptive {
    max-width: 720px;
  }

  .aiz-file-box-wrap {
    width: 25%;
  }

  .modal-md {
    max-width: 600px;
  }
}

@media (min-width: 992px) {
  /*lg*/
  .modal-adaptive {
    max-width: 960px;
  }

  .aiz-file-box-wrap {
    width: 20%;
  }
}

@media (min-width: 1200px) {
  /*xl*/
  .modal-adaptive {
    max-width: 1140px;
  }

  .aiz-file-box-wrap {
    width: 16.66666%;
  }
}

@media (min-width: 1500px) {
  /*xxl*/
  .modal-adaptive {
    max-width: 1400px;
  }
}

@media (max-width: 767px) {
  .aiz-uploader-search i {
    font-size: 23px;
    cursor: pointer;
    padding: 4px;
    margin-right: 5px;
    position: relative;
    z-index: 2;
    top: 3px;
  }

  .aiz-uploader-search input {
    position: absolute;
    z-index: 1;
    top: 0;
    right: 5px;
    left: 5px;
    width: calc(100% - 10px);
    height: 100%;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s;
    -webkit-transition: all 0.3s;
  }

  .aiz-uploader-search.open input {
    visibility: visible;
    opacity: 1;
  }
}

/* ========================================
   Search Icon Styles
   ======================================== */

.search-icon {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 32px;
  overflow: hidden;
  white-space: nowrap;
  color: transparent;
  z-index: 3;
}

.search-icon:hover {
  color: transparent;
}

.search-icon::before,
.search-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

