/* =========================================================
   WIRTZ DRIVE · MIS ARCHIVOS
   ========================================================= */

.drive-page {
  display: flex;
  flex-direction: column;
  gap: 18px;

  width: 100%;
  min-width: 0;
}

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

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

  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 8px 0 16px;

  border-bottom: 1px solid var(--line-strong);
}

.drive-toolbar__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.drive-select {
  min-width: 168px;
  height: 42px;
  padding: 0 36px 0 13px;

  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;

  color: var(--text);

  font: inherit;
  font-size: 13px;
  font-weight: 600;

  background:
    #ffffff;

  cursor: pointer;
}

.drive-select:hover {
  border-color: #8d939d;
}

.drive-select:focus {
  border-color: var(--accent);

  outline: 3px solid rgba(225, 38, 48, 0.09);
}

/* =========================================================
   BREADCRUMB
   ========================================================= */

.drive-breadcrumb {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;

  min-width: 0;

  overflow-x: auto;

  scrollbar-width: none;
}

.drive-breadcrumb::-webkit-scrollbar {
  display: none;
}

.drive-breadcrumb__item {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;

  min-height: 38px;
  padding: 0 10px;

  border: 1px solid transparent;
  border-radius: 8px;

  color: var(--text-muted);

  font-size: 13px;
  font-weight: 650;

  background: transparent;

  transition:
    border-color var(--transition),
    color var(--transition),
    background-color var(--transition);
}

.drive-breadcrumb__item:hover {
  border-color: var(--line-strong);

  color: var(--text);

  background: #ffffff;
}

.drive-breadcrumb__item:last-of-type {
  color: var(--text);
}

.drive-breadcrumb__item svg {
  width: 17px;
  height: 17px;
}

.drive-breadcrumb__separator {
  flex: 0 0 auto;

  width: 14px;
  height: 14px;

  color: var(--text-soft);
}

/* =========================================================
   TABLA
   ========================================================= */

.drive-content {
  width: 100%;
  min-width: 0;

  overflow: hidden;

  border: 1px solid var(--line-strong);
  border-radius: 12px;

  background: #ffffff;
}

.drive-table-head,
.drive-item {
  display: grid;
  grid-template-columns:
    minmax(280px, 1fr)
    120px
    165px
    150px
    174px;

  align-items: center;

  width: 100%;
  min-width: 0;
}

.drive-table-head {
  min-height: 43px;
  padding: 0 14px;

  border-bottom: 1px solid var(--line-strong);

  color: var(--text-muted);

  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;

  background: #f6f7f8;
}

.drive-table-head span:last-child {
  text-align: right;
}

.drive-list {
  display: flex;
  flex-direction: column;

  width: 100%;
  min-width: 0;
}

.drive-item {
  position: relative;

  min-height: 70px;
  padding: 0 14px;

  border-bottom: 1px solid var(--line);

  background: #ffffff;

  transition:
    background-color var(--transition),
    opacity var(--transition);
}

.drive-item:last-child {
  border-bottom: 0;
}

.drive-item:hover {
  background: #f8f9fa;
}

.drive-item.is-dragging {
  opacity: 0.42;
}

.drive-item__main {
  display: flex;
  align-items: center;
  gap: 11px;

  min-width: 0;
  height: 100%;
  padding: 8px 8px 8px 0;

  border: 0;

  color: inherit;

  text-align: left;

  background: transparent;
}

.drive-item__drag-handle {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;

  width: 18px;

  color: #a2a7af;

  cursor: grab;
}

.drive-item__drag-handle:active {
  cursor: grabbing;
}

.drive-item__drag-handle svg {
  width: 16px;
  height: 16px;
}

.drive-item__icon {
  display: inline-flex;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;

  border: 1px solid var(--line-strong);
  border-radius: 9px;

  color: var(--text-muted);

  background: #f7f8f9;
}

.drive-item__icon svg {
  width: 20px;
  height: 20px;
}

.drive-item__icon--carpeta {
  color: #9d6813;

  background: #fff8e7;
  border-color: #ddc083;
}

.drive-item__icon--pdf {
  color: #bd1d27;

  background: #fff2f3;
  border-color: #e5afb3;
}

.drive-item__icon--imagen {
  color: #1b6a57;

  background: #effbf7;
  border-color: #acd7ca;
}

.drive-item__icon--texto {
  color: #455463;

  background: #f3f6f8;
  border-color: #bec8cf;
}

.drive-item__name {
  display: flex;
  flex-direction: column;
  gap: 3px;

  min-width: 0;
}

