/* Files: the directory of every file in the library (/settings/files/). */

.files-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ------------------------------------------------------------------ toolbar */

.files-search {
  position: relative;
  display: flex;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 380px;
}

.files-search svg {
  position: absolute;
  top: 50%;
  left: 18px;
  width: 18px;
  height: 18px;
  color: var(--faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.files-search__input {
  height: 44px;
  padding-left: 46px;
}

.files-search__input::-webkit-search-decoration {
  -webkit-appearance: none;
}

.files-filter {
  display: flex;
  min-width: 0;
  max-width: 100%;
}

.files-filter__menu {
  display: none;
}

/* -------------------------------------------------------------------- tree */

.files-panel {
  --files-indent: 24px;
  padding: 6px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bg);
}

.files-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One row: a file, a folder (a button) or a group of unsupported Drive files. */
.files-line {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 80px 150px 200px 40px;
  align-items: center;
  column-gap: 16px;
  min-height: 52px;
  margin: 0 -12px;
  padding: 6px 12px;
  border-radius: 14px;
  transition: background 0.14s;
}

button.files-line {
  width: calc(100% + 24px);
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.files-line:focus-visible {
  outline-offset: -2px;
}

.files-line::before {
  content: '';
  position: absolute;
  top: 0;
  right: 12px;
  left: 12px;
  border-top: 1px solid var(--line);
}

.files-root > .files-item:first-child > .files-line::before {
  border-top-color: transparent;
}

@media (hover: hover) {
  .files-line:hover {
    background: var(--soft-1);
  }

  /* The lines above and below a highlighted row step aside. */
  .files-line:hover::before,
  .files-line:hover + .files-list > .files-item:first-child > .files-line::before,
  .files-item:has(> .files-line:hover) + .files-item > .files-line::before {
    border-top-color: transparent;
  }
}

.files-line__name {
  display: flex;
  grid-row: 1;
  grid-column: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-left: min(calc(var(--depth, 0) * var(--files-indent)), 40%);
}

.files-line__twist {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  height: 20px;
  color: var(--faint);
}

.files-line__twist svg {
  width: 16px;
  height: 16px;
  transition: transform 0.16s var(--ease);
}

.files-line[aria-expanded='true'] .files-line__twist svg {
  transform: rotate(90deg);
}

.files-line__icon {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--muted);
}

.files-line__icon svg {
  width: 20px;
  height: 20px;
}

.files-line__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.files-line__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.files-line__label {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

a.files-line__label {
  text-decoration: none;
}

/* A file without a page in the app: its name downloads it. */
button.files-line__label {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

a.files-line__label:hover,
a.files-line__label:focus-visible,
button.files-line__label:hover,
button.files-line__label:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--whisper);
}

.files-folder .files-line__label {
  font-weight: 500;
}

.files-group .files-line__name {
  grid-column: 1 / -1;
}

.files-group .files-line__label {
  color: var(--muted);
  font-size: 14px;
}

.files-line .badge {
  flex: 0 0 auto;
  height: 22px;
  padding: 0 8px;
  font-size: 12px;
}

.files-line__note {
  display: -webkit-box;
  overflow: hidden;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.files-line__note.is-error {
  color: var(--danger);
}

.files-line__path {
  overflow: hidden;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Kind, size, date and who added it: columns on wide screens, a second line on narrow ones. */
.files-line__meta {
  display: contents;
}

.files-line__meta > * {
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.files-line__kind {
  grid-column: 2;
}

.files-line__size {
  grid-column: 3;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.files-line__date {
  grid-column: 4;
}

.files-line__by {
  grid-column: 5;
}

.files-line__meta > .files-line__by {
  color: var(--faint);
}

.files-line__by-pre {
  display: none;
}

.files-line__more {
  display: flex;
  grid-row: 1;
  grid-column: -2 / -1;
  justify-content: flex-end;
}

.files-line .row__more {
  width: 36px;
  height: 36px;
  border-color: transparent;
  color: var(--muted);
}

.files-line .row__more:hover,
.files-line .dropdown[open] > .row__more {
  background: var(--soft-2);
  color: var(--ink);
}

.files-more {
  padding: 10px 0 10px calc(min(calc(var(--depth, 0) * var(--files-indent)), 40%) + 54px);
}

.files-results__more {
  padding: 14px 0 8px;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------------ states */

.files-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 72px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--muted);
  text-align: center;
}

.files-state--loading {
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
}

.files-state__title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
}

.files-state__text {
  max-width: 520px;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.files-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.files-link:hover {
  color: var(--ink);
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .files-line {
    grid-template-columns: minmax(0, 1fr) 104px 76px 144px 40px;
  }

  .files-line__meta > .files-line__by {
    display: none;
  }
}

@media (max-width: 760px) {
  .files-panel {
    --files-indent: 14px;
  }

  .files-line {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    row-gap: 3px;
    min-height: 56px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .files-line__name {
    align-items: flex-start;
    padding-left: min(calc(var(--depth, 0) * var(--files-indent)), 84px);
  }

  .files-line__title {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .files-line__label {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .files-line__meta {
    display: block;
    grid-row: 2;
    grid-column: 1;
    min-width: 0;
    overflow: hidden;
    padding-left: calc(min(calc(var(--depth, 0) * var(--files-indent)), 84px) + 54px);
    color: var(--faint);
    font-size: 13px;
    line-height: 1.35;
  }

  /* The details wrap onto more lines, so the date and who added it stay readable. */
  .files-line__meta > *,
  .files-line__meta > .files-line__by {
    display: inline;
    overflow: visible;
    color: inherit;
    font-size: inherit;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .files-line__meta > * + *::before {
    content: '·';
    margin: 0 6px;
  }

  .files-line__by-pre {
    display: inline;
  }

  .files-line__more {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
  }

  .files-more {
    padding-left: calc(min(calc(var(--depth, 0) * var(--files-indent)), 84px) + 54px);
  }
}

@media (max-width: 560px) {
  .files-search {
    flex-basis: 100%;
    max-width: none;
  }

  .files-filter__segments {
    display: none;
  }

  .files-filter__menu {
    display: block;
  }

  .files-panel {
    padding: 4px 12px;
    border-radius: 20px;
  }

  .files-line {
    margin: 0 -8px;
    padding-right: 8px;
    padding-left: 8px;
  }

  button.files-line {
    width: calc(100% + 16px);
  }

  .files-line::before {
    right: 8px;
    left: 8px;
  }

  .files-line .row__more {
    width: 40px;
    height: 40px;
  }

  .files-state {
    padding: 48px 20px;
    border-radius: 20px;
  }
}
