/* =========================================================
   UBICACIÓN:
   frontend/src/pages/drive/recientes.css
   ========================================================= */

/* =========================================================
   AGRO INTEL DRIVE · RECIENTES
   ========================================================= */

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

  width: 100%;
  min-width: 0;
  padding-bottom: 28px;
}

/* =========================================================
   ENCABEZADO
   ========================================================= */

.recent-page .recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  width: 100%;
  min-width: 0;
  min-height: 92px;
  padding: 16px 18px;

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

  background: var(--surface);
}

.recent-page .recent-header__main {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 14px;

  min-width: 0;
}

.recent-page .recent-header__icon {
  display: inline-flex;
  flex: 0 0 52px;
  align-items: center;
  justify-content: center;

  width: 52px;
  height: 52px;

  border: 1px solid var(--accent-border);
  border-radius: 13px;

  color: #806000;

  background: var(--accent-soft);
}

.recent-page .recent-header__icon svg {
  width: 23px;
  height: 23px;

  stroke-width: 1.9;
}

.recent-page .recent-header__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  min-width: 0;
}

.recent-page .recent-header__eyebrow {
  display: inline-flex;
  align-items: center;

  min-height: 22px;
  margin-bottom: 5px;
  padding: 0 8px;

  border: 1px solid var(--accent-border);
  border-radius: 999px;

  color: #765900;

  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.09em;
  text-transform: uppercase;

  background: var(--accent-soft);
}

.recent-page .recent-header__copy h2 {
  overflow: hidden;

  margin: 0;

  color: var(--text);

  font-size: 22px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-page .recent-header__copy p {
  overflow: hidden;

  margin: 5px 0 0;

  color: var(--text-muted);

  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-page .recent-header__refresh {
  flex: 0 0 auto;

  min-height: 42px;
}

.recent-page .recent-header__refresh svg {
  width: 17px;
  height: 17px;
}

.recent-page .recent-header__refresh:disabled {
  cursor: wait;
  opacity: 0.55;
}

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

.recent-page .recent-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;

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

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

  color: var(--text-muted);

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

  background: var(--surface);
}

.recent-page .recent-loading[hidden] {
  display: none !important;
}

.recent-page .recent-spinner {
  display: inline-block;
  flex: 0 0 auto;

  width: 21px;
  height: 21px;

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

  animation: recent-spinner 700ms linear infinite;
}

@keyframes recent-spinner {
  to {
    transform: rotate(360deg);
  }
}

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

.recent-page .recent-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;

  width: 100%;
  min-width: 0;
  min-height: 410px;
  padding: 40px 28px;

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

  text-align: center;

  background: var(--surface);
}

.recent-page .recent-empty[hidden] {
  display: none !important;
}

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

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

  border: 1px solid var(--accent-border);
  border-radius: 15px;

  color: #806000;

  background: var(--accent-soft);
}

.recent-page .recent-empty__icon svg {
  width: 28px;
  height: 28px;

  stroke-width: 1.9;
}

