/* apps.css — styles for all viewer applications */

/* ── Shared scrollable body ── */
.fb-root, .iv-root, .vp-root, .pv-root {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}

/* ══════════════════════════════════════
   FILE BROWSER
══════════════════════════════════════ */

.fb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: #EAF0F7;
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0; gap: var(--sp-3);
}
.fb-header-info {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0;
}
.fb-folder-icon { width: 32px; height: 32px; flex-shrink: 0; }
.fb-folder-icon svg { width: 32px; height: 32px; }
.fb-folder-name {
  font-size: var(--text-md); font-weight: 600;
  color: var(--color-text-label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fb-folder-desc {
  font-size: var(--text-xs); color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 340px;
}
.fb-header-controls { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
.fb-count { font-size: var(--text-xs); color: var(--color-text-muted); }
.fb-view-toggle { display: flex; gap: 2px; }
.fb-view-btn {
  width: 26px; height: 26px; padding: 5px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.fb-view-btn svg { width: 14px; height: 14px; }
.fb-view-btn:hover { background: rgba(255,255,255,0.7); border-color: var(--color-divider); color: var(--color-text-primary); }
.fb-view-btn--active { background: white; border-color: var(--color-accent); color: var(--color-accent); }

.fb-search-bar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--color-divider);
  background: #F5F8FC;
  flex-shrink: 0;
}
.fb-search-icon { width: 14px; height: 14px; color: var(--color-text-muted); flex-shrink: 0; }
.fb-search-input {
  flex: 1; border: none; background: transparent;
  font-family: var(--font-ui); font-size: var(--text-sm);
  color: var(--color-text-primary); outline: none;
}
.fb-search-input::placeholder { color: var(--color-text-muted); }

/* Grid view */
.fb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--sp-3); padding: var(--sp-4);
  overflow-y: auto; flex: 1;
  align-content: start;
}

