/**
 * Home sidebar — การ์ด "ภาพรวมการใช้งาน": รายการเมนูลัดที่ใช้ล่าสุด
 * Tokens: var(--dm-*) / var(--dm-home-*) (กำหนดใน home-sidebar.css)
 */

.home-sidebar .hs-usage-history {
    text-align: left;
}

.home-sidebar .hs-usage-history-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dm-home-muted, var(--dm-text-muted));
}

.home-sidebar .hs-usage-history-empty {
    color: var(--dm-home-muted, var(--dm-text-muted));
}

.home-sidebar .hs-usage-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin: 0;
    padding: 0;
}

.home-sidebar .hs-usage-history-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* แถวปักหมุด = ปุ่มเมนูลัดอันเดียว; หมุดอยู่ขวาสุดข้างใน */
.home-sidebar .hs-pinned-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    box-sizing: border-box;
}

.home-sidebar .hs-pinned-row .hs-pinned-link {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    text-align: left;
    box-shadow: none;
}

.home-sidebar .hs-pinned-row .hs-pinned-link:hover,
.home-sidebar .hs-pinned-row .hs-pinned-link:focus-visible {
    color: inherit;
    text-decoration: none;
    outline: none;
}

.home-sidebar .hs-pinned-row .hs-pinned-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-sidebar .hs-pinned-row .hs-usage-pin-btn {
    flex: 0 0 auto;
    margin-left: auto;
}

.home-sidebar .hs-usage-pin-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--dm-home-muted, var(--dm-text-muted));
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.home-sidebar .hs-usage-pin-btn:hover,
.home-sidebar .hs-usage-pin-btn:focus-visible {
    color: var(--dm-primary);
    background: color-mix(in srgb, var(--dm-primary) 10%, var(--dm-home-surface, var(--dm-bg-surface)));
    border-color: color-mix(in srgb, var(--dm-primary) 22%, var(--dm-home-border, var(--dm-border)));
    outline: none;
}

.home-sidebar .hs-usage-pin-btn.is-pinned {
    color: var(--dm-primary);
    background: color-mix(in srgb, var(--dm-primary) 14%, var(--dm-home-surface, var(--dm-bg-surface)));
}

.home-sidebar .hs-usage-pin-msg {
    color: var(--dm-danger, var(--dm-text-muted));
}

.home-sidebar .hs-usage-history-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    padding: 0.4rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--dm-home-text, var(--dm-text-main));
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.home-sidebar .hs-usage-history-icon {
    flex: 0 0 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--dm-primary) 12%, var(--dm-home-surface, var(--dm-bg-surface)));
    color: var(--dm-primary);
    font-size: 0.85rem;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.home-sidebar .hs-usage-history-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.home-sidebar .hs-usage-history-arrow {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--dm-primary);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.home-sidebar .hs-usage-history-link:hover,
.home-sidebar .hs-usage-history-link:focus-visible {
    background: color-mix(in srgb, var(--dm-primary) 9%, var(--dm-home-surface, var(--dm-bg-surface)));
    border-color: color-mix(in srgb, var(--dm-primary) 28%, var(--dm-home-border, var(--dm-border)));
    color: var(--dm-home-text, var(--dm-text-main));
    text-decoration: none;
}

.home-sidebar .hs-usage-history-link:hover .hs-usage-history-icon,
.home-sidebar .hs-usage-history-link:focus-visible .hs-usage-history-icon {
    background: var(--dm-primary);
    color: var(--dm-home-surface, var(--dm-bg-surface));
}

.home-sidebar .hs-usage-history-link:hover .hs-usage-history-arrow,
.home-sidebar .hs-usage-history-link:focus-visible .hs-usage-history-arrow {
    opacity: 1;
    transform: translateX(0);
}

.home-sidebar .hs-usage-history-link:focus-visible {
    outline: 2px solid var(--dm-primary);
    outline-offset: 1px;
}

.home-sidebar .hs-usage-history-link:active {
    background: color-mix(in srgb, var(--dm-primary) 16%, var(--dm-home-surface, var(--dm-bg-surface)));
}

@media (prefers-reduced-motion: reduce) {
    .home-sidebar .hs-usage-history-link,
    .home-sidebar .hs-usage-history-icon,
    .home-sidebar .hs-usage-history-arrow {
        transition: none;
    }

    .home-sidebar .hs-usage-history-arrow {
        transform: none;
    }
}
