/**
 * History List Component
 * Shared entry history used by coffee and tea apps. Uses --app-accent and
 * related tokens from settings.css so each app gets its own accent color
 * automatically via the body class (.app-coffee, .app-tea, etc.).
 * @version 1.0.0
 */

/* =============================================================================
   HISTORY SECTION
   ============================================================================= */

.history-section {
    width: 100%;
    margin-top: 4px;
}

.history-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-accent);
    background: transparent;
    border: 1.5px dashed rgb(0 0 0 / 12%);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-toggle:hover {
    background: rgb(0 0 0 / 3%);
    border-color: var(--app-accent);
}

.history-toggle[aria-expanded="true"] .history-toggle-icon {
    transform: rotate(180deg);
}

.history-toggle-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.history-list {
    display: none;
    margin-top: 12px;
}

.history-list.expanded {
    display: block;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgb(255 255 255 / 65%);
    border: 1px solid rgb(0 0 0 / 8%);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: background 0.15s ease;
}

.history-item:hover {
    background: rgb(255 255 255 / 85%);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-details {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 12px;
    color: #888;
}

.history-item-rating {
    color: var(--app-star, #E8A838);
}

.history-item-time {
    color: #aaa;
}

.history-item-actions {
    display: flex;
    gap: 4px;
    margin-left: 12px;
}

.history-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: transparent;
    border: 1px solid rgb(0 0 0 / 10%);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.history-action-btn:hover {
    background: rgb(255 255 255 / 80%);
    border-color: var(--app-accent);
}

.history-action-btn--delete:hover {
    background: #FEE2E2;
    border-color: #EF4444;
}

.history-empty {
    text-align: center;
    padding: 20px;
    color: #bbb;
    font-size: 14px;
    font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
    .history-toggle,
    .history-toggle-icon,
    .history-item,
    .history-action-btn {
        transition-duration: 0.01ms !important;
    }
}
