/* PPCA 2028 Admin — file manager and modal styles */

/* ── File manager screen ────────────────────────────────────────────────────── */

#screen-files { max-width: 100%; }

.fm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.fm-header h2 { color: var(--teal); font-size: 1.5rem; margin: 0; }

.fm-stats {
  display: flex;
  gap: 1.5rem;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .8rem;
}
.fm-stats strong { color: var(--teal); }

/* ── Upload dropzone ───────────────────────────────────────────────────────── */

.fm-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.8rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 1.5rem;
  background: rgba(0,180,166,.04);
}
.fm-upload-zone:hover, .fm-upload-zone.drag-over {
  border-color: var(--teal);
  background: rgba(0,180,166,.08);
}
.fm-upload-zone input[type=file] {
  display: none;
}
.fm-upload-icon { font-size: 2.2rem; margin-bottom: .5rem; display: block; }
.fm-upload-label { color: var(--muted); font-size: .88rem; }
.fm-upload-label strong { color: var(--teal); }
.fm-upload-formats { font-size: .72rem; color: rgba(138,180,200,.6); margin-top: .3rem; }

/* Upload progress */
.fm-progress-wrap {
  display: none;
  align-items: center;
  gap: .8rem;
  margin-top: .8rem;
  padding: .7rem 1rem;
  background: var(--navy3);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.fm-progress-wrap.visible { display: flex; }
.fm-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(0,180,166,.15);
  border-radius: 3px;
  overflow: hidden;
}
.fm-progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 3px;
  width: 0%;
  transition: width .3s ease;
}
.fm-progress-text { font-size: .78rem; color: var(--muted); white-space: nowrap; min-width: 100px; text-align: right; }

/* ── Search ────────────────────────────────────────────────────────────────── */

.fm-search-wrap {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.fm-search-wrap input {
  flex: 1;
  background: var(--navy3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .9rem;
  color: var(--text);
  font-size: .88rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.fm-search-wrap input:focus { border-color: var(--teal); }

/* ── File grid ─────────────────────────────────────────────────────────────── */

.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .9rem;
}

.fm-card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .8rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  transition: border-color .15s;
  position: relative;
}
.fm-card:hover { border-color: rgba(0,180,166,.4); }

.fm-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--navy3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fm-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* SVG file-type icons */
.fm-file-icon { color: var(--muted); }
.fm-file-icon.pdf { color: #e05555; }
.fm-file-icon.doc { color: #4dc9ff; }
.fm-file-icon.xls { color: #3cb97a; }
.fm-file-icon.vid { color: #f0c040; }
.fm-file-icon.aud { color: #a78bfa; }

/* File info */
.fm-card-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}
.fm-card-meta {
  font-size: .7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Card actions */
.fm-card-actions {
  display: flex;
  gap: .4rem;
  margin-top: .2rem;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */

.fm-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.fm-empty-icon { font-size: 3rem; margin-bottom: .5rem; display: block; opacity: .4; }

/* ── File modal (file browser picker) ──────────────────────────────────────── */

.fm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6,12,26,.85);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.fm-modal-overlay.open { display: flex; }

.fm-modal {
  background: var(--navy2);
  border: 1px solid var(--teal);
  border-radius: 14px;
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fm-modal-header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.fm-modal-title { font-size: 1.05rem; font-weight: 700; color: var(--teal); }
.fm-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: .2rem;
  border-radius: 4px;
  transition: color .15s;
}
.fm-modal-close:hover { color: var(--text); }

.fm-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
}

.fm-modal-search { margin-bottom: .8rem; }
.fm-modal-search input {
  width: 100%;
  background: var(--navy3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .55rem .8rem;
  color: var(--text);
  font-size: .88rem;
  font-family: inherit;
  outline: none;
}
.fm-modal-search input:focus { border-color: var(--teal); }

.fm-modal-tabs {
  display: flex;
  gap: .3rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.fm-tab-btn {
  background: var(--navy3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .7rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.fm-tab-btn:hover { border-color: var(--teal); color: var(--teal); }
.fm-tab-btn.active { background: rgba(0,180,166,.15); border-color: var(--teal); color: var(--teal); }

/* Modal grid (smaller cards) */
.fm-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .7rem;
}
.fm-modal-card {
  background: var(--navy3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  transition: border-color .15s;
  text-align: center;
}
.fm-modal-card:hover, .fm-modal-card.selected {
  border-color: var(--teal);
  background: rgba(0,180,166,.08);
}
.fm-modal-card.selected { box-shadow: 0 0 0 2px rgba(0,180,166,.3); }
.fm-modal-card-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 5px;
  overflow: hidden;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .2rem;
}
.fm-modal-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fm-modal-card-name { font-size: .72rem; color: var(--text); word-break: break-all; line-height: 1.3; }

.fm-modal-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: .85rem;
}

.fm-modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.fm-modal-hint { font-size: .78rem; color: var(--muted); }
.fm-select-actions { display: flex; gap: .6rem; }

/* ── Misc utilities ─────────────────────────────────────────────────────────── */

.btn-copy {
  background: rgba(0,180,166,.15);
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 7px;
  padding: .35rem .8rem;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
}
.btn-copy:hover { background: rgba(0,180,166,.25); }

.toast-copy {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy2);
  border: 1px solid var(--teal);
  color: var(--teal);
  border-radius: 8px;
  padding: .6rem 1.2rem;
  font-size: .82rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  z-index: 9999;
}
.toast-copy.show { opacity: 1; transform: translateX(-50%) translateY(0); }