/* =========================================================
   LYNNZZ OS — ALGORITHM LAB
========================================================= */

.algo-wrap{
  display:flex;
  width:100%;
  height:100%;
  min-height:0;
  overflow:hidden;
  background:var(--void);
  color:var(--text);
}

.algo-sidebar{
  width:205px;
  flex-shrink:0;
  padding:14px 10px;
  border-right:1px solid var(--border);
  background:rgba(10,10,18,.72);
  overflow-y:auto;
}

.algo-brand{
  display:flex;
  align-items:center;
  gap:9px;
  padding:4px 6px 16px;
}

.algo-brand-icon{
  width:38px;
  height:38px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:11px;
  background:rgba(168,85,247,.14);
  border:1px solid rgba(168,85,247,.25);
  font-size:20px;
}

.algo-brand-title{
  font-size:13px;
  font-weight:700;
}

.algo-brand-sub{
  margin-top:2px;
  font-size:9px;
  color:var(--muted);
}

.algo-section-label{
  padding:8px 8px 6px;
  font-size:9px;
  font-weight:700;
  letter-spacing:.12em;
  color:var(--muted);
}

.algo-item{
  width:100%;
  min-height:52px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px;
  margin-bottom:4px;
  border:1px solid transparent;
  border-radius:10px;
  background:transparent;
  color:var(--text);
  text-align:left;
  cursor:pointer;
  transition:.16s ease;
}

.algo-item > span{
  width:30px;
  height:30px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  background:var(--surface-2);
  flex-shrink:0;
}

.algo-item strong{
  display:block;
  font-size:11px;
  font-weight:600;
}

.algo-item small{
  display:block;
  margin-top:3px;
  font-size:9px;
  color:var(--muted);
}

.algo-item:hover{
  background:var(--surface-2);
}

.algo-item.active{
  background:rgba(168,85,247,.13);
  border-color:rgba(168,85,247,.28);
}

.algo-item.active > span{
  background:rgba(168,85,247,.18);
}

.algo-content{
  flex:1;
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;
  overflow-y:auto;
}

.algo-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.algo-kicker{
  font-size:9px;
  letter-spacing:.14em;
  color:var(--violet);
  font-weight:700;
}

.algo-header h2{
  margin:3px 0 2px;
  font-size:18px;
}

.algo-header p{
  margin:0;
  font-size:10px;
  color:var(--muted);
}

.algo-run-btn{
  flex-shrink:0;
  border:0;
  border-radius:10px;
  padding:10px 14px;
  background:var(--violet);
  color:#fff;
  font-size:11px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 8px 24px rgba(168,85,247,.18);
}

.algo-run-btn:hover{
  filter:brightness(1.08);
}

.algo-run-btn:active{
  transform:scale(.96);
}

.algo-config-card,
.algo-visual-card,
.algo-log-card{
  border:1px solid var(--border);
  border-radius:13px;
  background:rgba(255,255,255,.025);
  overflow:hidden;
}

.algo-card-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  font-size:10px;
  font-weight:700;
  color:var(--text);
}

.algo-card-title span{
  font-size:9px;
  color:var(--violet);
}

#algo-config{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
  padding:12px;
}

.algo-field{
  display:flex;
  flex-direction:column;
  gap:5px;
}

.algo-field label{
  font-size:9px;
  color:var(--muted);
}

.algo-field input{
  width:100%;
  box-sizing:border-box;
  padding:8px 9px;
  border:1px solid var(--border);
  border-radius:8px;
  outline:none;
  background:var(--surface-2);
  color:var(--text);
  font-size:11px;
}

.algo-field input:focus{
  border-color:var(--violet);
}

#algo-visual{
  min-height:170px;
  padding:12px;
}

.algo-empty{
  min-height:145px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:var(--text);
}

.algo-empty-icon{
  margin-bottom:8px;
  font-size:32px;
}

.algo-empty small{
  margin-top:5px;
  color:var(--muted);
  font-size:9px;
}

.algo-result{
  min-height:145px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}

.algo-result-label{
  font-size:9px;
  letter-spacing:.12em;
  color:var(--muted);
}

.algo-result-value{
  margin:4px 0;
  font-size:38px;
  font-weight:800;
  color:var(--violet);
}

.algo-result-target{
  font-size:10px;
  color:var(--muted);
}

.algo-progress{
  width:min(280px,80%);
  height:5px;
  margin-top:12px;
  overflow:hidden;
  border-radius:99px;
  background:var(--surface-2);
}

