/* Container design */
.custom-dropzone,
.image-dropzone {
  border: none;
  background-color: #ecf0f4;
  padding: 1rem;
  /* min-height: auto; */
  text-align: center;
  border-radius: var(--mt-border__radius);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.input-with-clear-button {
  display: flex;
  align-items: center;
  border-color: #dadfe3;
  border-style: solid;
  border-width: var(--mt-input__border-width);
  border-radius: var(--mt-border__radius);
  padding: 12px 0px 12px 22px;
  transition: 0.4s;
  background-color: var(--mt-input__background-color);

}

.input-with-clear-button:has(input:disabled) {
  background-color: #dadfe3;
}

.input-with-clear-button:not(:has(input:disabled)):hover {
  border-color: #1d2128;
  box-shadow: 0px 4px 8px 0px var(--mt-input__box-shadow);
}

.input-with-clear-button input {
  border: 0;
  padding: 0;
  min-height: auto;
  height: auto;
}

.input-with-clear-button .clear-button {
  cursor: pointer;
  display: block;
  text-align: center;
  cursor: pointer;
  padding: 0 1em;
}

/* Hover effect */
.custom-dropzone:hover,
.image-dropzone:hover {
  background-color: #e9ecef;
}

/* Drag message */
.custom-dropzone .dz-message,
.image-dropzone .dz-message {
  font-size: 16px;
  color: #7c818b;
  border: 2px dashed #dadfe3;
  margin: 1em;
  padding: 0.5em;
}

.file-upload .or-div {
  font-size: 0.75em;
  font-weight: bold;
  display: block;
  padding: 0 0.5em
}

.custom-dropzone .browse,
.image-dropzone .browse {
  text-decoration: underline;
  color: #0073aa;
  cursor: pointer;
}

/* Remove default Dropzone previews */
#imageDropzone .dz-preview {
  display: none;
}

#google_doc_submit i.fa-spinner {
  margin-left: 8px;
}

.google_doc_url {
  width: 100%;
  padding: 10px;
}
.google_doc_submit {
  margin-top: 10px;
}
.or-divider {
  text-align: center;
}
.or-divider-text {
  font-weight: bold;
  color: #555;
}

.extracted-links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.extracted-links-list h4 small {
  font-weight: normal;
}

.extracted-link-row {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  align-items: center;
  padding: 15px;
}

.extracted-link-row.exceeds-limit {
  /* color: red; */
}

.image-item {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #ccc;
  background: #fafafa;
}

.motta-button--blue,
.motta-button--blue:hover {
  background-color: #4166E1;
}

span.edit-link {
  padding-right: 10px;
}

.external-image-trash {
  display: none;
  /* position: absolute; */
  /* top: 50%; */
  /* left: 50%; */
  /* transform: translate(-50%, -50%); */
  width: 30px;
  height: 30px;
  /* background: #fff; */
  /* border-radius: 50%; */
  /* box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  /* z-index: 2; */
  /* border: 1px solid #ccc; */
  color: #e74c3c;
  fill: #e74c3c;
}

.external-image-preview-wrapper:hover .external-image-trash {
  display: flex;
}
.external-image-preview-wrapper:hover .external-image-preview-img {
  opacity: 0.5;
}

/* #imageDropzone {
  position: relative;
  min-height: 80px;
  height: 100px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
} */

/* #imageDropzone .dz-fileinfo-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 16px;
  color: #333;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  pointer-events: none;
} */

.external-image-fileinfo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #333;
  margin-top: 8px;
  margin-bottom: 8px;
  width: 100%;
  text-align: center;
}

/* --- Custom two-column Dropzone preview for #docUploadDropzone --- */
#docUploadDropzone .dz-preview.doc-preview-split {
  display: flex !important;
  flex-direction: row;
  align-items: stretch;
  background: #fff;
  border-radius: 8px;
  margin: 10px 0;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #e0e4ea;
  min-height: 80px;
  width: 100%;
}