.fb-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  overflow: hidden; cursor: pointer;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.fb-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 3px 10px rgba(30,60,90,0.12);
  transform: translateY(-1px);
}
.fb-card-thumb {
  width: 100%; aspect-ratio: 4/3;
  background: #E4EDF6; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fb-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-thumb-placeholder { width: 48px; height: 48px; opacity: 0.5; }
.fb-thumb-placeholder svg { width: 48px; height: 48px; }
.fb-thumb-video::after {
  content: '▶';
  position: absolute;
  color: white;
  font-size: 22px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.fb-card-thumb { position: relative; }
.fb-card-label {
  font-size: var(--text-xs);
  padding: var(--sp-1) var(--sp-2) var(--sp-1);
  color: var(--color-text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
}
.fb-card-notes {
  font-size: 10px; color: var(--color-text-muted);
  padding: 0 var(--sp-2) var(--sp-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* List view */
.fb-list {
  display: flex; flex-direction: column;
  padding: var(--sp-2); overflow-y: auto; flex: 1;
  gap: 1px;
}
.fb-list-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition-fast);
}
.fb-list-item:hover { background: var(--color-card-hover); border-color: var(--color-divider); }
.fb-list-icon { width: 22px; height: 22px; flex-shrink: 0; }
.fb-list-icon svg { width: 22px; height: 22px; }
.fb-list-info { flex: 1; min-width: 0; }
.fb-list-name { font-size: var(--text-sm); font-weight: 500; color: var(--color-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-list-notes { font-size: var(--text-xs); color: var(--color-text-muted); }
.fb-list-type { font-size: var(--text-xs); color: var(--color-text-muted); font-family: var(--font-mono); flex-shrink: 0; }
.fb-list-date { font-size: var(--text-xs); color: var(--color-text-muted); flex-shrink: 0; }

.fb-empty {
  grid-column: 1/-1;
  text-align: center; color: var(--color-text-muted);
  font-size: var(--text-sm); padding: var(--sp-8);
}

/* ══════════════════════════════════════
   IMAGE VIEWER
══════════════════════════════════════ */

.iv-root { background: #1A2633; }

.iv-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-3);
  height: 38px;
  background: #1E2E3D;
  border-bottom: 1px solid #2A3F52;
  flex-shrink: 0; gap: var(--sp-3);
}
.iv-toolbar-left, .iv-toolbar-right {
  display: flex; align-items: center; gap: var(--sp-1);
  min-width: 140px;
}
.iv-toolbar-center { flex: 1; display: flex; justify-content: center; }
.iv-counter { font-size: var(--text-xs); color: #6A8FA8; font-family: var(--font-mono); }
.iv-zoom-label { font-size: var(--text-xs); color: #6A8FA8; font-family: var(--font-mono); min-width: 36px; text-align: center; }

.iv-btn {
  width: 28px; height: 28px; padding: 5px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer;
  color: #7A9BB5;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.iv-btn svg { width: 16px; height: 16px; }
.iv-btn:hover { background: rgba(255,255,255,0.08); border-color: #3A5068; color: #B0C8DC; }
.iv-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.iv-stage {
  flex: 1; display: flex; align-items: center; overflow: hidden; position: relative;
}
.iv-canvas {
  flex: 1; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: default; position: relative;
}
.iv-image {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  transform-origin: center center;
  transition: transform 0.1s ease;
  pointer-events: none;
  user-select: none;
}

.iv-nav {
  position: absolute; z-index: 5;
  width: 40px; height: 72px;
  background: rgba(20,35,50,0.55);
  border: none; border-radius: var(--radius-sm);
  color: #8BAFC8; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  top: 50%; transform: translateY(-50%);
}
.iv-nav svg { width: 20px; height: 20px; }
.iv-nav--prev { left: var(--sp-2); }
.iv-nav--next { right: var(--sp-2); }
.iv-nav:hover { background: rgba(30,50,70,0.85); color: #D0E4F4; }
.iv-nav:disabled { opacity: 0.2; cursor: not-allowed; }

.iv-caption {
  min-height: 32px; padding: var(--sp-2) var(--sp-4);
  background: #1E2E3D;
  border-top: 1px solid #2A3F52;
  font-size: var(--text-xs); color: #6A8FA8;
  flex-shrink: 0; display: flex; align-items: center;
}

/* ══════════════════════════════════════
   VIDEO PLAYER
══════════════════════════════════════ */

.vp-root { background: #111; }

.vp-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #000;
}
.vp-video {
  max-width: 100%; max-height: 100%;
  outline: none;
}
.vp-caption {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-xs); color: #6A8FA8;
  background: #1A1A1A;
  border-top: 1px solid #2A2A2A;
}

/* ══════════════════════════════════════
   PDF VIEWER
══════════════════════════════════════ */

.pv-root { background: var(--color-window-bg); }

.pv-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  background: #EAF0F7;
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}
.pv-filename {
  font-size: var(--text-sm); font-weight: 500; color: var(--color-text-label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-open-link {
  display: flex; align-items: center; gap: var(--sp-1);
  font-size: var(--text-xs); color: var(--color-accent);
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
  transition: color var(--transition-fast);
}
.pv-open-link svg { width: 12px; height: 12px; }
.pv-open-link:hover { color: var(--color-accent-hover); text-decoration: underline; }

.pv-frame {
  flex: 1; border: none; width: 100%;
  background: #fff;
}
.pv-caption {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-xs); color: var(--color-text-muted);
  border-top: 1px solid var(--color-divider);
  flex-shrink: 0;
}

/* ── Scrollbar styling ── */
.fb-grid::-webkit-scrollbar,
.fb-list::-webkit-scrollbar { width: 6px; }
.fb-grid::-webkit-scrollbar-track,
.fb-list::-webkit-scrollbar-track { background: transparent; }
.fb-grid::-webkit-scrollbar-thumb,
.fb-list::-webkit-scrollbar-thumb {
  background: var(--color-divider); border-radius: 3px;
}
.fb-grid::-webkit-scrollbar-thumb:hover,
.fb-list::-webkit-scrollbar-thumb:hover { background: #9BB0C4; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .os-window, .desktop-icon, .fb-card, .iv-btn,
  .taskbar-win-btn, .os-win-btn { transition: none !important; }
}
