@layer components {
  /* ------------------------------------------------------------------
     Shared list-row layout for the Notes, Bookmarks and Videos lists.

     Each list only adds:
       - its leading visual (favicon / thumbnail / icon) in the
         `.item-row-lead` slot, sized via the `--lead-col` and
         `--lead-gap` custom properties;
       - any read / watched state styling.

     Everything else — spacing, typography, the favorite star, the mobile
     two-row grid and the three-dots alignment — lives here, so the three
     lists stay in sync and only need to be tweaked in one place.
     ------------------------------------------------------------------ */

  .item-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 4rem;
  }

  .item-row {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.3rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
  }

  .item-row:hover {
    background-color: white;
  }

  .item-row:hover .item-row-main {
    color: black;
  }

  .item-row-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.75rem;
    padding: 2px;
    overflow: hidden;
    flex: 1;
  }

  .item-row-link {
    display: flex;
    align-items: center;
    gap: 0.25rem 0.75rem;
    min-width: 0;
    overflow: hidden;
    flex: 1;
  }

  .item-row-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
    flex: 1;
  }

  /* Leading visual slot (favicon wrap / thumbnail / icon). `--lead-col`
     controls how wide its column is in the mobile grid. */
  .item-row-lead {
    position: relative;
    flex-shrink: 0;
  }

  .item-row-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .item-row[data-favorite-favorite=true] {
    background-color: #e4ffed;
  }

  .item-row[data-favorite-favorite=true]:hover {
    background-color: #d1f0dc;
  }

  .item-row-meta {
    font-size: 0.8em;
    color: #a0a0a0;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .item-row-actions {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
  }

  .item-row-actions .mobile-row-menu-action {
    display: none;
  }

  .item-row-actions .dropdown {
    margin-bottom: -5px;
  }

  /* Favorite star — identical across all three lists. */
  .item-row-favorite {
    display: block;
    color: #e5e7eb;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.3s ease;
  }

  .item-row-favorite:hover {
    color: #fcd34d;
  }

  .item-row[data-favorite-favorite=true] .item-row-favorite {
    color: #15803d;
  }

  .item-row[data-favorite-favorite=true] .item-row-favorite:hover {
    color: #16a34a;
  }

  @media (max-width: 640px) {
    .item-row {
      padding: 0.42rem 0.25rem;
      gap: 0.25rem;
    }

    .item-row-main {
      padding: 0;
      overflow: visible;
    }

    /* Two-row grid: the leading visual sits in column 1 spanning both
       rows; title above meta in column 2. */
    .item-row-link {
      display: grid;
      grid-template-columns: var(--lead-col, 24px) minmax(0, 1fr);
      grid-template-rows: auto auto;
      column-gap: var(--lead-gap, 0.4rem);
      row-gap: 0.05rem;
      align-items: center;
    }

    .item-row-title {
      display: contents;
    }

    .item-row-lead {
      grid-column: 1;
      grid-row: 1 / span 2;
      justify-self: center;
    }

    .item-row-title-text,
    .item-row-meta {
      grid-column: 2;
      min-width: 0;
      padding-left: 0;
    }

    .item-row-title-text {
      font-size: 0.98rem;
      line-height: 1.2;
    }

    .item-row-meta {
      font-size: 0.74rem;
      line-height: 1.2;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .item-row-actions {
      flex: 0 0 auto;
      gap: 0.05rem;
      margin-left: 0.15rem;
    }

    /* Inline action buttons collapse into the dropdown menu on mobile. */
    .item-row-actions .item-row-inline-action {
      display: none;
    }

    .item-row-actions .mobile-row-menu-action {
      display: block;
    }

    .item-row-favorite {
      width: 1.55rem;
      height: 1.55rem;
      padding: 0;
      justify-content: center;
    }

    .item-row-actions .dropdown {
      margin-bottom: 0;
      --icon-size: 1.25rem;
    }
  }
}