#docUploadDropzone .dz-left,
#docUploadDropzone .dz-right {
  background: #f8fafd;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 20px;
}

#docUploadDropzone .dz-left {
  flex:1;
  align-items: flex-start;
}
#docUploadDropzone .dz-filename {
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
  word-break: break-all;
}
#docUploadDropzone .dz-size {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
}
#docUploadDropzone .dz-remove {
  color: #e74c3c;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  margin-bottom: 8px;
}

#docUploadDropzone .dz-preview .dz-progress {
  width: 100%;
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  margin: 8px 0;
  overflow: hidden;
  left:0; 
  right:0;
  position: static;
}
#docUploadDropzone .dz-upload {
  display: block;
  height: 100%;
  background: #27ae60; /* Green */
  border-radius: 3px;
  transition: width 0.3s;
}
#docUploadDropzone .dz-success-mark {
  color: #27ae60;
  font-size: 18px;
  margin-top: 8px;
}
#docUploadDropzone .dz-error-mark {
  color: #e74c3c;
  font-size: 18px;
  margin-top: 8px;
}
#docUploadDropzone .dz-error-message {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 4px;
}
#docUploadDropzone .dz-right {
  align-items: stretch;
}
#docUploadDropzone .dz-progress {
  width: 100%;
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  margin: 8px 0 0 0;
  overflow: hidden;
}
#docUploadDropzone .dz-remove-trash-wrapper {
  display: none;
  justify-content: center;
  align-items: center;
}
#docUploadDropzone .dz-remove-trash {
  display: none;
  cursor: pointer;
  border-radius: 50%;
  /* background: #fff; */
  /* box-shadow: 0 1px 4px rgba(0,0,0,0.10); */
  /* border: 1px solid #e0e4ea; */
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s;
  position: static;
  transform: none;
}
#docUploadDropzone .dz-remove-trash svg {
  width: 25px;
  height: 25px;
  color: #e74c3c;
  display: block;
  margin: 0 auto;
  cursor: pointer;
}

.external-image-input {
  display: flex;
  gap: 1em;
}

.external-image-input .image_url_wrap {
  flex: 2 1;
}
.external-image-input .external-image-preview-col {
  flex: 1 0.5;
  min-width: 200px;
  background: var(--image-container-bg);
  border: 2px dashed var(--file-border-color);
  border-radius: var(--file-rounded);
  min-height: 150px;
}

.external-image-input .external-image-preview-col:not(:empty) {
  background: transparent;
  border: 0 none;
  display: flex;
  align-items: center;
  justify-content: center;

}

.wbcom-woo-ques-description p {
  margin: 0;
  font-size: 0.875em;
  color: var(--file-color);
}

/* :root{
  --file-container-bg:  #ecf0f4;
  --file-container-bg-hover: #e9ecef;
  --file-bg: #dadfe3;
  --file-border-color: #606060;
  --file-rounded: var(--mt-border__radius);
  --file-color: #7c818b;;
  --table-border-color: #dbdbdb;
  --delete-button-bg: #f53636;
  --delete-button-color: #ffffff;
  --font-size: 0.875em;
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --shadow: 0px 8px 15px -8px rgba(0, 0, 0, 0.5);
} */