.algo-progress > div{
  height:100%;
  border-radius:inherit;
  background:var(--violet);
  transition:width .35s ease;
}

.algo-log-card{
  flex-shrink:0;
}

#algo-log{
  max-height:100px;
  margin:0;
  padding:10px 12px;
  overflow:auto;
  white-space:pre-wrap;
  font-family:monospace;
  font-size:9px;
  line-height:1.55;
  color:var(--muted);
}

.sort-bars{
  height:170px;
  display:flex;
  align-items:flex-end;
  gap:2px;
  background:rgba(0,0,0,.35);
  border-radius:10px;
  padding:8px;
  overflow:hidden;
}

.sort-bar{
  flex:1;
  min-width:2px;
  background:var(--violet);
  border-radius:2px 2px 0 0;
  transition:background .1s;
}

.sort-bar.compare{ background:#facc15; }
.sort-bar.swap{ background:#ff2e63; }
.sort-bar.done{ background:#86efac; }

.algo-placeholder{
  grid-column:1/-1;
  padding:14px;
  border-radius:9px;
  background:var(--surface-2);
  color:var(--muted);
  font-size:10px;
}

@media(max-width:600px){

  .algo-sidebar{
    width:145px;
  }

  .algo-content{
    padding:10px;
  }

  .algo-header{
    align-items:flex-start;
  }

  .algo-header h2{
    font-size:15px;
  }

  .algo-header p{
    max-width:170px;
  }

  .algo-run-btn{
    padding:9px 10px;
    font-size:10px;
  }

  #algo-config{
    grid-template-columns:repeat(2,1fr);
  }

  .algo-item strong{
    font-size:10px;
  }
}

/* =========================================================
   A* PATHFINDING
========================================================= */

.astar-grid{
  width:min(420px,100%);
  aspect-ratio:1;
  margin:0 auto;
  display:grid;
  grid-template-columns:repeat(12,1fr);
  gap:3px;
}

.astar-cell{
  min-width:0;
  min-height:0;
  padding:0;
  border:1px solid var(--border);
  border-radius:4px;
  background:var(--surface-2);
  color:var(--text);
  font-size:9px;
  font-weight:700;
  cursor:pointer;
  transition:.12s ease;
}

.astar-cell:hover{
  transform:scale(.94);
}

.astar-start{
  background:var(--violet);
  color:#fff;
}

.astar-end{
  background:#ef4444;
  color:#fff;
}

.astar-obstacle{
  background:#181824;
  border-color:#2d2d3a;
}

.astar-open{
  background:rgba(59,130,246,.35);
}

.astar-closed{
  background:rgba(168,85,247,.22);
}

.astar-path{
  background:var(--violet);
  color:#fff;
  box-shadow:0 0 10px rgba(168,85,247,.35);
}

.astar-controls{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin-top:12px;
}

.astar-hint{
  font-size:9px;
  color:var(--muted);
}

@media(max-width:600px){
  .astar-grid{
    width:min(300px,100%);
    gap:2px;
  }

  .astar-controls{
    flex-direction:column;
  }
}


.astar-tools{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:5px;
}

.astar-tool{
  padding:7px 9px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface-2);
  color:var(--text);
  font-size:9px;
  cursor:pointer;
  transition:.15s ease;
}

.astar-tool:hover{
  border-color:var(--violet);
}

.astar-tool.active{
  background:rgba(168,85,247,.15);
  border-color:rgba(168,85,247,.4);
  color:var(--violet);
}

@media(max-width:600px){
  .astar-tools{
    width:100%;
  }

  .astar-tool{
    flex:1;
  }
}


.algo-field select{
  width:100%;
  box-sizing:border-box;
  padding:8px 9px;
  border:1px solid var(--border);
  border-radius:8px;
  outline:none;
  background:var(--surface-2);
  color:var(--text);
  font-size:11px;
  cursor:pointer;
}

.algo-field select:focus{
  border-color:var(--violet);
}


.astar-maze-tools{
  display:flex;
  justify-content:center;
  gap:6px;
  margin-top:8px;
}

@media(max-width:600px){
  .astar-maze-tools{
    flex-wrap:wrap;
  }
}


/* Dataset Manager */
.dataset-section-label{
  margin-top:18px;
}

.dataset-wrap{
  width:100%;
  height:100%;
  box-sizing:border-box;
  padding:18px;
  overflow:auto;
}

.dataset-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:16px;
}

.dataset-eyebrow{
  font-size:9px;
  color:var(--violet);
  font-weight:800;
  letter-spacing:1.2px;
}

