/* DOCS APP — AIR-ELEC V2 */

.docs-app {
  height: 100%;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  background: white;
}

/* ─── Empty state ─── */
.docs-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
}
.docs-empty-inner {
  text-align: center;
  max-width: 360px;
}
.docs-empty-icon {
  width: 56px;
  height: 56px;
  color: var(--gray-300);
  margin-bottom: 16px;
}
.docs-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 8px;
}
.docs-empty-text {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0 0 24px;
  line-height: 1.5;
}
.docs-empty-text code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.docs-load-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s;
}
.docs-load-btn:hover { background: var(--green-light); }

/* ─── Toolbar ─── */
.docs-loaded { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.docs-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 12px;
  border-bottom: 0.5px solid var(--gray-200);
  background: white;
  flex-shrink: 0;
}
.docs-tb-left { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.docs-nav-btn {
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.docs-nav-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.docs-tb-divider {
  width: 0.5px;
  height: 20px;
  background: var(--gray-200);
  margin: 0 2px;
}
.docs-tb-count { font-size: 12px; color: var(--gray-500); font-weight: 500; }
.docs-tb-center { flex: 1; display: flex; justify-content: center; }
.docs-tb-search {
  position: relative;
  max-width: 280px;
  width: 100%;
}
.docs-tb-search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--gray-400);
}
.docs-tb-search-input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  background: var(--gray-50);
  border: 0.5px solid var(--gray-200);
  border-radius: 7px;
  font-size: 12px;
  outline: none;
  font-family: var(--font-sans);
  box-sizing: border-box;
}
.docs-tb-search-input:focus { background: white; border-color: var(--green); }

/* ─── Body: sidebar list + reader ─── */
.docs-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.docs-list {
  width: 220px;
  min-width: 220px;
  border-right: 0.5px solid var(--gray-200);
  background: white;
  display: flex;
  flex-direction: column;
}
.docs-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.docs-list-scroll::-webkit-scrollbar { width: 5px; }
.docs-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12); border-radius: 3px;
}
.docs-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  margin-bottom: 1px;
}
.docs-file-item:hover { background: var(--gray-50); }
.docs-file-item.active {
  background: rgba(90,158,53,0.1);
}
.docs-file-item-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); flex-shrink: 0;
}
.docs-file-item.active .docs-file-item-icon {
  background: var(--green); color: white;
}
.docs-file-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-800);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Reader ─── */
.docs-reader {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
}
.docs-reader-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px 40px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.7;
  font-size: 14px;
  color: var(--gray-800);
}
.docs-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  margin: 0 0 20px;
}
.docs-table-wrapper table {
  width: auto;
  min-width: 100%;
  margin: 0;
}
.docs-reader-body::-webkit-scrollbar { width: 6px; }
.docs-reader-body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12); border-radius: 3px;
}
.docs-reader-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gray-300);
}
.docs-reader-welcome-icon {
  width: 48px; height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.docs-reader-welcome p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
}

/* ─── Markdown rendered styles ─── */
.docs-reader-body h1 {
  font-size: 24px; font-weight: 700; color: var(--gray-900);
  margin: 0 0 16px; padding-bottom: 8px;
  border-bottom: 0.5px solid var(--gray-200);
}
.docs-reader-body h2 {
  font-size: 18px; font-weight: 700; color: var(--gray-900);
  margin: 24px 0 10px;
}
.docs-reader-body h3 {
  font-size: 15px; font-weight: 600; color: var(--gray-800);
  margin: 20px 0 8px;
}
.docs-reader-body h4, .docs-reader-body h5, .docs-reader-body h6 {
  font-size: 14px; font-weight: 600; color: var(--gray-700);
  margin: 16px 0 6px;
}
.docs-reader-body p { margin: 0 0 12px; }
.docs-reader-body strong { font-weight: 700; color: var(--gray-900); }
.docs-reader-body em { font-style: italic; }
.docs-reader-body del { text-decoration: line-through; color: var(--gray-400); }
.docs-reader-body a { color: #007aff; text-decoration: none; }
.docs-reader-body a:hover { text-decoration: underline; }
.docs-reader-body ul, .docs-reader-body ol {
  margin: 0 0 12px; padding-left: 24px;
}
.docs-reader-body li { margin-bottom: 4px; }
.docs-reader-body li > ul, .docs-reader-body li > ol { margin-top: 4px; margin-bottom: 0; }
.docs-reader-body blockquote {
  margin: 0 0 16px; padding: 10px 14px;
  background: #f8faf6; border-left: 3px solid var(--green);
  border-radius: 6px; color: var(--gray-700); font-size: 13px;
}
.docs-reader-body blockquote p { margin: 0; }
.docs-reader-body pre {
  margin: 0 0 16px; padding: 14px 16px;
  background: #1e1e2e; color: #cdd6f4;
  border-radius: 10px; overflow-x: auto;
  font-size: 12px; line-height: 1.5;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}
.docs-reader-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.docs-reader-body code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
}
.docs-reader-body .docs-code-inline {
  background: #f0f0f0; padding: 2px 5px; border-radius: 4px; color: #d63384;
}
.docs-reader-body hr { border: none; border-top: 0.5px solid var(--gray-200); margin: 24px 0; }
.docs-reader-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 0 20px;
  font-size: 12px;
  border: 0.5px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.docs-reader-body table thead { display: table-header-group; }