:root {
  --file-container-bg:        #e3ecf9; /* slightly darker outer layout */
  --file-container-bg-hover:  #d8e4f6; /* hover effect slightly more contrast */
  --file-bg:                  #f2f6fd; /* inner drop zone (lighter) */
  --file-border-color:        #a6bcd8; /* gentle border */
  --file-rounded:             var(--mt-border__radius);
  --file-color:               #4a6b8a; /* contrast for file text */
  --table-border-color:       #d0dcea;
  --delete-button-bg:         #f53636;
  --delete-button-color:      #ffffff;
  --font-size:                0.875em;
  --font-family:              'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --shadow:                   0px 8px 15px -8px rgba(0, 0, 0, 0.1); /* soft shadow */
  --image-container-bg:       repeating-conic-gradient(#f2f6fd 0% 25%, #e3ecf9 0% 50%) 
  50% / 20px 20px;
}

.file-container {
  width: 100%;

  .file-upload {
      width: 100%;
      display: flex;
      background-color: var(--file-container-bg);
      border-radius: var(--mt-border__radius);
      /* transition: all 0.3s; */

      &:hover {
          /* box-shadow: var(--shadow); */
          background-color: var(--file-container-bg-hover);
      }

      >div {
          width: 100%;
          background-color: var(--file-bg);
          padding: 1em;
          margin: 1em;
          border-radius: var(--mt-border__radius);
          border: 1px dashed var(--file-border-color);
          text-align: center;
          cursor: pointer;
          color: var(--file-color);

          >i {
              font-size: 2.125em;
              /* color: var(--file-color); */
          }
      }
  }

  >table {
      width: 100%;
      border-collapse: collapse;
      font-size: var(--font-size);
      margin-top: 20px;

      & th,
      td {
          border-bottom: 1px solid var(--table-border-color);
          padding: 8px;
          text-align: left;
      }

      >tbody {
          >tr {
              >td {
                  &:nth-child(1) {
                      font-weight: bold;
                  }

                  &:nth-child(2) {
                      white-space: nowrap;
                      text-overflow: ellipsis;
                      overflow: hidden;
                      max-width: 1px;
                  }

                  >img {
                      border-radius: 5px;
                      box-shadow: var(--shadow);
                  }

                  &.no-file {
                      text-align: center;
                      font-weight: normal;
                  }

                  > i{
                      font-size: 1.125em;
                  }
              }
          }
      }

      & button {
          color: var(--delete-button-bg);
          min-width: auto;
          width: 30px;
          height: 30px;
          border: none;
          border-radius: 50%;
          display: flex;
          justify-content: center;
          align-items: center;
          cursor: pointer;

          &:hover {
              box-shadow: var(--shadow);
          }

          >i {
              font-size: 1.125em;
          }
      }
  }
}

.file-container.dragover {
  background-color: #d8e4f6;
  /* Slightly darker than --file-container-bg */
  border-color: #4a90e2;
  position: relative;
  /* Soft glow */
}

.file-container.dragover > .file-upload {
  /* Bright blue highlight */
  border-width: 3px;
  border-color: rgba(74, 144, 226, 0.3);
}

.file-container.dragover > .file-upload  {
  opacity: 0;
}

.file-container.dragover::after {
  content: "Drop files here";
  color: #4a90e2;
  font-weight: bold;
  font-size: 1rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.parent-div {
  width: 100%;

  >h1 {
    color: #2b2b2b;
    padding-bottom: 20px;
  }
}

/* Loading and Processing Styles */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: var(--mt-border__radius);
  margin: 10px 0;
  color: #6c757d;
  font-size: 14px;
}

.loading-indicator i.fa-spinner {
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Processing state for input fields */
.input-with-clear-button.processing {
  background-color: #f8f9fa;
  border-color: #007cba;
  position: relative;
}

/* Processing overlay for file containers */
.file-container.processing {
  position: relative;
  opacity: 0.7;
  pointer-events: none;
}

.file-container.processing::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 10;
  border-radius: var(--mt-border__radius);
}

.file-container.processing::after {
  content: "Processing...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  background: #007cba;
  color: white;
  padding: 8px 16px;
  border-radius: var(--mt-border__radius);
  font-size: 14px;
  font-weight: 500;
}

/* Save button loader */
.save-loader {
  display: inline-flex;
  align-items: center;
  color: #6c757d;
  font-size: 14px;
}

.save-loader i.fa-spinner {
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

/* Table processing state */
.file-container table.processing {
  opacity: 0.6;
  pointer-events: none;
}

.file-status.processing {
  color: #007cba;
  font-weight: 500;
}

.file-status.processing::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid #e9ecef;
  border-top: 2px solid #007cba;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

/* Document links output processing */
#doc-links-output.processing {
  background-color: #f8f9fa;
  border: 1px dashed #dee2e6;
  padding: 20px;
  text-align: center;
  border-radius: var(--mt-border__radius);
}

/* Pulse animation for processing elements */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.processing-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Disabled state improvements */
.input-with-clear-button:has(input:disabled) {
  background-color: #f8f9fa;
  border-color: #dee2e6;
  opacity: 0.65;
}

.input-with-clear-button:has(input:disabled) input {
  background-color: transparent;
  color: #6c757d;
}

/* Button loading state */
.motta-button.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.motta-button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Link Group Styles */
.extracted-link-group {
  margin-bottom: 20px;
  padding: 20px;
  border-radius: var(--mt-border__radius);
  border: 1px solid #e0e4ea;
  background: #fff;
}

.link-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #f0f0f0;
}

