/* ═══════════════════════════════════════════════════════════
   DASHBOARD — Unified dark palette matching canvas/editor
   ═══════════════════════════════════════════════════════════ */

/* ── Modal backdrop ── */
.dashboard-modal {
  position: fixed; inset: 0;
  padding: 60px 4vw 4vh 4vw;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
  z-index: 9999;
  display: flex; justify-content: center; align-items: flex-start;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: hidden;
}
.dashboard-modal.opening {
  opacity: 1; pointer-events: auto;
}

/* ── Container card ── */
.dashboard-container {
  position: relative;
  width: 100%; max-width: 1100px;
  height: 100%; max-height: 88dvh;
  background: rgba(18,18,18,0.96);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: visible;
  transform: scale(0.96);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
}
.dashboard-modal.opening .dashboard-container {
  transform: scale(1);
}

/* ── Close button — small circle floating at top-right edge ── */
.dashboard-close-btn {
  position: absolute; top: -8px; right: -8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #2a2a2a;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5);
  cursor: pointer; z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: background 0.15s ease, color 0.15s ease;
}
.dashboard-close-btn:hover {
  background: #3a3a3a;
  color: rgba(255,255,255,0.9);
}
.dashboard-close-cross {
  position: relative; width: 7px; height: 7px;
}
.dashboard-close-cross::before,
.dashboard-close-cross::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 100%; height: 1px; background: currentColor; transform-origin: center;
}
.dashboard-close-cross::before { transform: translate(-50%,-50%) rotate(45deg); }
.dashboard-close-cross::after  { transform: translate(-50%,-50%) rotate(-45deg); }

/* ═══════════════════════════════════════════════════════════
   GRID LAYOUT
   ═══════════════════════════════════════════════════════════ */
.dashboard-modal .dashboard-content {
  flex: 1; padding: 20px;
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  height: 100%; width: 100%; overflow: hidden;
  border-radius: 16px;
}

/* ── Section cards ── */
.dashboard-modal .projects-section,
.dashboard-modal .file-management-section,
.dashboard-modal .jobs-section {
  background: #151515;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.dashboard-modal .projects-section {
  grid-column: 1; grid-row: 1 / 3;
}
.dashboard-modal .file-management-section {
  grid-column: 2; grid-row: 1;
}
.dashboard-modal .jobs-section {
  grid-column: 2; grid-row: 2;
}

/* ═══════════════════════════════════════════════════════════
   SHARED: section titles
   ═══════════════════════════════════════════════════════════ */
