/* Cloud-backed file cabinet for the Creative Desktop. */

#localFilesModal,
#localFilePreviewModal {
  color: #1e2228;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

#localFilesModal .lf-window {
  position: fixed;
  width: min(980px, 94vw);
  height: min(680px, 88vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #f5f5f3;
  box-shadow: 0 42px 100px rgba(0, 0, 0, .48), 0 0 0 1px rgba(0, 0, 0, .12);
}

.lf-owner-only[hidden],
.lf-new-folder-form[hidden],
.lf-rename-form[hidden] {
  display: none !important;
}

.lf-folder-picker,
.lf-mobile-folder-backdrop {
  display: none;
}

.lf-head,
.lf-preview-head {
  position: relative;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  background: #eef1f7;
}

.lf-head .win-close::after,
.lf-preview-head .win-close::after {
  content: "";
  position: absolute;
  inset: -15px;
}

.lf-storage {
  margin-left: auto;
  color: #757b84;
  font-size: 12px;
}

.lf-shell {
  display: flex;
  flex: 1;
  min-height: 0;
}

.lf-sidebar {
  flex: 0 0 210px;
  width: 210px;
  overflow-y: auto;
  padding: 18px 12px;
  border-right: 1px solid rgba(0, 0, 0, .07);
  background: rgba(226, 229, 234, .72);
}

.lf-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
  color: #777d86;
  font-size: 12px;
  font-weight: 700;
}

.lf-sidebar-heading button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #32373e;
  font-size: 20px;
  line-height: 1;
}

.lf-sidebar-heading button:hover,
.lf-sidebar-heading button:focus-visible {
  background: rgba(255, 255, 255, .7);
  outline: none;
}

.lf-new-folder-form {
  margin: 0 6px 10px;
  padding: 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
}

.lf-new-folder-form[hidden] {
  display: none;
}

.lf-new-folder-form label {
  display: block;
  margin-bottom: 6px;
  color: #70757c;
  font-size: 12px;
}

.lf-new-folder-form > div {
  display: flex;
  gap: 6px;
}

.lf-new-folder-form input {
  min-width: 0;
  flex: 1;
  padding: 7px 8px;
  border: 1px solid rgba(0, 0, 0, .14);
  border-radius: 7px;
  background: #fff;
  color: #1e2228;
  font: inherit;
}

.lf-new-folder-form button {
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: #17191c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.lf-folder-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lf-folder-button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #34383e;
  text-align: left;
}

.lf-folder-button:hover,
.lf-folder-button:focus-visible {
  background: rgba(255, 255, 255, .62);
  outline: none;
}

.lf-folder-button.is-active {
  background: rgba(255, 255, 255, .94);
  color: #17191c;
}

.lf-folder-button svg {
  width: 28px;
  height: 24px;
  fill: #79b9e6;
  stroke: #3c88b9;
  stroke-width: 1.5;
}

.lf-folder-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lf-folder-count {
  color: #8a9098;
  font-size: 12px;
}

.lf-main {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px 32px;
  background: #fbfbf9;
}

.lf-main.is-dragging .lf-drop-overlay {
  display: grid;
}

.lf-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lf-title-block {
  min-width: 0;
  margin-right: auto;
}

.lf-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lf-toolbar h2 {
  margin: 0;
  overflow: hidden;
  color: #16191d;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -.025em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lf-toolbar p {
  margin: 4px 0 0;
  color: #858a91;
  font-size: 13px;
}

.lf-rename-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 999px;
  background: #fff;
  color: #5f656d;
  font-size: 12px;
  font-weight: 650;
}

.lf-rename-button:hover,
.lf-rename-button:focus-visible {
  border-color: rgba(0, 0, 0, .25);
  color: #17191c;
  outline: none;
}

.lf-rename-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.lf-rename-form input {
  width: min(260px, 44vw);
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: 8px;
  background: #fff;
  color: #1e2228;
  font: inherit;
}

.lf-rename-form input:focus {
  border-color: #4389b9;
  box-shadow: 0 0 0 3px rgba(67, 137, 185, .13);
  outline: none;
}

.lf-rename-form button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: #17191c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.lf-rename-form button.is-secondary {
  background: #e4e6e8;
  color: #4b5159;
}