.link-group-header h5 {
  margin: 0;
}

.link-inputs-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.link-input-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.link-input-group .link-anchor-display {
  color: #1d2128;
  font-weight: 500;
}

.link-text-display.url-display {
  color: #007cba;
  text-decoration: none;
}

.link-text-display.url-display:hover {
  text-decoration: underline;
}

.link-input-label {
  font-weight: 500;
  font-size: 14px;
  color: #34495e;
  margin: 0;
  white-space: nowrap;
  min-width: 90px;
  text-align: right;
}

.link-anchor-input,
.link-url-input {
  /* padding: 8px 12px; */
  border: 1px solid #dadfe3;
  border-radius: var(--mt-border__radius);
  font-size: 13px;
  line-height: 1.3;
  background-color: #f8f9fa;
  color: #2c3e50;
  transition: all 0.3s ease;
  /* max-width: 400px; */
  width: 100%;
  height: auto !important;
}

.link-anchor-input:focus,
.link-url-input:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.link-anchor-input.editing,
.link-url-input.editing {
  background-color: #fff;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.link-anchor-input[readonly],
.link-url-input[readonly] {
  cursor: default;
  background-color: #f8f9fa;
}

.link-anchor-input[readonly]:hover,
.link-url-input[readonly]:hover {
  border-color: #bdc3c7;
}

/* Success and danger states for link groups */
.extracted-link-group.motta-alert--success {
  border-left: 4px solid #27ae60;
  background-color: #f8fff9;
}

.extracted-link-group.motta-alert--danger {
  border-left: 4px solid #e74c3c;
  background-color: #fff8f8;
}

.extracted-link-group.motta-alert--success .link-group-header h4 {
  color: #27ae60;
}

.extracted-link-group.motta-alert--danger .link-group-header h4 {
  color: #e74c3c;
}

.extracted-link-group .link-group-header button.motta-alert__dismiss {
  position: static;
}

/* Edit actions styling */
.edit-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* .edit-actions i {
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
} */

/* .edit-actions i:hover {
  background-color: rgba(0, 0, 0, 0.1);
} */

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .link-inputs-wrapper {
    gap: 12px;
  }
  
  .link-group-header {
    flex-direction: column;
    align-items: space-between;
    gap: 10px;
  }
  
  .link-group-header h4 {
    font-size: 14px;
  }
  
  .link-anchor-input,
  .link-url-input,
  .link-text-display {
    max-width: 100%;
  }
}

/* Save button disabled state */
#save-requirement-btn:disabled,
#save-requirement-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  background-color: #dadfe3 !important;
  color: #999 !important;
  border-color: #dadfe3 !important;
}

#save-requirement-btn:disabled:hover,
#save-requirement-btn.disabled:hover {
  background-color: #dadfe3 !important;
  color: #999 !important;
  border-color: #dadfe3 !important;
  transform: none;
  box-shadow: none;
}