.dataset-header h2{
  margin:4px 0;
  font-size:22px;
}

.dataset-header p{
  margin:0;
  color:var(--muted);
  font-size:11px;
}

.dataset-upload{
  flex-shrink:0;
  padding:10px 13px;
  border:1px solid var(--violet);
  border-radius:10px;
  background:rgba(168,85,247,.12);
  color:var(--text);
  font-size:11px;
  font-weight:700;
  cursor:pointer;
  transition:.15s ease;
}

.dataset-upload:hover{
  background:rgba(168,85,247,.22);
}

.dataset-upload input{
  display:none;
}

.dataset-stats{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  margin-bottom:14px;
}

.dataset-stat{
  padding:11px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface-2);
}

.dataset-stat span{
  display:block;
  color:var(--muted);
  font-size:9px;
  margin-bottom:4px;
}

.dataset-stat strong{
  display:block;
  font-size:13px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.dataset-preview{
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(10,10,18,.55);
  overflow:hidden;
}

.dataset-preview-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:11px 12px;
  border-bottom:1px solid var(--border);
}

.dataset-preview-head strong{
  font-size:11px;
}

.dataset-preview-head span{
  color:var(--muted);
  font-size:9px;
}

.dataset-table-wrap{
  max-width:100%;
  overflow:auto;
}

#dataset-table{
  width:100%;
  border-collapse:collapse;
  font-size:10px;
  white-space:nowrap;
}

#dataset-table th,
#dataset-table td{
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  border-right:1px solid var(--border);
  text-align:left;
}

#dataset-table th{
  background:rgba(168,85,247,.08);
  color:var(--violet);
  font-weight:800;
  position:sticky;
  top:0;
}

#dataset-table tr:last-child td{
  border-bottom:0;
}

.dataset-empty{
  padding:30px !important;
  text-align:center !important;
  color:var(--muted);
}

.dataset-config-info{
  display:flex;
  align-items:center;
  gap:9px;
  padding:10px;
  border:1px solid var(--border);
  border-radius:9px;
  background:var(--surface-2);
}

.dataset-config-info > span{
  font-size:20px;
}

.dataset-config-info strong,
.dataset-config-info small{
  display:block;
}

.dataset-config-info strong{
  font-size:11px;
}

.dataset-config-info small{
  margin-top:2px;
  color:var(--muted);
  font-size:9px;
}

@media(max-width:600px){

  .dataset-wrap{
    padding:12px;
  }

  .dataset-header{
    align-items:flex-start;
    flex-direction:column;
  }

  .dataset-upload{
    width:100%;
    box-sizing:border-box;
    text-align:center;
  }

  .dataset-stats{
    grid-template-columns:1fr 1fr;
  }

  .dataset-stat:last-child{
    grid-column:1 / -1;
  }
}


/* Dataset Manager V2 */

.dataset-back{
  margin:0 0 8px 0;
  padding:5px 9px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface-2);
  color:var(--muted);
  font-size:10px;
  cursor:pointer;
  transition:.15s ease;
}

.dataset-back:hover{
  color:var(--text);
  border-color:var(--violet);
}

.dataset-actions{
  display:flex;
  align-items:center;
  gap:7px;
}

.dataset-clear{
  padding:10px 11px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface-2);
  color:var(--muted);
  font-size:10px;
  font-weight:700;
  cursor:pointer;
  transition:.15s ease;
}

.dataset-clear:hover{
  border-color:#ef4444;
  color:#ef4444;
}

@media(max-width:600px){

  .dataset-actions{
    width:100%;
  }

  .dataset-actions > *{
    flex:1;
  }

  .dataset-upload{
    text-align:center;
  }
}

/* =========================================================
   COMPARE (A* VS DIJKSTRA)
========================================================= */

.compare-result{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  width:100%;
}

.compare-card{
  background:rgba(255,255,255,.025);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.compare-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  font-weight:700;
  color:var(--text);
  padding-bottom:6px;
  border-bottom:1px solid var(--border);
}

.compare-status{
  font-size:10px;
  font-weight:700;
  padding:4px 8px;
  border-radius:6px;
  background:rgba(168,85,247,.15);
  color:var(--violet);
  display:inline-block;
  align-self:flex-start;
}

.compare-stat{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:11px;
  color:var(--muted);
  padding:2px 0;
}

.compare-stat strong{
  color:var(--text);
  font-weight:600;
}

@media(max-width:600px){
  .compare-result{
    grid-template-columns:1fr;
  }
}