.docs-reader-body table th {
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #f4f5f6;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 0.5px solid var(--gray-200);
}
.docs-reader-body table td {
  padding: 9px 12px;
  border-bottom: 0.5px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}
.docs-reader-body table tr:last-child td { border-bottom: none; }
.docs-reader-body table tr:nth-child(even) td { background: #fafbfc; }
.docs-reader-body table tr:hover td { background: #f0f7ee; }
.docs-reader-body img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.docs-reader-body input[type="checkbox"] {
  margin-right: 6px; accent-color: var(--green); pointer-events: none; vertical-align: -1px;
}

/* ─── Home : grille de dossiers ─── */
.docs-home {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--gray-50);
}
.docs-home-header {
  text-align: center;
  padding: 36px 24px 20px;
}
.docs-home-header-icon {
  width: 36px; height: 36px;
  color: var(--green);
  margin-bottom: 10px;
}
.docs-home-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 6px;
}
.docs-home-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
}
.docs-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 0 24px 32px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.docs-folder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: all 0.15s;
}
.docs-folder-card:hover {
  border-color: var(--green-mid);
  box-shadow: 0 2px 8px rgba(90,158,53,0.1);
}
.docs-folder-card-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--green-pale);
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.docs-folder-card-info {
  flex: 1;
  min-width: 0;
}
.docs-folder-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 2px;
}
.docs-folder-card-desc {
  font-size: 11px;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-folder-card-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-400);
  white-space: nowrap;
  flex-shrink: 0;
}
.docs-breadcrumb {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

/* ─── File list improvements ─── */
.docs-file-item-excerpt {
  display: none;
  font-size: 11px;
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 650px) {
  .docs-file-item { display: flex; align-items: flex-start; }
  .docs-file-item-excerpt {
    display: block;
    flex: 1;
    text-align: right;
    max-width: 180px;
    margin-left: auto;
  }
}
.docs-empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

/* ─── Folder view ─── */
.docs-folder-view {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.docs-tb-count {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 500;
}

/* ─── Reader back button (mobile) ─── */
.docs-reader-back {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--gray-200);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  font-family: var(--font-sans);
  flex-shrink: 0;
}
.docs-hidden { display: none !important; }

/* ─── Mobile responsive ─── */
@media (max-width: 767px) {
  .docs-toolbar { padding: 6px 10px; }
  .docs-tb-center { width: 100%; order: 3; }
  .docs-tb-search { max-width: 100%; }
  .docs-tb-search-input { font-size: 16px; }
  #docs-list-panel { width: 100%; min-width: 0; border-right: none; display: flex; flex-direction: column; }
  #docs-list-panel.hidden { display: none; }
  .docs-reader { display: none; flex-direction: column; width: 100%; }
  .docs-reader.active { display: flex; }
  .docs-reader-back { display: flex; }
  .docs-reader-body { padding: 16px 14px; }
  .docs-home-grid { grid-template-columns: 1fr; padding: 0 14px 24px; }
  .docs-home-header { padding: 20px 14px 16px; }
  .docs-folder-card { padding: 12px; }
  .docs-folder-view { flex-direction: column; }
}