.drive-item__name strong {
  overflow: hidden;

  color: var(--text);

  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-item__name small {
  overflow: hidden;

  color: var(--text-muted);

  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-item__size,
.drive-item__date,
.drive-item__user {
  overflow: hidden;

  padding-right: 12px;

  color: var(--text-muted);

  font-size: 12px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-item__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;

  min-width: 0;
}

.drive-item__actions .icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;

  border-radius: 8px;
}

.drive-item__delete {
  color: var(--danger);
}

.drive-item__delete:hover {
  border-color: #dca4a8;

  color: #a8141d;

  background: #fff1f2;
}

/* =========================================================
   DESTINOS DE ARRASTRE
   ========================================================= */

.drive-drop-target {
  transition:
    border-color var(--transition),
    background-color var(--transition),
    outline-color var(--transition);
}

.drive-drop-target.is-drop-target {
  border-color: var(--accent);

  outline: 3px solid rgba(225, 38, 48, 0.1);

  background: #fff3f4;
}

/* =========================================================
   DROP EXTERNO
   ========================================================= */

.drive-drop-zone {
  position: fixed;
  inset: 76px 22px 22px calc(var(--sidebar-width) + 22px);
  z-index: 950;

  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;

  border: 2px dashed var(--accent);
  border-radius: 14px;

  color: var(--text);

  background: rgba(255, 255, 255, 0.96);
}

.drive-drop-zone.is-visible {
  display: flex;
}

.drive-drop-zone svg {
  width: 42px;
  height: 42px;

  color: var(--accent);
}

.drive-drop-zone strong {
  font-size: 18px;
}

.drive-drop-zone span {
  color: var(--text-muted);

  font-size: 13px;
}

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

.drive-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  min-height: 68px;

  border: 1px solid var(--line-strong);
  border-radius: 10px;

  color: var(--text-muted);

  font-size: 13px;

  background: #ffffff;
}

.drive-spinner {
  display: inline-block;

  width: 20px;
  height: 20px;

  border: 2px solid #d8dbe0;
  border-top-color: var(--accent);
  border-radius: 50%;

  animation: drive-spin 0.75s linear infinite;
}

.drive-spinner--small {
  width: 16px;
  height: 16px;
}

@keyframes drive-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   VACÍO
   ========================================================= */

.drive-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;

  min-height: 360px;
  padding: 36px;

  border: 1px solid var(--line-strong);
  border-radius: 12px;

  text-align: center;

  background: #ffffff;
}

.drive-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 64px;
  height: 64px;
  margin-bottom: 5px;

  border: 1px solid var(--line-strong);
  border-radius: 12px;

  color: var(--text-muted);

  background: #f6f7f8;
}

.drive-empty__icon svg {
  width: 29px;
  height: 29px;
}

.drive-empty h2 {
  color: var(--text);

  font-size: 19px;
  font-weight: 750;
}

.drive-empty p {
  max-width: 430px;

  color: var(--text-muted);

  font-size: 13px;
  line-height: 1.6;
}

.drive-empty__actions {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-top: 12px;
}

/* =========================================================
   MODALES
   ========================================================= */

body.modal-open {
  overflow: hidden;
}

.drive-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;

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

  padding: 22px;
}

.drive-modal[hidden] {
  display: none;
}

.drive-modal__backdrop {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  border: 0;

  background: rgba(20, 22, 26, 0.68);
}

.drive-modal__dialog {
  position: relative;
  z-index: 1;

  display: flex;
  flex-direction: column;

  width: min(500px, 100%);
  max-height: min(760px, calc(100vh - 44px));

  overflow: hidden;

  border: 1px solid #9fa5ae;
  border-radius: 12px;

  background: #ffffff;
}

.drive-modal__dialog--move {
  width: min(620px, 100%);
}

.drive-modal__dialog--delete {
  width: min(520px, 100%);

  border-color: #c88c91;
}

.drive-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;

  padding: 20px 22px;

  border-bottom: 1px solid var(--line-strong);

  background: #f8f9fa;
}

.drive-modal__header > div {
  min-width: 0;
}

.drive-modal__header > div > span {
  display: block;

  margin-bottom: 4px;

  color: var(--text-muted);

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drive-modal__header h2 {
  color: var(--text);

  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.drive-modal__description {
  margin-top: 6px;

  color: var(--text-muted);

  font-size: 12px;
  line-height: 1.5;
}

.drive-modal__danger-label {
  color: var(--danger) !important;
}

.drive-modal__form {
  display: flex;
  flex-direction: column;
  gap: 18px;

  padding: 22px;

  overflow-y: auto;
}

.drive-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  padding: 16px 22px;

  border-top: 1px solid var(--line-strong);

  background: #fafafa;
}

.drive-modal__form > .drive-modal__footer {
  margin: 4px -22px -22px;
}

/* =========================================================
   CAMPOS
   ========================================================= */

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;

  width: 100%;
}

