/* =========================
   Layout för grid
   ========================= */

.tool-archive-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.tool-archive-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
}

/* Liten knapp för "Suggest" / "Contribute" */
.tool-suggest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 999px;
    background: #0f766e;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tool-suggest-btn:hover,
.tool-suggest-btn:focus-visible {
    background: #115e59;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.35);
    transform: translateY(-1px);
}

/* Grid för korten – liknande member-grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

/* =========================
   Filter-rad
   ========================= */

.tool-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.tool-filter-item {
    flex: 1 1 160px;
    min-width: 140px;
}

.tool-filter-search {
    flex: 2 1 260px;
}

.tool-filters input[type="text"],
.tool-filters select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid #d0d5dd;
    font-size: 0.95rem;
    background-color: #ffffff;
}

.tool-filter-reset {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #d0d5dd;
    background: #f9fafb;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.tool-filter-reset:disabled {
    opacity: 0.4;
    cursor: default;
}

/* =========================
   Kort-stil
   ========================= */

.tool-card {
    text-align: center;
    width: 280px;
    margin: 0 auto;
}

.tool-trigger {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    padding: 18px 20px 16px;
    text-align: center;
    cursor: pointer;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    height: 320px;
    overflow: hidden;
}

.tool-trigger:hover,
.tool-trigger:focus-visible {
    outline: none;
    border-color: #0f766e;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
}

.tool-image {
    width: auto;
    max-width: 260px;
    max-width: 100%;
    height: 150px;
    object-fit: contain;
    object-position: center;
    border-radius: 16px;
    background: #f9fafb;
    margin: 0 auto;
}

.tool-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #0f172a;
}

/* Små badges under titeln */

.tool-meta-line {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

/* Gemensam chip-stil */

.tool-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    cursor: pointer;
}

/* Färgvarianter */

.tool-chip-phase {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.tool-chip-type {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.tool-chip-tag {
    background: #fdf2ff;
    color: #a21caf;
    border-color: #f5d0fe;
}

/* =========================
   Modal – overlay + innehåll
   ========================= */

.tool-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}

.tool-modal.is-open {
    display: block;
}

.tool-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

/* Själva kortet i mitten */

.tool-modal-content {
    position: relative;
    max-width: 720px;
    margin: 48px auto;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    padding: 26px 28px 22px;
    z-index: 1;
    text-align: center;
}

@media (max-width: 768px) {
    .tool-modal-content {
        margin: 24px 16px;
        border-radius: 18px;
        padding: 20px 18px;
    }
}

/* Modal-bilden: samma format som grid (ingen beskärning) */

.tool-modal-image {
    width: auto;
    max-width: 260px;
    height: 180px;
    border-radius: 16px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
    background: #f9fafb;
}

/* Titel och badges */

.tool-modal-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.tool-modal-badges {
    text-align: center;
    margin: 0 0 12px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Rader med etikett + värde */

.tool-modal-row {
    margin: 4px 0;
    font-size: 0.94rem;
    color: #111827;
}

.tool-modal-row strong {
    font-weight: 600;
}

/* Beskrivning */

.tool-modal-description {
    margin-top: 10px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: #111827;
}

.tool-modal-description p {
    margin: 0 0 6px;
}

/* Actions-knapp(er) */

.tool-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 8px;
}

.tool-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 999px;
    background: #0f766e;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    text-decoration: none;
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tool-primary-btn:hover,
.tool-primary-btn:focus-visible {
    background: #115e59;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.35);
    transform: translateY(-1px);
}

/* Tagsrad i modal */

.tool-modal-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.tool-modal-tags strong {
    margin-right: 4px;
}

/* Stäng-knapp */

.tool-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
}

.tool-close:hover,
.tool-close:focus-visible {
    color: #111827;
}

/* Förhindra scroll i bakgrunden när modal är öppen */

body.tool-modal-open {
    overflow: hidden;
}

/* ===== Library submit form ===== */

.library-submit-form .library-type-group {
    display: none;
}

.library-submit-form.show-tool .library-type-tool {
    display: block;
}

.library-submit-form.show-resource .library-type-resource {
    display: block;
}

.library-submit-form .library-field {
    margin-bottom: 1rem;
}

.library-submit-form input[type="text"],
.library-submit-form input[type="url"],
.library-submit-form input[type="date"],
.library-submit-form textarea,
.library-submit-form select {
    width: 100%;
    max-width: 480px;
    border-radius: 999px;
    border: 1px solid #d0d5dd;
    padding: 8px 12px;
    font-size: 0.95rem;
}

.library-submit-form textarea {
    border-radius: 16px;
}

/* ikonval med miniatyrer */
.library-radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.library-radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.library-radio-option img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 8px;
}

.library-phase-checkboxes label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}