/* =========================================================
   Divi File Manager – dfm.css
   ========================================================= */

.dfm-app {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  max-width: 960px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
}

/* ---- Toolbar ---- */
.dfm-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.dfm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 200px;
  flex-wrap: wrap;
}

.dfm-bc-item {
  cursor: pointer;
  color: #3b82f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  transition: background .15s;
  white-space: nowrap;
}
.dfm-bc-item:hover { background: #eff6ff; }
.dfm-bc-active { color: #64748b; cursor: default; font-weight: 600; }
.dfm-bc-active:hover { background: transparent; }
.dfm-bc-sep { color: #94a3b8; font-size: 12px; }

.dfm-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- Buttons ---- */
.dfm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.dfm-btn:active { transform: scale(.97); }

.dfm-btn-primary  { background: #3b82f6; color: #fff; }
.dfm-btn-primary:hover  { background: #2563eb; }

.dfm-btn-secondary { background: #e0f2fe; color: #0369a1; }
.dfm-btn-secondary:hover { background: #bae6fd; }

.dfm-btn-ghost { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.dfm-btn-ghost:hover { background: #f1f5f9; }

.dfm-upload-label { cursor: pointer; }

/* ---- Progress ---- */
.dfm-upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
}
.dfm-progress-bar {
  flex: 1;
  height: 6px;
  background: #dbeafe;
  border-radius: 99px;
  overflow: hidden;
}
.dfm-progress-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 99px;
  transition: width .2s ease;
}
#dfm-progress-text { font-size: 12px; color: #3b82f6; min-width: 36px; text-align: right; }

/* ---- Flash ---- */
.dfm-flash {
  margin: 12px 20px 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.dfm-flash-success { background: #dcfce7; color: #166534; }
.dfm-flash-error   { background: #fee2e2; color: #991b1b; }

/* ---- List header ---- */
.dfm-list-header {
  display: grid;
  grid-template-columns: 36px 1fr 90px 130px 110px;
  align-items: center;
  padding: 8px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ---- List rows ---- */
.dfm-list { min-height: 120px; }

.dfm-row {
  display: grid;
  grid-template-columns: 36px 1fr 90px 130px 110px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .1s;
}
.dfm-row:last-child { border-bottom: none; }
.dfm-row:hover { background: #f8fafc; }

.dfm-col-icon { font-size: 18px; line-height: 1; }
.dfm-col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 12px; }
.dfm-col-size { color: #64748b; font-size: 12px; }
.dfm-col-date { color: #94a3b8; font-size: 12px; }

/* ---- Folder/file link ---- */
.dfm-link {
  background: none;
  border: none;
  cursor: pointer;
  color: #3b82f6;
  padding: 0;
  font: inherit;
  font-weight: 500;
}
.dfm-link:hover { text-decoration: underline; }

/* ---- Row actions ---- */
.dfm-row-actions { display: flex; gap: 4px; }
.dfm-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .15s;
  line-height: 1;
}
.dfm-icon-btn:hover { background: #e2e8f0; }
.dfm-icon-del:hover { background: #fee2e2; }

/* ---- Empty / Loading ---- */
.dfm-empty, .dfm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 14px;
}

.dfm-spinner {
  width: 18px; height: 18px;
  border: 2px solid #cbd5e1;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: dfm-spin .7s linear infinite;
}
@keyframes dfm-spin { to { transform: rotate(360deg); } }

/* ---- Drag over ---- */
.dfm-drag-over { background: #eff6ff !important; outline: 2px dashed #3b82f6; outline-offset: -4px; }

/* ---- Modal ---- */
.dfm-modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  backdrop-filter: blur(2px);
}

.dfm-modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}

.dfm-modal-box h3 {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.dfm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin-bottom: 18px;
  transition: border-color .15s;
}
.dfm-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.dfm-modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Notice ---- */
.dfm-notice {
  padding: 16px 20px;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 8px;
  color: #713f12;
  font-size: 14px;
}
.dfm-notice a { color: #2563eb; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .dfm-list-header,
  .dfm-row {
    grid-template-columns: 30px 1fr 80px;
  }
  .dfm-col-size { display: none; }
  .dfm-col-date { display: none; }
  .dfm-col-actions { grid-column: 3; }

  .dfm-toolbar { padding: 10px 14px; }
  .dfm-list-header,
  .dfm-row { padding: 9px 14px; }
}
