/* ===== Typography & font (Vazirmatn everywhere) ===== */
html {
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}
.page-header,
.file-tree,
.breadcrumb-bar,
.search-bar,
.card-folder,
.card-file,
#playerModal,
input,
button,
a {
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
}

/* ===== Layout & utilities ===== */
.bg-gray-100 { background-color: #f1f5f9; }
.min-h-screen { min-height: 100vh; }
.p-5 { padding: 1.25rem; }
.max-w-5xl { max-width: 64rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.bg-white { background-color: #fff; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05); }
.rounded-xl { border-radius: 0.75rem; }
.p-6 { padding: 1.5rem; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.mb-6 { margin-bottom: 1.5rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-bold { font-weight: 700; }
.text-blue-700 { color: #1d4ed8; }
.text-center { text-align: center; }
.flex-1 { flex: 1 1 0%; }
.w-32 { width: 8rem; }
.h-32 { height: 8rem; }
.object-contain { object-fit: contain; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.ml-4 { margin-left: 1rem; }
.mr-4 { margin-right: 1rem; }
.bg-blue-50 { background-color: #eff6ff; }
.border { border-width: 1px; border-style: solid; border-color: #e5e7eb; }
.border-blue-200 { border-color: #bfdbfe; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.p-3 { padding: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.underline { text-decoration: underline; }
.hover\:text-blue-800:hover { color: #1e40af; }
.w-full { width: 100%; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px; }
.focus\:ring-blue-300:focus { box-shadow: 0 0 0 2px #93c5fd; outline: none; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.bg-black { background-color: #000; }
.bg-opacity-70 { background-color: rgb(0 0 0 / 0.7); }
.hidden { display: none; }
.justify-center { justify-content: center; }
.z-50 { z-index: 50; }
.rounded-2xl { border-radius: 1rem; }
.w-11\/12 { width: 91.666667%; }
.relative { position: relative; }
.absolute { position: absolute; }
.top-2 { top: 0.5rem; }
.left-2 { left: 0.5rem; }
.bg-red-600 { background-color: #dc2626; }
.hover\:bg-red-700:hover { background-color: #b91c1c; }
.text-white { color: #fff; }
.rounded-full { border-radius: 9999px; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.mt-4 { margin-top: 1rem; }
.ml-4 { margin-left: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.transition { transition: all 0.2s ease; }
.pr-3 { padding-right: 0.75rem; }
@media (min-width: 768px) { .md\:w-2\/3 { width: 66.666667%; } }
@media (min-width: 1024px) { .lg\:w-1\/2 { width: 50%; } }

/* ===== Card view (no borders on list items) ===== */
.file-tree { list-style: none; padding: 0; margin: 0; }
.file-tree > li { margin-bottom: 0.5rem; }
.file-tree ul { list-style: none; padding: 0; margin: 0; padding-right: 0.75rem; margin-top: 0.5rem; border-right: 2px solid #e2e8f0; }
.file-tree ul > li { margin-bottom: 0.5rem; }

/* Folder card - clean card, no border */
.card-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.875rem 1rem;
  background: #f8fafc;
  color: #1e40af;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  text-align: right;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.card-folder:hover {
  background: #eff6ff;
  box-shadow: 0 2px 8px rgb(30 64 175 / 0.12);
}
.card-folder:active { transform: scale(0.99); }
.card-folder .folder-icon { font-size: 1.25rem; margin-left: 0.5rem; flex-shrink: 0; }
.card-folder .folder-name { flex: 1; word-break: break-word; line-height: 1.5; }
.card-folder .folder-arrow { flex-shrink: 0; transition: transform 0.25s ease; color: #64748b; }

/* File card - clean card, no border */
.card-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: #fff;
  color: #334155;
  font-size: 0.9375rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  text-align: right;
  text-decoration: none;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
  transition: background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
}
.card-file:hover {
  background: #f8fafc;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
  color: #1e40af;
}
.card-file .file-icon { font-size: 1.25rem; flex-shrink: 0; }
.card-file .file-name { flex: 1; word-break: break-word; line-height: 1.5; }

/* Section labels (optional) */
.section-label {
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}
.section-label:first-child { margin-top: 0; }

/* Search input - nicer look */
.search-bar {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 1rem;
  width: 100%;
  margin-bottom: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-bar:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15);
  outline: none;
}
.search-bar::placeholder { color: #94a3b8; }
.search-wrap { position: relative; }
.search-wrap .search-icon-pos { right: 1rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-bar-with-icon { padding-right: 2.5rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }

/* Breadcrumb bar */
.breadcrumb-bar {
  background: #f0f9ff;
  color: #1e40af;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.breadcrumb-bar a { color: #1d4ed8; text-decoration: none; font-weight: 500; }
.breadcrumb-bar a:hover { text-decoration: underline; }
.breadcrumb-path { flex: 1; min-width: 0; }
.breadcrumb-link { color: #1d4ed8; }
.breadcrumb-sep { color: #94a3b8; user-select: none; }
.breadcrumb-current { color: #1e40af; }

/* Toolbar */
.toolbar { padding: 0.5rem 0; }
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.toolbar-btn:hover { background: #e2e8f0; color: #1e40af; border-color: #cbd5e1; }
.recent-label { font-size: 0.875rem; color: #64748b; }
.recent-select {
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  background: #fff;
  color: #334155;
  min-width: 10rem;
}
.recent-select:focus { outline: none; border-color: #93c5fd; box-shadow: 0 0 0 2px rgb(59 130 246 / 0.2); }
.hidden { display: none !important; }

/* Dark mode */
html.dark-mode { color-scheme: dark; }
html.dark-mode body { background: #1e293b; }
html.dark-mode .max-w-5xl.mx-auto { background: #0f172a; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3); }
html.dark-mode .text-blue-700 { color: #93c5fd; }
html.dark-mode .breadcrumb-bar { background: #1e3a5f; color: #93c5fd; }
html.dark-mode .breadcrumb-bar a { color: #93c5fd; }
html.dark-mode .breadcrumb-current { color: #bfdbfe; }
html.dark-mode .search-bar { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark-mode .search-bar::placeholder { color: #64748b; }
html.dark-mode .card-folder { background: #1e293b; color: #93c5fd; }
html.dark-mode .card-folder:hover { background: #334155; }
html.dark-mode .card-file { background: #1e293b; color: #cbd5e1; }
html.dark-mode .card-file:hover { background: #334155; color: #93c5fd; }
html.dark-mode .file-tree ul { border-right-color: #334155; }
html.dark-mode .toolbar-btn { background: #334155; border-color: #475569; color: #cbd5e1; }
html.dark-mode .toolbar-btn:hover { background: #475569; color: #93c5fd; }
html.dark-mode .recent-select { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark-mode .no-results.visible { color: #94a3b8; }
html.dark-mode #playerModal .bg-white { background: #1e293b; }
html.dark-mode #playerModal .bg-white .icon { stroke: #e2e8f0; }

/* Empty state */
.empty-hint {
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
  color: #94a3b8;
  font-size: 0.9375rem;
  padding: 1.5rem;
  text-align: center;
}

/* ===== SVG Icons (local, no external) ===== */
.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; }
.card-folder .folder-icon .icon { width: 1.5rem; height: 1.5rem; color: #1e40af; }
.card-folder .folder-arrow .icon { width: 1rem; height: 1rem; color: #64748b; }
.card-file .file-icon .icon { width: 1.25rem; height: 1.25rem; }
.search-wrap .icon { width: 1.125rem; height: 1.125rem; color: #94a3b8; }
.breadcrumb-bar .icon { width: 1rem; height: 1rem; vertical-align: -0.2em; }
.btn-close .icon { width: 1.25rem; height: 1.25rem; }

/* Loading state */
.file-tree-wrapper { position: relative; min-height: 3rem; }
.file-tree-wrapper.tree-loading { opacity: 0.7; pointer-events: none; }
.file-tree-wrapper.tree-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  margin: -1rem 0 0 -1rem;
  border: 2px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.no-results { display: none; padding: 1.5rem; text-align: center; color: #64748b; font-size: 0.9375rem; }
.no-results.visible { display: block; }