.lf-import-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border-radius: 999px;
  background: #17191c;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.lf-import-button:hover,
.lf-import-button:focus-within {
  background: #33373c;
}

.lf-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.lf-notice {
  min-height: 22px;
  margin: 16px 0 8px;
  color: #777c84;
  font-size: 13px;
  line-height: 1.5;
}

.lf-notice.is-error {
  color: #b03d35;
}

.lf-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.lf-file-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #202329;
  text-align: left;
}

.lf-file-card:hover,
.lf-file-card:focus-within {
  background: #f0f1f1;
  outline: none;
}

.lf-file-open {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.lf-file-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #e7e9eb;
}

.lf-file-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.lf-file-glyph {
  position: relative;
  width: 54px;
  height: 68px;
  display: grid;
  place-items: end center;
  padding-bottom: 10px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .12);
  color: #525861;
  font-size: 11px;
  font-weight: 800;
}

.lf-file-glyph::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 0 15px 15px;
  border-color: transparent transparent #d4d7da transparent;
}

.lf-file-glyph.is-pdf {
  color: #c33d35;
}

.lf-file-glyph.is-ppt {
  color: #c55a2c;
}

.lf-file-glyph.is-word {
  color: #2b579a;
}

.lf-file-glyph.is-video {
  color: #7450a8;
}

.lf-file-name {
  display: block;
  overflow: hidden;
  margin-top: 9px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lf-file-meta {
  display: block;
  margin-top: 3px;
  color: #8a8f96;
  font-size: 11px;
}

.lf-file-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.lf-file-actions a,
.lf-file-actions button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: #e4e6e8;
  color: #444a52;
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.lf-file-actions button:hover,
.lf-file-actions a:hover,
.lf-file-actions button:focus-visible,
.lf-file-actions a:focus-visible {
  background: #d8dbde;
  outline: none;
}

.lf-file-actions .lf-delete {
  margin-left: auto;
  color: #a23e38;
}

.lf-empty {
  min-height: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #80858c;
  text-align: center;
}

.lf-empty[hidden] {
  display: none;
}

.lf-empty svg {
  width: 72px;
  height: 60px;
  margin-bottom: 6px;
  fill: #b5d8ef;
  stroke: #6ba6cd;
  stroke-width: 2;
}

.lf-empty strong {
  color: #393e45;
  font-size: 16px;
}

.lf-empty span {
  font-size: 13px;
}

.lf-drop-overlay {
  position: absolute;
  inset: 14px;
  z-index: 8;
  display: none;
  place-items: center;
  border: 2px dashed rgba(32, 109, 157, .62);
  border-radius: 14px;
  background: rgba(230, 244, 252, .94);
  color: #216b98;
  pointer-events: none;
  font-size: 18px;
  font-weight: 700;
}

.lf-foot {
  flex: 0 0 auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 16px;
  border-top: 1px solid rgba(0, 0, 0, .07);
  background: #f0f1f2;
  color: #777c84;
  font-size: 12px;
}

#localFilePreviewModal {
  z-index: 520 !important;
}

.lf-preview-window {
  position: relative;
  width: min(920px, 94vw);
  height: min(760px, 90vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #f5f5f3;
  box-shadow: 0 44px 110px rgba(0, 0, 0, .56), 0 0 0 1px rgba(0, 0, 0, .14);
}

.lf-preview-download {
  margin-left: auto;
  color: #2a69a1;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.lf-preview-body {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #dfe2e5;
}

.lf-preview-body img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lf-preview-window.is-image-preview .lf-preview-body {
  place-items: center;
  overflow: hidden;
}

.lf-preview-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.lf-preview-body video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #111;
}

.lf-preview-fallback {
  max-width: 440px;
  padding: 32px;
  color: #464b52;
  text-align: center;
}

.lf-preview-fallback .lf-file-glyph {
  margin: 0 auto 18px;
}

.lf-preview-fallback h3 {
  margin: 0 0 8px;
  color: #202329;
  font-size: 20px;
}