.form-field > label {
  color: var(--text);

  font-size: 12px;
  font-weight: 700;
}

.form-control {
  display: flex;
  align-items: center;
  gap: 10px;

  width: 100%;
  min-height: 44px;
  padding: 0 12px;

  border: 1px solid #aeb3bc;
  border-radius: 9px;

  background: #ffffff;

  transition:
    border-color var(--transition),
    outline-color var(--transition);
}

.form-control:hover {
  border-color: #858c96;
}

.form-control:focus-within {
  border-color: var(--accent);

  outline: 3px solid rgba(225, 38, 48, 0.09);
}

.form-control > svg {
  flex: 0 0 18px;

  width: 18px;
  height: 18px;

  color: var(--text-soft);
}

.form-control input {
  flex: 1 1 auto;

  min-width: 0;
  height: 42px;
  padding: 0;

  border: 0;
  outline: 0;

  color: var(--text);

  font: inherit;
  font-size: 13px;
  font-weight: 550;

  background: transparent;
}

.form-control input::placeholder {
  color: #959ba4;
}

.form-control__action {
  display: inline-flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;

  border: 1px solid transparent;
  border-radius: 7px;

  color: var(--text-muted);

  background: transparent;
}

.form-control__action:hover {
  border-color: var(--line-strong);

  color: var(--text);

  background: #f4f5f6;
}

.form-control__action svg {
  width: 17px;
  height: 17px;
}

.form-error {
  display: block;

  min-height: 16px;

  color: var(--danger);

  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

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

.drive-move {
  display: flex;
  flex-direction: column;
  gap: 12px;

  min-height: 320px;
  padding: 18px 22px;

  overflow: hidden;
}

.drive-move__search {
  display: flex;
  align-items: center;
  gap: 10px;

  min-height: 42px;
  padding: 0 12px;

  border: 1px solid var(--line-strong);
  border-radius: 9px;

  background: #ffffff;
}

.drive-move__search:focus-within {
  border-color: var(--accent);

  outline: 3px solid rgba(225, 38, 48, 0.09);
}

.drive-move__search svg {
  width: 17px;
  height: 17px;

  color: var(--text-soft);
}

.drive-move__search input {
  flex: 1;
  min-width: 0;
  height: 40px;

  border: 0;
  outline: 0;

  color: var(--text);

  font: inherit;
  font-size: 13px;

  background: transparent;
}

.drive-move__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  min-height: 80px;

  color: var(--text-muted);

  font-size: 12px;
}

.drive-move__tree {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;

  min-height: 220px;
  max-height: 390px;
  padding: 6px;

  overflow-y: auto;

  border: 1px solid var(--line-strong);
  border-radius: 9px;

  background: #f8f9fa;
}

.drive-move__item {
  display: grid;
  grid-template-columns:
    calc(
      var(--folder-level, 0) *
      18px
    )
    18px
    minmax(0, 1fr)
    auto;

  align-items: center;
  gap: 9px;

  width: 100%;
  min-height: 42px;
  padding: 5px 10px;

  border: 1px solid transparent;
  border-radius: 7px;

  color: var(--text);

  text-align: left;

  background: #ffffff;
}

.drive-move__item:hover:not(:disabled) {
  border-color: #aeb3bc;

  background: #f4f5f6;
}

.drive-move__item.is-selected {
  border-color: var(--accent);

  background: #fff2f3;
}

.drive-move__item:disabled {
  color: var(--text-soft);

  cursor: not-allowed;
  opacity: 0.68;
}

.drive-move__item > svg {
  width: 17px;
  height: 17px;
}

