/* ---------- Komod packages page ---------- */

.drop-zone {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    margin-bottom: 16px;
    border: 2px dashed var(--neutral-stroke-rest, #b3b3b3);
    border-radius: 8px;
    background: var(--neutral-layer-1, #fff);
    transition: border-color 0.15s, background 0.15s;
}

.drop-zone > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-fill-rest, #0f6cbd);
    background: color-mix(in srgb, var(--accent-fill-rest, #0f6cbd) 6%, var(--neutral-layer-1, #fff));
}

.drop-zone.busy {
    opacity: 0.7;
}

/* The real file input covers the zone, so both clicking and dropping a file work natively. */
.drop-zone .drop-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.komod-toolbar {
    margin-bottom: 8px;
    align-items: center !important;
}

.komod-search {
    min-width: 260px;
}

.view-toggle {
    display: flex;
    gap: 2px;
}

.result-count {
    margin: 4px 0 8px;
    font-size: 0.85rem;
}

.table-scroll {
    overflow-x: auto;
}

.package-table td:first-child {
    min-width: 200px;
    max-width: 420px;
}

/* Medium widths: the description is in the expandable details anyway. */
@media (max-width: 1100px) {
    .package-table .package-description {
        display: none;
    }
}

.package-row {
    cursor: pointer;
}

.package-row:hover {
    background: var(--neutral-fill-stealth-hover, #f5f5f5);
}

.package-row .expander {
    display: inline-block;
    width: 1em;
    color: var(--neutral-foreground-hint, #616161);
}

.package-description {
    font-size: 0.85rem;
    margin: 2px 0 0;
}

.package-details-row > td {
    background: var(--neutral-layer-2, #f5f5f5);
}

.package-details {
    padding: 8px 4px 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.package-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    box-shadow: none;
}

.package-card.status-disabled {
    opacity: 0.75;
}

.package-card.status-failed {
    border-color: #c42b1c;
}

.package-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.package-meta {
    font-size: 0.85rem;
}

.package-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: auto;
}

.badge.status-loaded { background: #d1f0d6; color: #0e5a1c; }
.badge.status-disabled { background: var(--neutral-fill-secondary-rest, #e0e0e0); }
.badge.status-failed { background: #fbd5d5; color: #8a1010; }

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chip {
    font-size: 0.75rem;
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-fill-rest, #0f6cbd) 14%, transparent);
    white-space: nowrap;
}

.chip.chip-subtle {
    background: var(--neutral-fill-secondary-rest, #e8e8e8);
}

.komod-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.komod-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.port-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* Port color is derived from the payload type id (same hue everywhere, e.g. later in the graph editor). */
.port-chip {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 6px;
    border-left: 4px solid hsl(var(--port-hue, 200) 65% 45%);
    background: hsl(var(--port-hue, 200) 65% 50% / 0.12);
    cursor: help;
}

.port-chip code {
    opacity: 0.75;
    margin-left: 4px;
}

.hash {
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

/* Komod description page (store package README, rendered by the server) */
.komod-readme { line-height: 1.6; overflow-wrap: anywhere; }
.komod-readme img { max-width: 100%; height: auto; border-radius: 6px; }
.komod-readme pre { overflow-x: auto; padding: 8px; border-radius: 6px; background: var(--neutral-layer-2); }
.komod-readme table { border-collapse: collapse; }
.komod-readme th, .komod-readme td { border: 1px solid var(--neutral-stroke-rest); padding: 4px 8px; }
.komod-readme blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--neutral-stroke-rest); opacity: .85; }