.projects-title,
.file-management-title,
.jobs-title {
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 12px; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SHARED: table header row
   ═══════════════════════════════════════════════════════════ */
.files-header,
.jobs-header {
  padding: 0 12px; margin: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 0.04em;
  min-height: 28px;
  position: sticky; top: 0; z-index: 1;
  background: #151515;
  box-sizing: border-box;
}
.files-header .header-column,
.jobs-header .header-column {
  display: flex; align-items: center; justify-content: flex-start;
  cursor: pointer; transition: color 0.1s ease;
}
.files-header .header-column:hover,
.jobs-header .header-column:hover {
  color: rgba(255,255,255,0.7);
}
.sort-chevron {
  width: 0; height: 0;
  border-left: 3px solid transparent; border-right: 3px solid transparent;
  opacity: 0.5; transition: all 0.2s ease; margin-left: 3px;
}
.sort-chevron.desc { border-top: 4px solid currentColor; opacity: 1; }
.sort-chevron.asc  { border-bottom: 4px solid currentColor; opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   SHARED: scrollbar styling
   ═══════════════════════════════════════════════════════════ */
.projects-list::-webkit-scrollbar,
.files-table::-webkit-scrollbar,
.jobs-table::-webkit-scrollbar {
  width: 4px; background: transparent;
}
.projects-list::-webkit-scrollbar-track,
.files-table::-webkit-scrollbar-track,
.jobs-table::-webkit-scrollbar-track {
  background: transparent;
}
.projects-list::-webkit-scrollbar-thumb,
.files-table::-webkit-scrollbar-thumb,
.jobs-table::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08); border-radius: 2px;
}
.projects-list,
.files-table,
.jobs-table {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

/* ═══════════════════════════════════════════════════════════
   PROJECTS SECTION
   ═══════════════════════════════════════════════════════════ */

/* Top row: search + create */
.projects-top-row {
  display: flex; gap: 8px; margin-bottom: 10px; flex-shrink: 0;
}
.projects-search { flex: 2; margin: 0; }
.projects-search-input {
  width: 100%; height: 28px; padding: 0 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; color: rgba(255,255,255,0.85);
  font-size: 12px; font-family: inherit; outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.projects-search-input::placeholder { color: rgba(255,255,255,0.3); }
.projects-search-input:hover { border-color: rgba(255,255,255,0.12); }
.projects-search-input:focus {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
}

/* Create button */
.create-project-btn {
  flex-shrink: 0; height: 28px; padding: 0 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--abya-accent, #0066cc); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 11px; font-weight: 600; font-family: inherit;
  transition: background 0.15s ease;
}
.create-project-btn:hover { background: var(--abya-accent-hover, #0073e6); }

/* Projects list */
.projects-list {
  flex: 1; overflow-y: auto;
  margin: 0; padding: 0; min-height: 0;
  list-style: none;
}

/* Project item */
.project-item {
  padding: 8px 10px; cursor: pointer;
  border-radius: 8px; position: relative;
  overflow: visible; box-sizing: border-box;
  transition: background 0.12s ease;
}
.project-item:hover { background: rgba(255,255,255,0.04); }
.project-item.expanded { background: rgba(255,255,255,0.06); }

.project-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0; width: 100%; min-height: 32px;
}
.project-left {
  display: flex; flex-direction: column; gap: 2px;
  flex-grow: 1; min-width: 0; align-items: flex-start;
}
.project-name {
  font-size: 13px; color: rgba(255,255,255,0.9); font-weight: 500; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.project-date {
  font-size: 11px; color: rgba(255,255,255,0.4); margin: 0;
}

/* Project details (expandable) */
.project-details {
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  padding: 0; margin-top: 4px;
}
.project-item.expanded .project-details {
  max-height: 150px; opacity: 1; padding: 4px 0;
}
.project-detail-row {
  display: flex; justify-content: space-between;
  margin-bottom: 2px; font-size: 11px; color: rgba(255,255,255,0.45);
}
.project-detail-label { font-weight: 500; }
.project-detail-value { color: rgba(255,255,255,0.45); text-align: right; }

.project-files-list {
  max-height: 60px; overflow-y: auto; margin-top: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.project-files-list::-webkit-scrollbar { width: 3px; }
.project-files-list::-webkit-scrollbar-track { background: transparent; }
.project-files-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.project-file-item {
  font-size: 11px; color: rgba(255,255,255,0.5);
  padding: 1px 0; display: flex; align-items: center; gap: 6px;
}
.project-file-icon { color: var(--abya-accent, #0066cc); font-size: 9px; }

/* ── 3-dot menu ── */
.project-menu-wrapper {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 4px; cursor: pointer;
}
.project-menu-btn {
  background: none; border: none;
  color: rgba(255,255,255,0); font-size: 14px;
  cursor: pointer; padding: 2px; line-height: 1;
  transition: color 0.15s ease;
  pointer-events: none;
}
.project-item:hover .project-menu-btn {
  color: rgba(255,255,255,0.4); pointer-events: auto;
}
.project-menu-btn:hover { color: rgba(255,255,255,0.7); }

/* Dropdown */
.project-menu {
  position: absolute; top: 100%; right: 0;
  min-width: 160px;
  background: rgba(24,24,24,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 4px;
  opacity: 0; visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.15s ease;
  z-index: 9999;
  overflow: visible;
}
.project-menu.expanded {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.project-menu-item {
  width: 100%; padding: 6px 10px;
  background: none; border: none;
  color: rgba(255,255,255,0.65); font-size: 12px;
  text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  border-radius: 5px;
  transition: background 0.1s ease, color 0.1s ease;
}
.project-menu-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}

/* Inline rename input */
.project-name-input {
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.9); background: transparent;
  border: 1px solid rgba(255,255,255,0.12); border-radius: 4px;
  padding: 1px 4px; outline: none;
  width: auto; min-width: 40px; display: inline-block;
}
.project-name-input:focus { border-color: rgba(255,255,255,0.25); }

/* Delete confirm */
.project-menu-item.project-menu-item-delete.confirm-delete {
  color: #ff453a !important; font-weight: 600 !important;
}

/* ═══════════════════════════════════════════════════════════
   FILES SECTION
   ═══════════════════════════════════════════════════════════ */

/* Storage bar */
.storage-header {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 12px; flex-shrink: 0;
}
.storage-bar {
  width: 100%; height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px; position: relative; overflow: hidden;
}
.storage-bar-fill {
  --used: 75;
  width: calc(var(--used) * 1%);
  height: 100%; background: var(--abya-accent, #0066cc);
  border-radius: inherit; transition: width 0.4s ease;
}
.storage-info {
  display: flex; justify-content: space-between; font-size: 10px;
}
.storage-used, .storage-free {
  display: flex; align-items: center; gap: 5px;
  color: rgba(255,255,255,0.45);
}
.storage-text { font-weight: 500; }
.storage-amount { opacity: 0.8; }
.storage-dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.storage-dot-used { background: var(--abya-accent, #0066cc); }
.storage-dot-free { background: rgba(255,255,255,0.2); }

/* Files grid */
:root { --files-grid: 1fr 1fr 1fr 80px 32px; }

.files-table {
  flex: 1; display: flex; flex-direction: column;
  overflow-y: auto; min-height: 0;
}
.files-header {
  display: grid; grid-template-columns: var(--files-grid);
  align-items: center;
}

.storage-files {
  flex: 1; margin: 0; padding: 0; list-style: none; overflow: visible;
}

/* File rows */
.storage-file {
  position: relative;
  display: grid; grid-template-columns: var(--files-grid);
  align-items: center;
  padding: 0 12px; height: 32px; margin: 1px 3px;
  font-size: 12px; line-height: 1.3;
  box-sizing: border-box; color: rgba(255,255,255,0.65);
  border-radius: 6px;
  transition: background 0.12s ease;
}
.storage-file > div { display: flex; align-items: center; }
.storage-file:hover { background: rgba(255,255,255,0.04); }
.storage-file.selected { background: rgba(0,102,204,0.1) !important; }

.files-header > *, .storage-file > * { justify-self: flex-start; }

.file-name-col, .file-project-col, .file-date-col, .file-size-col {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.storage-file .file-name-col { font-weight: 500; }
.storage-file .file-project-col {}
.storage-file .file-date-col {}
.storage-file .file-size-col {}

.files-header .file-name-col,
.files-header .file-project-col,
.files-header .file-date-col,
.files-header .file-size-col { color: inherit; }

.header-size { justify-content: flex-start; }
.header-menu { justify-content: flex-end; }

.file-menu-col {
  display: flex; justify-content: flex-end; align-items: center;
}

/* 3-dot file button */
.remove-file-btn {
  font-size: 14px; line-height: 1;
  color: rgba(255,255,255,0.3);
  background: none; border: none; cursor: pointer;
  padding: 0; opacity: 0; transition: opacity 0.15s ease, color 0.15s ease;
}
.storage-file:hover .remove-file-btn { opacity: 1; }
.remove-file-btn:hover { color: rgba(255,255,255,0.7); }

/* ═══════════════════════════════════════════════════════════
   JOBS SECTION
   ═══════════════════════════════════════════════════════════ */
:root { --jobs-grid: 1fr 1fr 1fr 1fr 1fr; }

.jobs-table {
  flex: 1; display: flex; flex-direction: column;
  overflow-y: auto; min-height: 0;
}
.jobs-header {
  display: grid; grid-template-columns: var(--jobs-grid);
  align-items: center;
}

.job-row {
  display: grid; grid-template-columns: var(--jobs-grid);
  align-items: center;
  padding: 0 12px; height: 32px; margin: 1px 3px;
  font-size: 12px; line-height: 1.3;
  box-sizing: border-box;
  color: rgba(255,255,255,0.65);
  border-radius: 6px;
  transition: background 0.12s ease;
}
.job-row > div {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 2px 0;
}
.job-row:hover { background: rgba(255,255,255,0.04); }

.job-id-col { font-weight: 500; }
.job-status-col { font-weight: 500; }
.job-project-col {}
.job-submitted-col {}
.job-time-col {}

.job-project-col.deleted {
  color: #ff453a !important; font-style: italic; opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .dashboard-container { max-width: 96vw; }
  .dashboard-modal .dashboard-content { gap: 10px; padding: 16px; }
}
@media (max-width: 900px) {
  .dashboard-modal .dashboard-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px; padding: 14px;
  }
  .dashboard-modal .projects-section { grid-column: 1; grid-row: 1; }
  .dashboard-modal .file-management-section { grid-column: 1; grid-row: 2; }
  .dashboard-modal .jobs-section { grid-column: 1; grid-row: 3; }
}
@media (max-width: 600px) {
  .dashboard-modal { padding: 2vh 2vw; }
}

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════ */
:root[data-theme="light"] .dashboard-modal {
  background: rgba(255,255,255,0.5);
}
:root[data-theme="light"] .dashboard-container {
  background: rgba(250,250,252,0.97);
  border-color: rgba(0,0,0,0.06);
  box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}
:root[data-theme="light"] .dashboard-modal .projects-section,
:root[data-theme="light"] .dashboard-modal .file-management-section,
:root[data-theme="light"] .dashboard-modal .jobs-section {
  background: #f4f4f6;
  border-color: rgba(0,0,0,0.06);
}
:root[data-theme="light"] .dashboard-close-btn {
  background: #e8e8ea; border-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.45);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
:root[data-theme="light"] .dashboard-close-btn:hover {
  background: #dcdcde; color: rgba(0,0,0,0.8);
}

:root[data-theme="light"] .projects-title,
:root[data-theme="light"] .file-management-title,
:root[data-theme="light"] .jobs-title {
  color: rgba(0,0,0,0.4);
}

:root[data-theme="light"] .projects-search-input {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.85);
}
:root[data-theme="light"] .projects-search-input::placeholder { color: rgba(0,0,0,0.3); }
:root[data-theme="light"] .projects-search-input:focus {
  background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.15);
}

:root[data-theme="light"] .project-name { color: rgba(0,0,0,0.85); }
:root[data-theme="light"] .project-date { color: rgba(0,0,0,0.4); }
:root[data-theme="light"] .project-item:hover { background: rgba(0,0,0,0.03); }
:root[data-theme="light"] .project-item.expanded { background: rgba(0,0,0,0.04); }
:root[data-theme="light"] .project-detail-row,
:root[data-theme="light"] .project-detail-value { color: rgba(0,0,0,0.45); }

:root[data-theme="light"] .project-menu-btn { color: rgba(0,0,0,0); }
:root[data-theme="light"] .project-item:hover .project-menu-btn { color: rgba(0,0,0,0.35); }
:root[data-theme="light"] .project-menu-btn:hover { color: rgba(0,0,0,0.65); }

:root[data-theme="light"] .project-menu {
  background: rgba(255,255,255,0.96);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
:root[data-theme="light"] .project-menu-item { color: rgba(0,0,0,0.6); }
:root[data-theme="light"] .project-menu-item:hover {
  background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.85);
}

:root[data-theme="light"] .project-name-input {
  color: rgba(0,0,0,0.85); border-color: rgba(0,0,0,0.1); background: #fff;
}
:root[data-theme="light"] .project-name-input:focus { border-color: rgba(0,0,0,0.2); }

:root[data-theme="light"] .project-menu-item.project-menu-item-delete.confirm-delete {
  color: #d32f2f !important;
}

/* Storage */
:root[data-theme="light"] .storage-bar { background: rgba(0,0,0,0.05); }
:root[data-theme="light"] .storage-used,
:root[data-theme="light"] .storage-free { color: rgba(0,0,0,0.45); }
:root[data-theme="light"] .storage-dot-free { background: rgba(0,0,0,0.15); }

/* Files & Jobs headers and rows */
:root[data-theme="light"] .files-header,
:root[data-theme="light"] .jobs-header {
  background: #f4f4f6;
  border-bottom-color: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.35);
}
:root[data-theme="light"] .files-header .header-column:hover,
:root[data-theme="light"] .jobs-header .header-column:hover {
  color: rgba(0,0,0,0.7);
}
:root[data-theme="light"] .storage-file,
:root[data-theme="light"] .job-row {
  color: rgba(0,0,0,0.6);
}
:root[data-theme="light"] .storage-file:hover,
:root[data-theme="light"] .job-row:hover { background: rgba(0,0,0,0.03); }
:root[data-theme="light"] .storage-file.selected { background: rgba(0,102,204,0.08) !important; }

:root[data-theme="light"] .remove-file-btn { color: rgba(0,0,0,0.25); }
:root[data-theme="light"] .storage-file:hover .remove-file-btn { color: rgba(0,0,0,0.5); }
:root[data-theme="light"] .remove-file-btn:hover { color: rgba(0,0,0,0.7); }

:root[data-theme="light"] .files-table::-webkit-scrollbar-thumb,
:root[data-theme="light"] .jobs-table::-webkit-scrollbar-thumb,
:root[data-theme="light"] .projects-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
}

:root[data-theme="light"] .job-project-col.deleted { color: #d32f2f !important; }