.drive-move__item > span:nth-of-type(2) {
  overflow: hidden;

  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-move__item small {
  color: var(--text-muted);

  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.drive-move__empty {
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 160px;
  padding: 18px;

  color: var(--text-muted);

  font-size: 12px;
  text-align: center;
}

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

.drive-delete-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;

  padding: 14px;

  border: 1px solid #dfadb1;
  border-radius: 9px;

  background: #fff4f5;
}

.drive-delete-warning__icon {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;

  border: 1px solid #dc9ba1;
  border-radius: 8px;

  color: #ac1720;

  background: #ffffff;
}

.drive-delete-warning__icon svg {
  width: 18px;
  height: 18px;
}

.drive-delete-warning strong {
  display: block;

  margin-bottom: 3px;

  color: #8f121a;

  font-size: 12px;
  font-weight: 750;
}

.drive-delete-warning p {
  color: #7f3b40;

  font-size: 11px;
  line-height: 1.5;
}

.button--danger {
  border: 1px solid #a9141d;

  color: #ffffff;

  background: #c41e28;
}

.button--danger:hover:not(:disabled) {
  border-color: #8f1119;

  background: #a9141d;
}

.button--danger:disabled {
  cursor: wait;
  opacity: 0.7;
}

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

@media (max-width: 1100px) {
  .drive-table-head,
  .drive-item {
    grid-template-columns:
      minmax(240px, 1fr)
      100px
      150px
      130px
      174px;
  }
}

@media (max-width: 900px) {
  .drive-drop-zone {
    inset: 76px 14px 14px;
  }

  .drive-toolbar {
    align-items: flex-start;
  }

  .drive-toolbar__actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .drive-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .drive-toolbar__actions {
    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      auto
      auto;

    width: 100%;
  }

  .drive-select {
    width: 100%;
    min-width: 0;
  }

  .drive-content {
    overflow: visible;

    border: 0;

    background: transparent;
  }

  .drive-table-head {
    display: none;
  }

  .drive-list {
    gap: 10px;
  }

  .drive-item {
    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      auto;

    gap: 8px 12px;

    min-height: 0;
    padding: 12px;

    border: 1px solid var(--line-strong);
    border-radius: 10px;

    background: #ffffff;
  }

  .drive-item__main {
    grid-column: 1 / -1;

    width: 100%;
    min-height: 52px;
  }

  .drive-item__size,
  .drive-item__date,
  .drive-item__user {
    display: none;
  }

  .drive-item__actions {
    grid-column: 1 / -1;

    padding-top: 8px;

    border-top: 1px solid var(--line);
  }

  .drive-modal {
    align-items: flex-end;

    padding: 10px;
  }

  .drive-modal__dialog,
  .drive-modal__dialog--move,
  .drive-modal__dialog--delete {
    width: 100%;
    max-height: calc(100vh - 20px);

    border-radius: 12px;
  }

  .drive-move {
    min-height: 280px;
  }
}

@media (max-width: 520px) {
  .drive-toolbar__actions {
    grid-template-columns:
      minmax(0, 1fr)
      44px
      44px;
  }

  .drive-toolbar__actions .button {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .drive-toolbar__actions .button span {
    display: none;
  }

  .drive-empty {
    min-height: 310px;
    padding: 24px 16px;
  }

  .drive-empty__actions {
    flex-direction: column;

    width: 100%;
  }

  .drive-empty__actions .button {
    width: 100%;
  }

  .drive-modal__header,
  .drive-modal__form,
  .drive-move {
    padding-right: 16px;
    padding-left: 16px;
  }

  .drive-modal__footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .drive-modal__form > .drive-modal__footer {
    margin-right: -16px;
    margin-left: -16px;
  }

  .drive-modal__footer .button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drive-spinner {
    animation-duration: 1.5s;
  }

  .drive-item,
  .drive-drop-target {
    transition: none;
  }
}/* =========================================================
   WIRTZ DRIVE · MINIATURAS DE IMÁGENES
   ========================================================= */

.drive-item__preview {
  position: relative;

  display: inline-flex;
  flex: 0 0 58px;
  align-items: center;
  justify-content: center;

  width: 58px;
  height: 48px;

  overflow: hidden;

  border: 1px solid var(--line-strong);
  border-radius: 8px;

  background: #f4f5f6;
}

.drive-item__preview img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  border: 0;
}

.drive-item__preview img[hidden] {
  display: none;
}

.drive-item__preview-loading {
  position: absolute;
  inset: 0;

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

  color: var(--text-soft);

  background: #f4f5f6;
}

.drive-item__preview-loading svg {
  width: 20px;
  height: 20px;
}

.drive-item__preview.is-loaded .drive-item__preview-loading {
  display: none;
}

.drive-item__preview.has-error {
  border-color: #c4c8cf;

  background: #f1f2f4;
}

.drive-item__preview.has-error .drive-item__preview-loading {
  display: flex;
}

.drive-item__preview.has-error .drive-item__preview-loading::after {
  position: absolute;

  width: 20px;
  height: 1px;

  content: "";

  background: var(--text-soft);

  transform: rotate(-45deg);
}

.drive-item__preview.is-loading .drive-item__preview-loading svg {
  animation: drive-preview-pulse 1s ease-in-out infinite;
}

@keyframes drive-preview-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.92);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  .drive-item__preview {
    flex-basis: 64px;

    width: 64px;
    height: 54px;
  }
}