/* =====================================================================
   dashboard.css — SSW Dashboard (saved websites)
   Layout: FIXED square tiles (w=h), responsive column count
   Sections: General | PC | Tablet | Mobile
===================================================================== */

/* -------------------- General -------------------- */

* { box-sizing: border-box; }

/* Strict, fixed sizes (overridden in breakpoints) */
:root{
  --dash-tile-size: 90px;   /* tile box (width = height) */
  --dash-icon-size: 60px;   /* icon size inside the tile */
  --dash-gap: 14px;
}

.dashboard-body{
  margin: 0px;
  padding: 0px;
  background: var(--color-bg);
  color: var(--color-text);
}

.visually-hidden{
  position: absolute !important;
  clip: rect(1px,1px,1px,1px) !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.dash-wrap{
  /*max-width: var(--content-max);*/
  max-width: auto;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
  padding-top: 18px;
  padding-bottom: 40px;
}

.dash-top{
  margin-bottom: 14px;
}

.dash-actions{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
  justify-content: start;
  align-items: center;
  margin-bottom: 10px;
}

.dash-btn{
  display: inline-block;

  /* Make <a> and <button> look identical */
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.1;
  font-weight: 600;

  padding-left: 8px;
  padding-right: 8px;
  padding-top: 8px;
  padding-bottom: 10px;

  border-radius: 10px;
  border: 1px solid var(--color-border);

  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;

  cursor: pointer;
}

button.dash-btn{
  appearance: none;
  -webkit-appearance: none;
}

.dash-btn:hover{
  background: var(--color-accent-bg-hover);
}

.dash-btn-accent{
  border-color: rgba(230,126,0,0.8);
}

.dash-help{
  color: var(--color-muted);
  font-size: 1.0rem;
}

/* -------------------- Empty-state backup actions -------------------- */

.dash-empty-tip{
  opacity: 0.85;
}

.dash-empty-actions{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

/* Tablet+ : put buttons in a row */
@media (min-width: 768px){
  .dash-empty-actions{
    grid-template-columns: max-content max-content max-content;
    justify-content: center;
  }
}

/* -------------------- Grid (FIXED TILES) -------------------- */

.dash-grid{
  display: grid;

  /* Fixed-size columns; browser fits as many as possible per row */
  grid-template-columns: repeat(auto-fill, var(--dash-tile-size));

  gap: var(--dash-gap);

  /* Distribute tiles regularly across the available row width */
  justify-content: space-between;

  align-content: start;
  align-items: start;
}

.dash-item{
  position: relative;

  /* Strict fixed tile size */
  width: var(--dash-tile-size);
  height: var(--dash-tile-size) + 20px;

  display: grid;
  grid-template-rows: var(--dash-icon-size) auto;
  gap: 6px;

  padding-left: 8px;
  padding-right: 8px;
  padding-top: 8px;
  padding-bottom: 8px;

  border-radius: 10px;
  /*border: 1px solid var(--color-border);*/
  border: 2px solid rgba(0,0,0,0.3);

  background: var(--color-surface);
  text-decoration: none;
  color: var(--color-text);

  overflow: hidden;
}

.dash-item:hover{
  border-color: rgba(255,165,0,1.0);
  background: rgba(255,255,255,1.0);
}

.dash-icon{
  width: var(--dash-icon-size);
  height: var(--dash-icon-size);
  margin-left: auto;
  margin-right: auto;

  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
}

.dash-name{
  font-size: 0.8rem;
  line-height: 1.1;
  text-align: center;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-remove{
  position: absolute;
  top: 1px;
  right: 1px;

  width: 22px;
  height: 22px;

  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.1);
  color: var(--color-text);

  cursor: pointer;
  z-index: 3;
}

.dash-remove:hover{
  background: rgba(255,165,0,0.3);
}

/* Empty state */
.dash-empty{
  margin-top: 24px;
}

.dash-empty-box{
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 12px;

  padding-left: 10px;
  padding-right: 10px;
  padding-top: 10px;
  padding-bottom: 10px;

  max-width: 520px;
}

.dash-empty-title{
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.dash-empty-text{
  color: var(--color-muted);
  margin-bottom: 12px;
}

/* -------------------- PC -------------------- */
@media (min-width: 1024px){
  :root{
    --dash-icon-size: 90px;   /* requested */
    --dash-tile-size: 110px;  /* fixed tile box (w=h) */
    --dash-gap: 12px;
  }
}

/* -------------------- Tablet -------------------- */
@media (min-width: 768px) and (max-width: 1023px){
  :root{
    --dash-icon-size: 60px;   /* requested */
    --dash-tile-size: 90px;
    --dash-gap: 10px;
  }
}

/* -------------------- Mobile -------------------- */
@media (max-width: 767px){
  :root{
    --dash-icon-size: 50px;   /* requested */
    --dash-tile-size: 80px;
    --dash-gap: 6px;
  }

  /* Mobile: Open Directory on its own row, then Install + Clear in one line */
  .dash-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .dash-actions{
    display: grid;

    /* ✅ IMPORTANT overrides (otherwise desktop rule keeps everything in one row) */
    grid-auto-flow: row;
    grid-auto-columns: unset;

    grid-template-columns: 1fr;
    gap: 10px;
    justify-content: stretch;
    align-items: stretch;
  }

  .dash-btn{
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
  }

  .dash-name{
    font-size: 0.75rem;
  }
}

