/* Tools Storage — fixed workspace layout (max 1920×1080) */

.tools-storage-page {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  color: #f5f5f5;
  padding-top: var(--header-height, 72px);
}

.tools-storage-page .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.tools-storage-page .site-footer {
  display: none;
}

.storage-main {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 0.75rem;
  overflow: hidden;
}

.storage-workspace {
  width: 100%;
  max-width: 1920px;
  height: 100%;
  max-height: calc(1080px - var(--header-height, 72px));
  display: flex;
  flex-direction: column;
  background: rgba(16, 16, 16, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.storage-workspace__header {
  flex-shrink: 0;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 12, 12, 0.9);
}

.storage-workspace__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.25rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) rgba(12, 12, 14, 0.95);
}

.storage-workspace__scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.storage-workspace__scroll::-webkit-scrollbar-track {
  background: rgba(12, 12, 14, 0.95);
}

.storage-workspace__scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 2px solid rgba(12, 12, 14, 0.95);
}

.storage-workspace__scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.storage-alert {
  background: rgba(46, 125, 50, 0.2);
  border: 1px solid rgba(129, 199, 132, 0.5);
  color: #c8e6c9;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.storage-alert--error {
  background: rgba(198, 40, 40, 0.2);
  border-color: rgba(239, 83, 80, 0.5);
  color: #ffcdd2;
}

.storage-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.storage-toolbar__left {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.storage-used {
  color: #bdbdbd;
  font-size: 0.9rem;
  white-space: nowrap;
}

.storage-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.storage-breadcrumbs a {
  color: #90caf9;
  text-decoration: none;
}

.storage-breadcrumbs a:hover {
  text-decoration: underline;
}

.storage-breadcrumbs__current {
  color: #fff;
  font-weight: 600;
}

.storage-breadcrumbs__sep {
  color: #757575;
}

.storage-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  color: #bdbdbd;
  margin-bottom: 1rem;
}

.storage-dropzone--active {
  border-color: #64b5f6;
  background: rgba(100, 181, 246, 0.08);
}

.storage-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 1rem;
  width: max-content;
  min-width: 100%;
  padding-bottom: 0.5rem;
}

.storage-card {
  position: relative;
  flex: 0 0 180px;
  width: 180px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  cursor: default;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.storage-card--folder {
  cursor: pointer;
}

.storage-card--protected {
  background: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.16);
}

.storage-card--protected .storage-card__thumb {
  background: #242424;
}

.storage-card--protected:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.storage-card--back {
  border-style: dashed;
  border-color: rgba(144, 202, 249, 0.35);
  background: rgba(20, 28, 38, 0.95);
}

.storage-card--back .storage-card__thumb {
  color: #90caf9;
  font-size: 2rem;
}

.storage-card--dragging {
  opacity: 0.45;
}

.storage-card--drop-target {
  border-color: #64b5f6;
  box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.45);
  transform: translateY(-2px);
}

.storage-back-btn.storage-card--drop-target,
.storage-back-btn:hover {
  border-color: #64b5f6;
}

.storage-back-btn {
  border: 1px dashed rgba(144, 202, 249, 0.35);
}

.storage-workspace__scroll.storage-dropzone--active,
.storage-dropzone.storage-dropzone--active {
  outline: 2px dashed rgba(100, 181, 246, 0.55);
  outline-offset: -4px;
  background: rgba(100, 181, 246, 0.06);
}

.storage-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.storage-card__thumb {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e1e1e;
  font-size: 2.5rem;
}

.storage-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.storage-card__thumb--pdf {
  position: relative;
  background: #1e1e1e;
}

.storage-card__thumb-pdf-badge {
  position: absolute;
  inset: auto 0.5rem 0.5rem auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
}

.storage-card--file.storage-card--previewable {
  cursor: pointer;
}

.storage-preview {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.storage-preview[hidden] {
  display: none !important;
}

.storage-preview__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.88);
  cursor: pointer;
}

.storage-preview__panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85);
}

.storage-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.storage-preview__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-word;
}

.storage-preview__close {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 2px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.storage-preview__body {
  overflow: auto;
  padding: 1rem;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.storage-preview__image,
.storage-preview__video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
  background: #050505;
}

.storage-preview__video {
  width: 100%;
}

.storage-preview__loading,
.storage-preview__error {
  margin: 0;
  color: #bdbdbd;
  text-align: center;
}

body.storage-preview-open {
  overflow: hidden;
}

.storage-card__body {
  padding: 0.75rem;
}

.storage-card__title {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.storage-card__meta {
  margin: 0;
  font-size: 0.75rem;
  color: #9e9e9e;
}

.storage-card__menu {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

.storage-empty {
  text-align: center;
  color: #9e9e9e;
  padding: 3rem 1rem;
}

.storage-upload-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(360px, calc(100vw - 2rem));
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 50;
}

.storage-upload-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.storage-upload-panel__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

.storage-upload-list {
  max-height: 240px;
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
}

.storage-upload-row + .storage-upload-row {
  margin-top: 0.75rem;
}

.storage-upload-row__name {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.storage-upload-row__bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.storage-upload-row__bar span {
  display: block;
  height: 100%;
  background: #64b5f6;
}

.storage-upload-row__meta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #9e9e9e;
}

.storage-menu {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 0.35rem;
}

.storage-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.storage-menu__item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.storage-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  background: #141414;
  color: #fff;
  max-width: calc(100vw - 2rem);
  width: 420px;
}

.storage-modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.storage-modal__inner {
  padding: 1.25rem;
}

.storage-modal__inner h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.storage-modal__hint {
  color: #bdbdbd;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.storage-field {
  display: block;
  margin-bottom: 1rem;
}

.storage-field span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.storage-field input[type='text'],
.storage-field input[type='password'],
.storage-field input[type='file'] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0a0a0a;
  color: #fff;
}

.storage-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.storage-share-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.storage-share-row input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0a0a0a;
  color: #fff;
}

.btn--danger {
  background: #c62828;
  color: #fff;
}

/* Tablet */
@media (max-width: 1024px) {
  .storage-main {
    padding: 0.5rem;
  }

  .storage-workspace {
    border-radius: 10px;
  }

  .storage-card {
    flex-basis: 160px;
    width: 160px;
  }

  .storage-card__thumb {
    height: 100px;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .tools-storage-page {
    padding-top: var(--header-height, 64px);
  }

  .storage-main {
    padding: 0.35rem;
  }

  .storage-workspace__header {
    padding: 0.75rem 0.85rem 0.65rem;
  }

  .storage-workspace__scroll {
    padding: 0.75rem 0.85rem 0.85rem;
  }

  .storage-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .storage-toolbar__right {
    text-align: left;
  }

  .storage-card {
    flex-basis: 140px;
    width: 140px;
  }

  .storage-card__thumb {
    height: 88px;
    font-size: 2rem;
  }
}

/* Very small phones */
@media (max-width: 400px) {
  .storage-card {
    flex-basis: 120px;
    width: 120px;
  }
}