.recent-page .recent-empty h2 {
  margin: 0;

  color: var(--text);

  font-size: 20px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.recent-page .recent-empty p {
  max-width: 430px;
  margin: 0;

  color: var(--text-muted);

  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}

/* =========================================================
   CONTENEDOR
   ========================================================= */

.recent-page .recent-content {
  width: 100%;
  min-width: 0;

  overflow-x: auto;
  overflow-y: visible;

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

  background: var(--surface);
}

.recent-page .recent-content[hidden] {
  display: none !important;
}

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

.recent-page .recent-table-head,
.recent-page .drive-item {
  display: grid;
  grid-template-columns:
    minmax(300px, 1fr)
    110px
    175px
    190px
    100px;

  align-items: center;

  width: 100%;
  min-width: 900px;
}

.recent-page .recent-table-head {
  min-height: 45px;
  padding: 0 14px;

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

  color: var(--text-muted);

  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;

  background: var(--surface-muted);
}

.recent-page .recent-table-head > span {
  min-width: 0;
  padding: 0 10px;
}

.recent-page .recent-table-head > span:last-child {
  text-align: right;
}

/* =========================================================
   LISTADO
   ========================================================= */

.recent-page .recent-list {
  display: flex;
  flex-direction: column;

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

.recent-page .recent-list .drive-item {
  min-height: 72px;
  padding: 0 14px;

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

  background: var(--surface);

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

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

.recent-page .recent-list .drive-item:hover {
  background: var(--surface-soft);
}

/* =========================================================
   COLUMNA NOMBRE
   ========================================================= */

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

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

  border: 0;

  color: inherit;

  text-align: left;

  background: transparent;

  cursor: pointer;
}

.recent-page .recent-list .drive-item__main:disabled {
  cursor: wait;
  opacity: 0.64;
}

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

  min-width: 0;
}

.recent-page .recent-list .drive-item__name strong {
  overflow: hidden;

  color: var(--text);

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

.recent-page .recent-list .drive-item__name small {
  overflow: hidden;

  color: var(--text-muted);

  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   ICONOS
   ========================================================= */

.recent-page .recent-list .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: var(--surface-soft);
}

.recent-page .recent-list .drive-item__icon svg {
  width: 20px;
  height: 20px;

  stroke-width: 1.9;
}

.recent-page .recent-list .drive-item__icon--pdf {
  border-color: #e5afb3;

  color: #bd1d27;

  background: #fff2f3;
}

.recent-page .recent-list .drive-item__icon--imagen {
  border-color: #acd7ca;

  color: #1b6a57;

  background: #effbf7;
}

.recent-page .recent-list .drive-item__icon--video {
  border-color: var(--accent-border);

  color: #7d5c00;

  background: var(--accent-soft);
}

.recent-page .recent-list .drive-item__icon--texto {
  border-color: #bec8cf;

  color: #455463;

  background: #f3f6f8;
}

.recent-page .recent-list .drive-item__icon--planilla {
  border-color: #acd1bf;

  color: #246346;

  background: #eff9f4;
}

.recent-page .recent-list .drive-item__icon--documento {
  border-color: #b8cad8;

  color: #3c5875;

  background: #f1f6fa;
}

.recent-page .recent-list .drive-item__icon--comprimido {
  border-color: var(--accent-border);

  color: #785817;

  background: var(--accent-soft);
}

.recent-page .recent-list .drive-item__icon--otro {
  border-color: var(--line-strong);

  color: var(--text-muted);

  background: var(--surface-soft);
}

/* =========================================================
   MINIATURAS
   ========================================================= */

.recent-page .recent-list .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: 9px;

  background: var(--surface-soft);

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

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

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

  color: var(--text-soft);

  background: var(--surface-soft);
}

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

.recent-page .recent-list .drive-item__preview-image {
  display: block;

  width: 100%;
  height: 100%;

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

  opacity: 0;

  transform: scale(1.02);

  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.recent-page
.recent-list
.drive-item__preview.is-loaded
.drive-item__preview-image {
  opacity: 1;

  transform: scale(1);
}

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

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

.recent-page
.recent-list
.drive-item__preview.has-error
.drive-item__preview-image {
  display: none;
}

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

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

  width: 22px;
  height: 1px;

  content: "";

  background: var(--text-soft);

  transform: rotate(-45deg);
}

.recent-page
.recent-list
.drive-item__main:hover
.drive-item__preview {
  border-color: var(--line-focus);
}

.recent-page
.recent-list
.drive-item__main:hover
.drive-item__preview.is-loaded
.drive-item__preview-image {
  transform: scale(1.05);
}

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

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

/* =========================================================
   COLUMNAS
   ========================================================= */

.recent-page .recent-list .drive-item__size,
.recent-page .recent-list .drive-item__date {
  min-width: 0;
  padding: 0 10px;

  overflow: hidden;

  color: var(--text-muted);

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

/* =========================================================
   UBICACIÓN
   ========================================================= */

.recent-page .recent-list .drive-item__user {
  display: flex;
  align-items: center;

  min-width: 0;
  padding: 0 10px;

  overflow: hidden;

  color: var(--text-muted);

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

/* =========================================================
   ACCIONES
   ========================================================= */

.recent-page .recent-list .drive-item__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;

  min-width: 0;
  padding: 0 4px;
}

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

  border-radius: 8px;
}

.recent-page .recent-list .drive-item__actions .icon-button:disabled {
  cursor: wait;
  opacity: 0.5;
}

/* =========================================================
   SCROLL GENERAL
   ========================================================= */

html,
body,
#app {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

body {
  overflow: hidden;
}

.app-layout {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;

  overflow: hidden;
}

.app-main {
  display: flex;
  flex-direction: column;

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

  overflow: hidden;
}

.app-main__content {
  flex: 1 1 auto;

  width: 100%;
  min-width: 0;
  min-height: 0;
  padding-bottom: 24px;

  overflow-x: hidden;
  overflow-y: auto;

  scrollbar-gutter: stable;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* =========================================================
   RESPONSIVE · 1100
   ========================================================= */

@media (max-width: 1100px) {
  .recent-page .recent-table-head,
  .recent-page .drive-item {
    grid-template-columns:
      minmax(270px, 1fr)
      95px
      155px
      165px
      92px;

    min-width: 830px;
  }
}

/* =========================================================
   RESPONSIVE · 760
   ========================================================= */

@media (max-width: 760px) {
  .recent-page .recent-header {
    align-items: flex-start;

    padding: 14px;
  }

  .recent-page .recent-header__main {
    align-items: flex-start;
  }

  .recent-page .recent-header__copy p {
    max-width: 420px;

    white-space: normal;
  }

  .recent-page .recent-content {
    overflow: visible;

    border: 0;

    background: transparent;
  }

  .recent-page .recent-table-head {
    display: none;
  }

  .recent-page .recent-list {
    gap: 10px;
  }

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

    gap: 8px 10px;

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

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

    background: var(--surface);
  }

  .recent-page .recent-list .drive-item:last-child {
    border-bottom: 1px solid var(--line-strong);
  }

  .recent-page .recent-list .drive-item__main {
    grid-column: 1;
    grid-row: 1;

    min-height: 54px;
    padding: 0;
  }

  .recent-page .recent-list .drive-item__actions {
    grid-column: 2;
    grid-row: 1;

    align-self: center;

    padding: 0;
  }

  .recent-page .recent-list .drive-item__size {
    display: none;
  }

  .recent-page .recent-list .drive-item__date {
    grid-column: 1 / -1;
    grid-row: 2;

    padding: 8px 0 0;

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

  .recent-page .recent-list .drive-item__date::before {
    margin-right: 6px;

    content: "Modificado:";

    color: var(--text-soft);

    font-weight: 700;
  }

  .recent-page .recent-list .drive-item__user {
    grid-column: 1 / -1;
    grid-row: 3;

    padding: 0;

    font-size: 11px;
  }

  .recent-page .recent-list .drive-item__user::before {
    margin-right: 6px;

    content: "Ubicación:";

    color: var(--text-soft);

    font-weight: 700;
  }
}

/* =========================================================
   RESPONSIVE · 560
   ========================================================= */

@media (max-width: 560px) {
  .recent-page {
    gap: 14px;
  }

  .recent-page .recent-header {
    gap: 12px;

    min-height: 0;
    padding: 13px;
  }

  .recent-page .recent-header__main {
    gap: 10px;
  }

  .recent-page .recent-header__icon {
    flex-basis: 42px;

    width: 42px;
    height: 42px;

    border-radius: 10px;
  }

  .recent-page .recent-header__icon svg {
    width: 19px;
    height: 19px;
  }

  .recent-page .recent-header__eyebrow {
    min-height: 20px;
    margin-bottom: 4px;
    padding: 0 7px;

    font-size: 8px;
  }

  .recent-page .recent-header__copy h2 {
    font-size: 18px;
  }

  .recent-page .recent-header__copy p {
    max-width: 230px;

    font-size: 11px;
  }

  .recent-page .recent-header__refresh {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  .recent-page .recent-header__refresh span {
    display: none;
  }

  .recent-page .recent-list .drive-item {
    padding: 10px;
  }

  .recent-page .recent-list .drive-item__main {
    gap: 8px;
  }

  .recent-page .recent-list .drive-item__preview {
    flex-basis: 52px;

    width: 52px;
    height: 44px;
  }

  .recent-page .recent-list .drive-item__icon {
    flex-basis: 40px;

    width: 40px;
    height: 40px;
  }

  .recent-page .recent-list .drive-item__name strong {
    font-size: 12px;
  }

  .recent-page .recent-list .drive-item__name small {
    font-size: 9px;
  }

  .recent-page .recent-list .drive-item__actions {
    gap: 4px;
  }

  .recent-page
  .recent-list
  .drive-item__actions
  .icon-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .recent-page .recent-empty {
    min-height: 300px;
    padding: 24px 16px;
  }

  .recent-page .recent-empty__icon {
    width: 56px;
    height: 56px;

    border-radius: 13px;
  }

  .recent-page .recent-empty__icon svg {
    width: 24px;
    height: 24px;
  }

  .recent-page .recent-empty h2 {
    font-size: 18px;
  }

  .recent-page .recent-empty p {
    font-size: 12px;
  }
}

/* =========================================================
   REDUCCIÓN DE MOVIMIENTO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .recent-page .recent-spinner,
  .recent-page
  .drive-item__preview.is-loading
  .drive-item__preview-loading
  svg {
    animation: none;
  }

  .recent-page .drive-item,
  .recent-page .drive-item__preview,
  .recent-page .drive-item__preview-image {
    transition: none;
  }
}