.lf-preview-fallback p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  #localFilesModal .lf-window,
  #localFilePreviewModal .lf-preview-window {
    position: fixed !important;
    border-radius: 0;
    box-shadow: none;
  }

  .lf-head,
  .lf-preview-head {
    flex: 0 0 54px;
    min-height: 54px;
    padding: 0 18px;
    background: rgba(246, 247, 249, .96);
  }

  .lf-storage {
    max-width: 112px;
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .lf-shell {
    position: relative;
    flex-direction: row;
    overflow: hidden;
  }

  .lf-sidebar {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 22;
    width: auto;
    max-height: min(72svh, 560px);
    overflow-y: auto;
    padding: 22px 14px calc(20px + env(safe-area-inset-bottom));
    border-right: 0;
    border-radius: 22px 22px 0 0;
    background: #edf0f3;
    box-shadow: 0 -18px 50px rgba(0, 0, 0, .2);
    transform: translateY(104%);
    visibility: hidden;
    transition: transform .28s cubic-bezier(.22, .7, .2, 1), visibility 0s linear .28s;
  }

  .lf-sidebar::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #c4c8cd;
    transform: translateX(-50%);
  }

  #localFilesModal.is-folder-picker-open .lf-sidebar {
    transform: translateY(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .lf-mobile-folder-backdrop {
    position: absolute;
    inset: 0;
    z-index: 21;
    display: block;
    padding: 0;
    border: 0;
    background: rgba(14, 18, 24, .3);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }

  #localFilesModal.is-folder-picker-open .lf-mobile-folder-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .lf-sidebar-heading {
    padding: 4px 6px 12px;
    color: #535a63;
    font-size: 14px;
  }

  .lf-new-folder-form {
    margin: 0 0 10px;
  }

  .lf-folder-list {
    flex-direction: column;
    gap: 4px;
  }

  .lf-folder-button {
    width: 100%;
    min-height: 52px;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    padding: 9px 11px;
    border-radius: 12px;
  }

  .lf-folder-button svg {
    width: 28px;
    height: 24px;
  }

  .lf-folder-name {
    font-size: 15px;
  }

  .lf-main {
    width: 100%;
    padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  .lf-toolbar {
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 8px;
  }

  .lf-title-block {
    flex: 1 0 100%;
  }

  .lf-toolbar h2 {
    font-size: 27px;
    line-height: 1.12;
  }

  .lf-title-line {
    gap: 6px;
  }

  .lf-rename-button {
    min-height: 32px;
    padding: 0 10px;
  }

  .lf-rename-form {
    position: absolute;
    z-index: 4;
    left: 14px;
    right: 14px;
    padding: 8px;
    border-radius: 10px;
    background: #f3f4f4;
    box-shadow: 0 9px 24px rgba(0, 0, 0, .14);
  }

  .lf-rename-form input {
    min-width: 0;
    width: auto;
    flex: 1;
  }

  .lf-import-button {
    min-height: 44px;
    padding: 0 16px;
    font-size: 13px;
  }

  .lf-folder-picker {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 15px;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 999px;
    background: #eef0f2;
    color: #424850;
    font: 700 13px/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  }

  .lf-folder-picker span {
    font-size: 16px;
    transform: translateY(-1px);
  }

  .lf-notice {
    min-height: 0;
    margin: 14px 0 10px;
    font-size: 12px;
  }

  .lf-file-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .lf-file-card {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, .07);
    border-radius: 0;
  }

  .lf-file-open {
    width: 100%;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
  }

  .lf-file-thumb {
    width: 84px;
    height: 64px;
    grid-row: 1 / 3;
    aspect-ratio: auto;
  }

  .lf-file-glyph {
    width: 38px;
    height: 48px;
    padding-bottom: 7px;
    font-size: 9px;
  }

  .lf-file-name {
    grid-column: 2;
    align-self: end;
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .lf-file-meta {
    grid-column: 2;
    align-self: start;
    margin-top: 4px;
    font-size: 12px;
  }

  .lf-file-actions {
    margin: 8px 0 0 96px;
  }

  .lf-empty {
    min-height: 300px;
  }

  .lf-foot {
    display: none;
  }

  .lf-preview-body {
    align-items: start;
    overscroll-behavior: contain;
  }

  .lf-preview-body img { margin: auto; }

  .lf-preview-fallback {
    padding: 24px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lf-file-card,
  .lf-folder-button,
  .lf-import-button {
    transition: none !important;
  }
}
