/* ──────────────────────────────────────────────────────────
   Atlas One Tool Library
   Colors:  #ffffff | #788DE3 (accent) | #23304D (dark)
   Fonts:   "Horas" (headings) | "DM Sans" (body)
────────────────────────────────────────────────────────── */

.atl-tool-library {
    --atl-white:   #ffffff;
    --atl-accent:  #788DE3;
    --atl-dark:    #23304D;
    --atl-light:   #FAFAF8;
    --atl-border:  #DBE4ED;
    --atl-radius:  12px;
    --atl-heading: "Horas", Georgia, serif;
    --atl-body:    "DM Sans", system-ui, sans-serif;

    display: flex;
    gap: 36px;
    align-items: flex-start;
    font-family: var(--atl-body);
    color: var(--atl-dark);
    box-sizing: border-box;
}

.atl-tool-library *,
.atl-tool-library *::before,
.atl-tool-library *::after {
    box-sizing: inherit;
}

/* ── Filter Sidebar ───────────────────────────────────── */

.atl-filters {
    flex: 0 0 210px;
    background: var(--atl-white);
    border: 1px solid var(--atl-border);
    border-radius: var(--atl-radius);
    padding: 24px 20px;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.atl-filters__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.atl-filters__title {
    font-family: var(--atl-heading);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.04em;
    color: var(--atl-dark);
    margin: 0;
    line-height: 1.2;
}

.atl-filters__clear {
    background: none;
    border: none;
    padding: 2px 0;
    cursor: pointer;
    font-family: var(--atl-body);
    font-size: 12px;
    color: var(--atl-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.atl-filters__clear.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.atl-filters__rule {
    border: none;
    border-top: 1px solid var(--atl-border);
    margin: 0 0 20px;
}

.atl-filter-group {
    margin-bottom: 6px;
}

.atl-filter-group--sep {
    border-top: 1px solid var(--atl-border);
    margin-top: 10px;
    padding-top: 10px;
}

/* ── Custom branded checkbox ──────────────────────────── */

.atl-filter-label {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 14px;
    font-family: var(--atl-body);
    color: var(--atl-dark);
    cursor: pointer;
    padding: 4px 0;
    line-height: 1.3;
    user-select: none;
    position: relative;
}

/* Hide native input but keep it accessible */
.atl-filter-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Custom box drawn via the label's ::before */
.atl-filter-label::before {
    content: '';
    flex-shrink: 0;
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--atl-border);
    border-radius: 4px;
    background: var(--atl-white);
    margin-right: 9px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

/* Checkmark drawn via ::after */
.atl-filter-label::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    width: 5px;
    height: 9px;
    border: 2px solid var(--atl-white);
    border-top: none;
    border-left: none;
    transform: translateY(-65%) rotate(45deg);
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* Checked state */
.atl-filter-label:has(.atl-filter-checkbox:checked)::before {
    background: var(--atl-accent);
    border-color: var(--atl-accent);
}

.atl-filter-label:has(.atl-filter-checkbox:checked)::after {
    opacity: 1;
}

/* Hover */
.atl-filter-label:hover::before {
    border-color: var(--atl-accent);
}

.atl-filter-label:hover .atl-filter-label__text {
    color: var(--atl-accent);
}

.atl-filter-label__text {
    transition: color 0.1s ease;
}

/* ── Tool Grid ────────────────────────────────────────── */

.atl-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    align-content: start;
}

/* ── Tool Card ────────────────────────────────────────── */

.atl-card {
    background: var(--atl-white);
    border: 1px solid var(--atl-border);
    border-radius: var(--atl-radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.atl-card:hover {
    box-shadow: 0 6px 24px rgba(120, 141, 227, 0.14);
    border-color: rgba(120, 141, 227, 0.4);
}

.atl-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.atl-card__icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atl-card__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.atl-card__tag {
    display: inline-flex;
    align-items: center;
    background: rgba(120, 141, 227, 0.1);
    color: var(--atl-accent);
    font-family: var(--atl-body);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: capitalize;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 4px;
}

.atl-card__title {
    font-family: var(--atl-heading);
    font-size: 18px;
    font-weight: 500;
    color: var(--atl-dark);
    letter-spacing: -0.04em;
    margin: 0 0 8px;
    line-height: 1.25;
}

.atl-card__desc {
    font-family: var(--atl-body);
    font-size: 13px;
    color: var(--atl-dark);
    opacity: 0.75;
    margin: 0 0 14px;
    line-height: 1.5;
    flex-grow: 1;
}

.atl-card__ideal {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 16px;
}

.atl-card__ideal-label {
    font-family: var(--atl-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--atl-dark);
    opacity: 0.45;
}

.atl-card__ideal-value {
    font-family: var(--atl-body);
    font-size: 13px;
    color: var(--atl-dark);
    line-height: 1.4;
}

.atl-card__btn {
    display: block;
    background: var(--atl-accent);
    color: var(--atl-white);
    text-align: center;
    padding: 10px 18px;
    border-radius: 8px;
    font-family: var(--atl-body);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease;
    margin-top: auto;
}

.atl-card__btn:hover,
.atl-card__btn:focus {
    background: #6679cc;
    color: var(--atl-white);
    text-decoration: none;
}

/* ── Empty / No Results ───────────────────────────────── */

.atl-empty,
.atl-no-results {
    grid-column: 1 / -1;
    text-align: center;
    font-family: var(--atl-body);
    color: var(--atl-dark);
    opacity: 0.5;
    font-size: 15px;
    padding: 60px 20px;
    margin: 0;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 900px) {
    .atl-tool-library {
        flex-direction: column;
    }

    /* flex: 1 sets height in a column container, not width — be explicit */
    .atl-grid {
        width: 100%;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    .atl-filters {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

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

    .atl-card {
        width: 100%;
    }
}
