/* Presentations — Windows-XP-flavored Explorer chrome */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Tahoma, "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  background: #3a6ea5;
  min-height: 100vh;
}

.hidden { display: none !important; }

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ---------- window / dialog chrome ---------- */
.window, .dialog {
  background: #ece9d8;
  border: 1px solid #0831d9;
  border-radius: 8px 8px 3px 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  overflow: hidden;
}

.window {
  width: min(920px, 100%);
  height: min(620px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
}

.titlebar {
  background: linear-gradient(180deg, #0997ff 0%, #0053ee 12%, #0050ee 88%, #06f 100%);
  color: #fff;
  font-weight: bold;
  font-size: 13px;
  padding: 6px 10px;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.titlebar-icon { text-shadow: none; }

.titlebar-btn {
  margin-left: auto;
  font: inherit;
  font-size: 11px;
  color: #fff;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
}
.titlebar-btn:hover { background: rgba(255, 255, 255, .3); }

/* ---------- toolbar / addressbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-bottom: 1px solid #d8d2bd;
  flex: 0 0 auto;
}

.tool-btn {
  font: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
}
.tool-btn:hover { border-color: #b8b2a0; background: #f6f4ea; }
.tool-btn:disabled { opacity: .4; cursor: default; }
.tool-btn:disabled:hover { border-color: transparent; background: transparent; }

.tool-sep { width: 1px; height: 18px; background: #d8d2bd; margin: 0 4px; }

.addressbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-bottom: 1px solid #d8d2bd;
  flex: 0 0 auto;
}
.address-label { color: #666; }

.breadcrumb {
  flex: 1;
  background: #fff;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  padding: 4px 8px;
  white-space: nowrap;
  overflow-x: auto;
}
.breadcrumb .crumb { color: #06c; cursor: pointer; }
.breadcrumb .crumb:hover { text-decoration: underline; }
.breadcrumb .crumb-sep { color: #999; margin: 0 4px; }
.breadcrumb .crumb-current { color: #000; }

/* ---------- content pane ---------- */
.content {
  position: relative;
  flex: 1 1 auto;
  background: #fff;
  overflow-y: auto;
  padding: 12px;
}
.content.dragover { outline: 2px dashed #0050ee; outline-offset: -6px; }

.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(208, 227, 252, .85);
  font-size: 16px;
  color: #0050ee;
  font-weight: bold;
  pointer-events: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
  align-content: start;
}

/* full-width section headers inside the grid (My folders / Shared with me) */
.grid-section {
  grid-column: 1 / -1;
  color: #1a4a8a;
  font-weight: bold;
  border-bottom: 1px solid #d8e4f0;
  padding: 6px 2px 3px;
  margin-top: 4px;
}

.item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  user-select: none;
}
.item:hover { background: #e8f0fb; border-color: #bcd4f0; }

.item .icon { width: 52px; height: 52px; position: relative; }
.item .icon svg { width: 100%; height: 100%; display: block; }

.item .label {
  max-width: 104px;
  word-break: break-all;
  line-height: 1.25;
}
.item .sub { color: #888; font-size: 10px; }

/* corner badges on file icons */
.badge {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #aaa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.badge:hover { transform: scale(1.15); border-color: #0050ee; }
.badge-visibility { right: -8px; top: -6px; }
.badge-visibility.public { border-color: #2c8a2c; background: #eaffea; }
.badge-share { right: -8px; bottom: 6px; }
.badge-download { left: -8px; bottom: 6px; color: #0050ee; }
.badge-delete { left: -8px; top: -6px; font-size: 10px; color: #b00; display: none; }
.item:hover .badge-delete { display: flex; }

/* inline new-folder input */
.item.new-folder input {
  font: inherit;
  width: 100px;
  text-align: center;
  border: 1px solid #7f9db9;
  padding: 2px;
}

.empty-hint {
  color: #888;
  text-align: center;
  padding: 48px 16px;
  font-size: 13px;
}

/* ---------- statusbar ---------- */
.statusbar {
  border-top: 1px solid #d8d2bd;
  padding: 4px 10px;
  color: #444;
  flex: 0 0 auto;
  background: #ece9d8;
}

/* ---------- login + share dialogs ---------- */
.login-dialog { width: 320px; }
.share-dialog { width: min(440px, calc(100vw - 32px)); }

.dialog-body { padding: 16px; }

.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.form-row label { width: 80px; text-align: right; }
.form-row input {
  flex: 1;
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
}

.form-error { color: #c00; min-height: 16px; margin: 2px 0 8px 88px; }
.form-actions { text-align: right; }

.btn {
  font: inherit;
  padding: 4px 20px;
  background: #ece9d8;
  border: 1px solid #003c74;
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 #fff;
  cursor: pointer;
}
.btn:active { box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .2); }
.btn-small { padding: 3px 10px; white-space: nowrap; }

/* share modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}

.share-note { margin-bottom: 12px; }
.share-label { display: block; color: #666; margin: 10px 0 3px; }

.copy-row { display: flex; gap: 6px; }
.copy-row input {
  flex: 1;
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  background: #fff;
}

.share-user-list {
  border: 1px solid #d8d2bd;
  border-radius: 2px;
  background: #fff;
  max-height: 160px;
  overflow-y: auto;
}
.share-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid #f0ede0;
}
.share-user-row:last-child { border-bottom: none; }
.share-empty { color: #888; padding: 8px; }
.share-form-error { margin: 6px 0 0; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  #explorer-view.screen { padding: 0; }

  .window {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .toolbar { flex-wrap: wrap; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }

  /* 16px inputs stop iOS from auto-zooming on focus */
  .form-row input, .copy-row input, .item.new-folder input { font-size: 16px; }

  /* stack login rows */
  .form-row { flex-direction: column; align-items: stretch; gap: 3px; }
  .form-row label { width: auto; text-align: left; }
  .form-error { margin-left: 0; }

  .copy-row { flex-wrap: wrap; }
  .copy-row input { min-width: 0; }
}

/* touch devices: no hover, so keep delete badges visible and grow tap targets */
@media (pointer: coarse) {
  .badge { width: 28px; height: 28px; font-size: 14px; }
  .badge-delete { display: flex; font-size: 12px; }
  .tool-btn { padding: 8px 10px; }
  .titlebar-btn { padding: 5px 10px; }
  .btn { padding: 8px 20px; }
  .item { padding: 12px 4px 10px; }
}
